On Tue, Nov 25, 2003 at 07:25:17PM -0800, Jim Dukarm wrote:
> ---------- Greg Ward: ---------------
> > Note 'class_' instead of 'css_class' -- this is the convention used by
> > PyGTK to avoid collisions with keywords (builtins too? can't remember),
> > and it's as good as any.
>
> I have seen this gimmick in a few places, so there should be no
> problem with Quixote doing it, too. Easier to spell than "css_class".
It's a nasty, inconsistent gimmick, IMO. Or does it allow for
consistent use of the trailing underscore even with non-keywords?
> > Also note that 'attrs' could just be an alias for 'dict', since the dict()
> > builtin in Python 2.2 works as expected:
>
> Please make that "will be". There is no need to invent more stuff
> to maintain. I would be even happier without the alias.
Lovely idea, but it seems to require more than just 2.2:
$ python2.2
Python 2.2.1 (#1, Sep 7 2002, 14:34:30)
>>> dict(foo=34, bar=43)
Traceback (most recent call last):
File "", line 1, in ?
TypeError: 'foo' is an invalid keyword argument for this function
>>> dict
So that's not what you'd call convenient. Doesn't work inconveniently
either:
>>> __builtins__.dict(foo=34, bar=43)
Traceback (most recent call last):
File "", line 1, in ?
TypeError: 'foo' is an invalid keyword argument for this function
Closest thing I find in 2.2 (or in Alex's misnamed "Nutshell" - it's a
steamer trunk, at least) is the decidedly inconvenient
>>> dict([['foo',34], ['bar',43]])
{'foo': 34, 'bar': 43}
which is longer than the customary dict literal, if not by much. :-(
--
Education makes people easy to lead, but difficult to drive;
easy to govern, but impossible to enslave. -- Henry Peter Brougham