On 20/08/15 18:07, Alan Gauld wrote:
(print("that seems reasonable")) if time<=2
else print ("get a life")
There is an alternative way of writing what you want but
it's not very commonly used:
print("that seems reasonable" if time <=2 else "get a life")
I just realized that the OP's version would actually work
in Python v3 because print is a function.
It effectively evaluates as
None if time <= 2 else None
But can I suggest that it's not a good style to get into.
Either of the options that i suggested in my last mail
would be more idiomatic in the Python community.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor