Re: Catching a segfault in a Python library

2007-11-24 Thread Ayaz Ahmed Khan
around > code > to catch a segfault. > > \d Wouldn't it be better to narrow down to what in your code is invoking PIL in a manner in which PIL exhibits such behaviour, and handle it within your code? Just a thought! -- Ayaz Ahmed Khan -- http://mail.python.org/mailman/listinfo/python-list

Re: md5 wrongness?

2007-11-24 Thread Ayaz Ahmed Khan
7;snagglefrob').hexdigest() > '9eb2459fcdd9f9b8a9fef7348bcac933' >>>> md5.new('snagglefrob\n').hexdigest() > 'f842244d79af85b457811091319d85ff' >>>> Or, alternatively: $ echo -n snagglefrob | md5sum 9eb2459fcdd9f9b8a9fef7348bcac933 - -- Ayaz Ahmed Khan -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-22 Thread Ayaz Ahmed Khan
for @ prefix is better- > looking than self. I've never really understood why some people find that annoying to do. I make it a point to use, for example, the `this` operator when writing C++ code to avoid implicilty calling/accessing attributes of objects as much as possible. -

Re: introspection and functions

2007-08-22 Thread Ayaz Ahmed Khan
"James Stroud" typed: > py> def doit(a, b, c, x=14): > ... pass > ... > py> doit.func_code.co_argcount > 4 > py> doit.func_code.co_varnames > ('a', 'b', 'c', 'x') > py> doit.func_defaults > (14,) Nea

Re: Console UI

2007-04-08 Thread Ayaz Ahmed Khan
"Clement" typed: > My project is based on console Application. Is there any console UI > except urwid. If so, can i come to know. There is ``curses''. -- Ayaz Ahmed Khan Do what comes naturally now. Seethe and fume and throw a tantrum. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove multiple occurrences of a string within a list?

2007-04-05 Thread Ayaz Ahmed Khan
7 usec per loop $ python -m timeit -s "L = ['0024', 'haha', '0024']" "[i for i in L if i != '0024']" 10 loops, best of 3: 5.41 usec per loop $ python -m timeit -s "L = ['0024', 'haha', '0024']" "[i for i in L if i]" 10 loops, best of 3: 6.71 usec per loop $ python -m timeit -s "L = ['0024', 'haha', '0024']; import itertools" "itertools.ifilter(None, L)" 10 loops, best of 3: 4.12 usec per loop -- Ayaz Ahmed Khan Do what comes naturally now. Seethe and fume and throw a tantrum. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove multiple occurrences of a string within a list?

2007-04-04 Thread Ayaz Ahmed Khan
uot;,"haha","0024"] In [2]: filter(lambda x: x != "0024", l) Out[2]: ['haha'] -- Ayaz Ahmed Khan Do what comes naturally now. Seethe and fume and throw a tantrum. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-08 Thread Ayaz Ahmed Khan
"Gabriel Genellina" typed: > > See > http://effbot.org/pyfaq/why-are-default-values-shared-between-objects.htm Thanks for the link, Gabriel. I didn't know about this. -- Ayaz Ahmed Khan Falling in love makes smoking pot all day look like the ultimate in restraint.

Re: Newbie question

2007-03-06 Thread Ayaz Ahmed Khan
now? Most everywhere I've read about map() and filter() seemed to discourage their use stating that they're becoming depreciated (with the exception of Dive Into Python which advocates use of these two functions in preference to even list comprehensions, if I've read it properly).

Re: HTML Parsing

2007-02-10 Thread Ayaz Ahmed Khan
rlopen('http://www.someurl.tld/')) >>> title = soup.find(name='span', attrs={'class':'title'}, >>> text=re.compile(r'^Linux \w+')) >>> title u'Linux Kernel Bluetooth CAPI Packet Remote Buffer Overflow Vulnerabili

Something like the getattr() trick.

2007-02-10 Thread Ayaz Ahmed Khan
) ..) a = class_obj(link) a._parse() getattr() takes an object as its first argument. I can't seem to figure out how to make it work here. -- Ayaz Ahmed Khan A witty saying proves nothing, but saying something pointless gets people's attention. -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing member

2007-02-05 Thread Ayaz Ahmed Khan
t__() calls the __init__() of the first of the class in the list of classes from which the calling class inherits. For example: class C(A, B): def __init__(self): super(C, self).__init__() calls A's __init__ explicity when an instance of C is instantiated. I might be missing so

Re: newbie question: ftp.storbinary()

2007-02-03 Thread Ayaz Ahmed Khan
level(2) ftp.connect(_host, _port) ftp.login(_user, _pass) ftp.storbinary('STOR ' + _file, open(_file)) ftp.quit() -- Ayaz Ahmed Khan A witty saying proves nothing, but saying something pointless gets people's attention. -- http://mail.python.org/mailman/listinfo/python-list