Re: Is there a public API equvalent for urllib2.parse_http_list?

2012-09-20 Thread Cosmia Luna
On Friday, September 21, 2012 2:22:08 PM UTC+8, Cosmia Luna wrote: > I'm porting my code to python3, and found there is no parse_http_list in any > module of urllib of python3. > > > > So, is there a public API equvalent for urllib2.parse_http_

Is there a public API equvalent for urllib2.parse_http_list?

2012-09-20 Thread Cosmia Luna
I'm porting my code to python3, and found there is no parse_http_list in any module of urllib of python3. So, is there a public API equvalent for urllib2.parse_http_list? Thanks. Cosmia Luna -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-18 Thread Cosmia Luna
I think I got the way to handle it but with small problem and probably at unnecessary performance cost. If you're going to use it, be sure rewrite the code and remove the lines which you don't need. Ad, test them, the code below is only tested on py3.2, and may contains a lot of bugs even in py

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Cosmia Luna
On Saturday, March 17, 2012 6:04:58 PM UTC+8, Cosmia Luna wrote: > On Saturday, March 17, 2012 5:25:06 PM UTC+8, Peter Otten wrote: > > Cosmia Luna wrote: > > > > > I'm porting my existing work to Python 3.X, but... > > > > > > class F

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Cosmia Luna
On Saturday, March 17, 2012 5:25:06 PM UTC+8, Peter Otten wrote: > Cosmia Luna wrote: > > > I'm porting my existing work to Python 3.X, but... > > > > class Foo: > > def bar(self): > > pass > > > > mthd = Foo.bar > > &

Re: How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-17 Thread Cosmia Luna
On Saturday, March 17, 2012 3:34:57 PM UTC+8, Richard Thomas wrote: > On Saturday, 17 March 2012 05:30:34 UTC, Cosmia Luna wrote: > > I'm porting my existing work to Python 3.X, but... > > > > class Foo: > > def bar(self): > > pass &

How to get a reference of the 'owner' class to which a method belongs in Python 3.X?

2012-03-16 Thread Cosmia Luna
I'm porting my existing work to Python 3.X, but... class Foo: def bar(self): pass mthd = Foo.bar assert mthd.im_class is Foo # this does not work in py3k So, how can I get a reference to Foo? This is important when writing decorators, the only way I can think out is: class Foo:

How to decide if a object is instancemethod?

2012-03-14 Thread Cosmia Luna
class Foo(object): def bar(self): return 'Something' func = Foo().bar if type(func) == : # This should be always true pass # do something here What should type at ? Thanks Cosmia -- http://mail.python.org/mailman/listinfo/python-list

Re: How to re-implement the crypt.crypt function?

2012-03-11 Thread Cosmia Luna
On Sunday, March 11, 2012 4:16:52 AM UTC+8, Christian Heimes wrote: > Am 10.03.2012 20:33, schrieb Cosmia Luna: > > I'm not searching for a full solution and only want to know how to use > > hashlib to create a equivalent string like > > If you chance your mind and cho

How to re-implement the crypt.crypt function?

2012-03-10 Thread Cosmia Luna
I'm not searching for a full solution and only want to know how to use hashlib to create a equivalent string like crypt.crypt('123456', '$6$ds41p/9VMA.BHH0U') returns the string below. '$6$ds41p/9VMA.BHH0U$yv25s7jLxTRKLDNjIvT0Qc2jbcqdFRi5.PftO3cveTvjK49JhwCarIowOfrrNPD/PpYT3n6oNDIbjAONh8RXt1'