object as a reserved keyword
John J. Lee
jjl at pobox.com
Sun Jul 20 13:28:11 EDT 2003
danb_83 at yahoo.com (Dan Bishop) writes:
[...]
> When I write in other languages and need a meaningless variable name,
> I tend to use an abbreviation for the variable's type.
>
> public void foo(String str) {/* ... */}
> public void foo(List list) {/* ... */}
>
> As you can see, this convention doesn't carry over very well to
> Python.
Which is frequently a good thing, I think. Most of the time one does
this, it's (bad) laziness. Better to think of a name that describes
more than the type.
People do often use names ending in 's' for iterators (including
sequences), which is useful for ease of reading:
foos = [Foo(1), Foo(2), Foo(3)]
for foo in foos:
print foo
(breaking the rule about naming things after their type there, of
course! -- but I have the excuse that there's no meaning *there* to
use when picking names in that made-up example)
Also, I often use the name 'text' where you write 'str' above.
John
More information about the Python-list
mailing list