ishexdigit()

Uwe Schmitt uwe.schmitt at procoders.net
Wed Dec 31 05:40:29 EST 2003


Tim Roberts <timr at probo.com> wrote:

> Well, more Pythonish yet is to avoid the extraneous local variables, avoid
> the use of a type as a parameter name, and use as many little-used builtins
> as possible:

...

>    def ishexstring(strng):
>        return filter(ishexdigit, strng) == strng

better/faster/more pythonic:

         return reduce(lambda a,b: a and ishexdigit(b), strng, True)

Greetings, Uwe

-- 
Dr. rer. nat. Uwe Schmitt   http://www.procoders.net                      
schmitt at procoders.net      "A service to open source is a service to mankind."




More information about the Python-list mailing list