How to do this in Python...
Jp Calderone
exarkun at intarweb.us
Fri Jan 24 17:04:24 EST 2003
On Fri, Jan 24, 2003 at 03:08:26PM -0500, Michael Tiller wrote:
>
> [snip]
>
> I want to be clear about something. I have no particular fondness for
> the...
>
> if (a=b) then ...
>
> "feature" in C. I agree that *THAT SYNTAX* is confusing.
When all you're saving is a single line of code, I can't see why it's even
worth discussing at such length. This is so commonly desired, though, that
a while ago I wrote this... http://intarweb.us:8080/evil/assignment.py
(Un)fortunately, with recent interpreter changes, it no longer works for
code anywhere but at the top-level of a module.
I imagine a similar function could be written that worked with more recent
versions of Python, if one so desired. I think that if you're going this
route at all, an explicit function call is better than the bizarre list-comp
based solution discussed elsewhere in the thread.
Jp
--
"There is no reason for any individual to have a computer in their
home."
-- Ken Olson, President of DEC, World Future Society
Convention, 1977
--
up 40 days, 1:49, 7 users, load average: 0.60, 0.63, 0.62
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030124/3fc1a7fb/attachment.sig>
More information about the Python-list
mailing list