On 12/4/10, Alan Gauld <[email protected]> wrote: > > "Steven D'Aprano" <[email protected]> wrote > >> >>> for i in (1, 2, 3): >> ... print(i, "spam", end="\n" if i==3 else "***") > > Ooooh! A new trick. > I hadn't thought of using the conditional expression there but it > makes a lot of sense. > Definitely more fun and flexible than the old comma at the end of a > print in v2 :-) So is this a python3.x feature only? Is there an equivallent in 2.x? I had not realized if statements could be used in calling functions like that or that they could be arranged in that way, but I am sticking to python2 since most packages are still written for it. > > Thanks for that, > > Alan G. > > > _______________________________________________ > Tutor maillist - [email protected] > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
-- Have a great day, Alex (msg sent from GMail website) [email protected]; http://www.facebook.com/mehgcap _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
