Two minor syntactic proposals
Greg Ewing
see at my.signature
Tue Jun 19 23:31:32 EDT 2001
Alex Martelli wrote:
>
> I just hope it doesn't have to be
> as narrowly-worded as "allowing def x.y iff x is specifically
> a bare identifier that is bound to a class-object and is
> also the class's classname"...:-).
I like this idea too! The way I'd describe it is
as allowing a general l-value (i.e. anything that can
appear on the lhs of an assignment) in place of
the current identifier-being-bound in def, class
and import statements.
By the way, here's another possible use -- creating
a dict-of-funcs for simulating a case-statement:
table = {}
def table['spam']():
...
def table['eggs']():
...
(On the downside -- I like the def self.foo() idea
too, and this is in direct conflict with it! Sigh,
can't have everything, I suppose, and I think I'd
rather have this than def self.foo() if it came
down to a choice.)
--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list