base converter
Nick Perkins
nperkins7 at home.com
Thu Jun 14 23:09:43 EDT 2001
More information about the Python-list mailing list
Thu Jun 14 23:09:43 EDT 2001
- Previous message (by thread): base converter
- Next message (by thread): weird behavior wrapping global functions into classes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
...be careful what you ask for! ..i can't follow that at all--are you a perl programmer? "Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> wrote in message news:slrn.pl.9ihj95.lfq.qrczak at qrnik.zagroda... > Thu, 14 Jun 2001 10:15:21 GMT, Fredrik Lundh <fredrik at pythonware.com> pisze: > > > (still waiting for someone to come up with a one-liner using > > list comprehensions ;-) > > As you wish :-) > > from __future__ import nested_scopes > import string > def fix(f): return lambda x: f(fix(f), x) > def BaseConvert(x, b, digits=string.digits+string.uppercase): > return [digits[d%b] for d in > fix(lambda iter, y: y and iter(y/b)+[y] or [])(x) or [0]] > > -- > __("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/ > \__/ > ^^ SYGNATURA ZASTÊPCZA > QRCZAK
- Previous message (by thread): base converter
- Next message (by thread): weird behavior wrapping global functions into classes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list