Writing a string.ishex function

Aahz aahz at pythoncraft.com
Fri Jan 15 00:56:42 CET 2010


In article <mailman.935.1263499719.28905.python-list at python.org>,
D'Arcy J.M. Cain <darcy at druid.net> wrote:
>
>try: x = isinstance(s, int) and s or int(s, 0)
>except ValueError: [handle invalid input]

Why aren't you using the ternary?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list