With or Using
Delaney, Timothy
tdelaney at avaya.com
Tue Apr 17 20:48:40 EDT 2001
> If you write:
>
> a = A()
> with a:
> .b = c
>
> you could tell that b belongs to a while c is independant
> from a. This is
> the only good way to use a with and also the only part I
> really like about
> Visual Basic's syntax.
a = A()
a.b = B()
with a:
with .b:
.c = d
Hmm ... which object is .c in? Perhaps we need
with a:
with .b:
..c = d
to disambiguate?
I have *never* liked "with"-type clauses - I used them in Pascal for about
10 days before I discarded them - and that was in a language where there was
no ambiguity. In python, where you don't have to declare variables first
(see other thread - personally, I prefer it this way for a dynamically-typed
language) this makes it deadly dangerous.
Tim Delaney
More information about the Python-list
mailing list