Symbols as parameters?

Carl Banks pavlovevidence at gmail.com
Thu Jan 21 12:50:55 EST 2010


On Jan 21, 2:38 am, "Alf P. Steinbach" <al... at start.no> wrote:
> * Carl Banks:
>
> > On Jan 20, 11:43 pm, Martin Drautzburg <Martin.Drautzb... at web.de>
> [snip]
>
> >> What I am really looking for is a way
>
> >>         - to be able to call move(up)
> >>         - having the "up" symbol only in the context of the function call
>
> > Short answer is, you can't do it.
>
> On the contrary, it's not difficult to do.
>
> I provided an example in my answer to the OP (first reply in the thread).

Your example doesn't remotely do what the OP was asking for.  In fact
your example is so preposterous I question your sanity.


> However, it's IMHO an abuse of the language, not something that one should do.

Usually people abuse the language to achieve something (ostensibly)
useful.  Your example is so useless I don't think I would even call it
abuse.

As best as I can tell, what it is is you attempting to make yourself
look like some kind of badass by answering some absurdly literal
interpretation of the OP's question.

Except you haven't even done that:

class using_directions:
    up = 42
    move( up )
    print up # <- clearly not confined to context of function call



Carl Banks



More information about the Python-list mailing list