With or Using
Erik Max Francis
max at alcyone.com
Tue Apr 17 22:27:13 EDT 2001
Visionary Mike wrote:
> Can you expand on "it has only led to trouble"? I don't think it
> looses
> clarity, although it does introduce variable hiding.
Remco gave a good example. Look at this isolated bit of code:
with a:
b = c
What is happening here? Does this mean a.b = c, or b = a.c, or a.b =
a.c? Without prior knowledge of what a is, it's impossible to say.
Even ignoring variable hiding, with/using syntax introduces confusion
and ambiguity.
Imagine the worst case scenario:
class C:
...
def f(self, ...):
with self:
...
A lazy typist has just gained us a brief visit to hell.
Often programmers are looking to save a few keystrokes here and there.
That's a false goal; programmers should type _more_ when they're given
the opportunity, because more typing means being more explicit, and
being more explicit leads to better, more robust, more self-documenting
code. Especially in Python, one of its strongest points is its
explicitness and its lack of preprocessor magic and syntax shortening
that leads to clutter and confusing in so many languages. Introducing a
with/using syntax in Python would, in my opinion, help to undermine one
of Python's greatest strengths.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ I want to know God's thought; the rest are details.
\__/ Albert Einstein
Physics reference / http://www.alcyone.com/max/reference/physics/
A physics reference.
More information about the Python-list
mailing list