I've been learning Python slowly for a few months, coming from a C/C+
+, C#, Java, PHP background.  I ran across a code fragment I'm having
trouble wrapping my brain around.  I've searched the Language
Reference and was not able to find any info regarding the structure of
this code fragment:

int(text) if text.isdigit() else text

It is part of a larger lambda statement.  I do get the lambda
declaration, but having trouble with what is happening in that
fragment.  Here is the full lambda statement:

convert = lambda text: int(text) if text.isdigit() else text

Thanks for any help you can provide explaining this to me.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to