Python "with"

Ivan Voras ivoras at _fer.hr_
Mon Sep 17 11:49:55 CEST 2007


Laurent Pointal wrote:

> The ugly part is the 'tmp' name, try to choose a name with a proper 
> meaning about what it is really, and it become clean and readable:
> 
> filerefs = some.big.structure.or.nested.object.with.file.references
> filerefs.encoding = "utf-8"
> filerefs.name = "MyFileName.txt"
> filerefs.use_quotes = True
> 
> Isn't it ?

Well, no, but this might be due to personal tastes. At least, I don't 
think it's better then some other alternatives. For example, in C99 you 
can do:

static struct option_s foo_option = {
     .name = "foo",
     .type = O_STRING,
     .def_value = "default"
};

At least to me, this looks even better than the Pascal's syntax.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20070917/90d58a93/attachment.pgp>


More information about the Python-list mailing list