Steven D'Aprano wrote:
On Fri, 04 Sep 2009 22:51:39 -0700, Ken Newton wrote:

I would think this is much more than just copy from other language
styles or 'just' a syntax change -- the apparent widespread use would
hint at a deeper need.


"Apparent" is the key word there. There are lots of people who *say* this this useful functionality, but how many of them *actually* use it? And of those who do use it, how many of them know what they're doing? There are an awful lot of bad programmers out there.

In the dbf module I wrote, I use both the attribute access and the key lookup. The attribute access is great for interactive use, and for all the routines that play with the tables we have at work, where all the field names are indeed known at compile (aka coding) time. On the other hand, some routines don't know which fields they'll mucking about with, and so the key access is vital for them.

Of course, I could have done the whole thing using key access, and I did have to impose some restrictions on method names so they wouldn't clash with possible field names, but I love being able to type

  current_record.full_name == last_record.full_name

instead of

  current_record['full_name'] == last_record['full_name']

and it's much easier on my wrists, too.

Hopefully-not-a-bad-programmer-ly yours,

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to