[issue1714448] if something as x:

Jervis Whitley report at bugs.python.org
Sat Mar 14 14:30:14 CET 2009


Jervis Whitley <jervisau at gmail.com> added the comment:

Hi, 

I like this idea. 

I've put together a short patch that will implement inline
assignment. 

if f() -> name:
  use(name)

or more powerfully:

if f() -> name == 'spam':
   usespam(name)

the old syntax if something as x: is still available if that
is what is desired.

if (f() == 'spam') -> name:
   newname = name.replace('p', 'h') 

Patched against Py3k please kick the tires, I've added some tests and
developed a PEP.

----------
keywords: +patch
nosy: +jdwhitley
versions: +Python 3.1 -Python 2.6
Added file: http://bugs.python.org/file13329/assexp.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1714448>
_______________________________________


More information about the Python-bugs-list mailing list