With or Using

Remco Gerlich scarblac at pino.selwerd.nl
Tue Apr 17 17:36:27 EDT 2001


Tim Howarth <tim at worthy.demon.co.uk> wrote in comp.lang.python:
> In message <3ADC5AE1.53C3C4FE at alcyone.com>
>           Erik Max Francis <max at alcyone.com> wrote:
 > > It saves a small amount of typing (and not very much) at the expense of
> > a lack of clarity and the addition of ambiguity.
> 
> I thought with Python's block indenting it would be pretty clear what
> was being referred to.

Consider:

a = A()
with a:
   b = c
   
What does c refer to? Is it a.c or some global c? There's no way to tell.
It might even change from time to time. I'm assuming that c would refer to
a.c iff a has an attribute called c, and to another variable otherwise. But
even the fact that I have to make such an assumption shows that this should
not be Python... Be explicit as much as possible.

-- 
Remco Gerlich



More information about the Python-list mailing list