Jan Janech wrote: > math.round = lambda num: math.floor(num+0.5) if num >= 0 else \ > -math.floor(-num+0.5) Vida, dosud jsem nevedel, ze Python 2.5 zavedl ternarni operator.
Ve svych zdrojacich pouzivam formulaci P and A or B Nejcasteji pro vyber retezcu. Je to velmi strucne, citelne a nevyhodnocuje zbyvajici argument. Jen upozornuju, ze musite zajistit, ze A se nevyhodnoti jako False, protoze jinak je vysledkem B. :-) Narazil jsem jeste na jeden zajimavy trik: (B, A)[bool(P)] Trosku mene citelne, ale hlavne ma jiny efekt: Vyhodnocuje oba argumenty a teprv pak vybira. Tak pozor na to. -- \//\/\ http://macek.sandbox.cz http://www.easis.cz
begin:vcard fn:Vlada Macek n:Macek;Vlada adr:;;;Liberec;;;Czech Republic email;internet:[email protected] title:Software || Networking && UNIX tel;cell:+420 608 978 164 note;quoted-printable:GPG info: key 0x1F059424, fingerprint 1494 F8DD 6379 4CD7 E7E3 1FC9 D7504= 243 1F05 9424=0D=0A= =0D=0A= When you find a virus in mail from me, then I intended to infect you, sin= ce I use SW that is not distributing malware w/o my knowledge.=0D=0A= x-mozilla-html:FALSE url:http://macek.sandbox.cz version:2.1 end:vcard
_______________________________________________ Python mailing list [email protected] http://www.py.cz/mailman/listinfo/python
