Re: I don't why there is no output....

2010-12-24 Thread chad
On Dec 24, 4:00 pm, chad wrote: > Given the following... > > #!/usr/bin/python > > import pexpect > > p = pexpect.spawn('cat') > p.sendline('1234') > p.expect (['1234']) > p.expect (['1234']) > > I no output when I run it... > > [cdal...@localhost oakland]$ ./ecat.py > [cdal...@localhost oakland]$

I don't why there is no output....

2010-12-24 Thread chad
Given the following... #!/usr/bin/python import pexpect p = pexpect.spawn('cat') p.sendline('1234') p.expect (['1234']) p.expect (['1234']) I no output when I run it... [cdal...@localhost oakland]$ ./ecat.py [cdal...@localhost oakland]$ I don't get it. I was expecting to see the output from b

Re: type(d) != type(d.copy()) when type(d).issubclass(dict)

2010-12-24 Thread Benjamin Kaplan
On Dec 24, 2010 4:40 PM, "Flávio Lisbôa" wrote: >> >> copy, here, is a dict method. It will create a dict. >> If you really need it, you could try this: >> >> import copy >> class neodict(dict): >>def copy(self): >>return copy.copy(self) >> >> d = neodict() >> print type(d) >> dd = d.

Re: How to pop the interpreter's stack?

2010-12-24 Thread Ethan Furman
Carl Banks wrote: On Dec 24, 1:24 am, Steven D'Aprano wrote: On Thu, 23 Dec 2010 22:38:05 -0800, Carl Banks wrote: OTOH, going the extra mile to hide useful information from a user is asinine. As a user, I will decide for myself how I want to use implementation-defined information, and I don't

Re: type(d) != type(d.copy()) when type(d).issubclass(dict)

2010-12-24 Thread Flávio Lisbôa
> > copy, here, is a dict method. It will create a dict. > If you really need it, you could try this: > > import copy > class neodict(dict): >def copy(self): >return copy.copy(self) > > d = neodict() > print type(d) > dd = d.copy() > print type(dd) One more gotcha to python... OO in

Re: type(d) != type(d.copy()) when type(d).issubclass(dict)

2010-12-24 Thread David Robinow
On Fri, Dec 24, 2010 at 1:52 PM, kj wrote: > Watch this: > class neodict(dict): pass > ... d = neodict() type(d) > type(d.copy()) > > > > Bug?  Feature?  Genius beyond the grasp of schlubs like me? copy, here, is a dict method. It will create a dict. If you really need it, y

Re: How can a function find the function that called it?

2010-12-24 Thread Mark Wooding
kj writes: > But OrderedDict's functionality *requires* that its __init__ be > run, and this __init__, in turn, does part of its initialization > by calling the update method. > > Therefore, the update method of the new subclass needs to be able > to identify the calling function in order to make

type(d) != type(d.copy()) when type(d).issubclass(dict)

2010-12-24 Thread kj
Watch this: >>> class neodict(dict): pass ... >>> d = neodict() >>> type(d) >>> type(d.copy()) Bug? Feature? Genius beyond the grasp of schlubs like me? ~kj -- http://mail.python.org/mailman/listinfo/python-list

Re: How to pop the interpreter's stack?

2010-12-24 Thread John Nagle
On 12/24/2010 3:24 AM, Carl Banks wrote: On Dec 24, 1:24 am, Steven D'Aprano wrote: All I'm suggesting is that there should be a way of reducing the boilerplate needed for this idiom: def _validate_arg(x): if x == 'bad input': return False return True def f(arg): if not _vali

Re: How can a function find the function that called it?

2010-12-24 Thread kj
In Daniel Urban writes: >On Fri, Dec 24, 2010 at 17:24, kj wrote: >> (BTW, I don't understand why inspect doesn't provide something as >> basic as the *class* that the method belongs to, whenever applicable. >> I imagine there's a good reason for this coyness, but I can't figure >> it out.) >

Re: [Python] How can a function find the function that called it?

2010-12-24 Thread John Nagle
On 12/24/2010 8:51 AM, Chris Gonnerman wrote: On 12/24/2010 10:24 AM, kj wrote: I want to implement a frozen and ordered dict. I thought I'd implement it as a subclass of collections.OrderedDict that prohibits all modifications to the dictionary after it has been initialized. That's actua

Re: How can a function find the function that called it?

2010-12-24 Thread Daniel Urban
On Fri, Dec 24, 2010 at 17:24, kj wrote: > (BTW, I don't understand why inspect doesn't provide something as > basic as the *class* that the method belongs to, whenever applicable. > I imagine there's a good reason for this coyness, but I can't figure > it out.) One function object can "belong to

Re: How can a function find the function that called it?

2010-12-24 Thread ChasBrown
On Dec 24, 8:24 am, kj wrote: > I want to implement a frozen and ordered dict. > > I thought I'd implement it as a subclass of collections.OrderedDict > that prohibits all modifications to the dictionary after it has > been initialized. > > In particular, calling this frozen subclass's update meth

Re: lxml etree question

2010-12-24 Thread Adam Tauno Williams
On Fri, 2010-12-24 at 20:48 +0530, Nitin Pawar wrote: > On Fri, Dec 24, 2010 at 8:40 PM, Jim wrote: > Hello, I wonder if someone knows about lxml.etree and > namespaces? Yes, and don't. > I want to build an ElementTree where some of the sub-elements have > attributes that serial

*** The Jew World Order - A TUTORIAL Exposition in Banking and Economics ***

2010-12-24 Thread small Pox
*** The Jew World Order - A TUTORIAL Exposition in Banking and Economics *** Is the New World Order “Jewish”? February 12, 2005 What do you trust? Government, Paper or Gold? Let’s begin by defining the “New World Order.” The mainspring of the New World Order is the desire on the part of the wor

*** Alex Jones Exposes Google's Plan to Dominate the Internet *** plz spread this video

2010-12-24 Thread small Pox
Alex Jones Exposes Google's Plan to Dominate the Internet http://www.youtube.com/watch?v=LiqOL9ausOI Alex Jones Exposes Google's Plan to Dominate the Internet http://www.youtube.com/watch?v=LiqOL9ausOI Alex Jones Exposes Google's Plan to Dominate the Internet http://www.youtube.com/watch?v=LiqOL9

Re: [Python] How can a function find the function that called it?

2010-12-24 Thread Chris Gonnerman
On 12/24/2010 10:24 AM, kj wrote: I want to implement a frozen and ordered dict. I thought I'd implement it as a subclass of collections.OrderedDict that prohibits all modifications to the dictionary after it has been initialized. In particular, calling this frozen subclass's update method shou

How can a function find the function that called it?

2010-12-24 Thread kj
I want to implement a frozen and ordered dict. I thought I'd implement it as a subclass of collections.OrderedDict that prohibits all modifications to the dictionary after it has been initialized. In particular, calling this frozen subclass's update method should, in general, trigger an exce

Re: lxml etree question

2010-12-24 Thread Nitin Pawar
On Fri, Dec 24, 2010 at 8:40 PM, Jim wrote: > Hello, I wonder if someone knows about lxml.etree and namespaces? > > I want to build an ElementTree where some of the sub-elements have > attributes that serialize this way. > > .. > > I've tried just comment_elet.set('xml:lang','de') and it didn't

lxml etree question

2010-12-24 Thread Jim
Hello, I wonder if someone knows about lxml.etree and namespaces? I want to build an ElementTree where some of the sub-elements have attributes that serialize this way. .. I've tried just comment_elet.set('xml:lang','de') and it didn't like that at all (although it takes comment_elet.set('aut

Re: using strings from extension module question + possible documentation error

2010-12-24 Thread Oleg Leschov
On Dec 24, 4:42 pm, Stefan Sonnenberg-Carstens wrote: > You could as an alternative just use byte arrays. These are changeable. thanks, that's exactly what I need. I have completely missed those things since they're pretty new. -- http://mail.python.org/mailman/listinfo/python-list

Re: using strings from extension module question + possible documentation error

2010-12-24 Thread Stefan Sonnenberg-Carstens
Am 24.12.2010 13:31, schrieb Oleg Leschov: Hi, I am writing an extension module in which I want to do some heavy number crunching on large amount of data. The input data is prepared using Python code and passed to this extension module via strings containing binary data, and the result is also

Re: GUI Tools for Python 3.1

2010-12-24 Thread python
Randy, Tkinter is a viable GUI platform with Python 3.1's (and Python 2.7's) support for ttk (Tile). The new ttk module supports theme aware controls so that you can build beautiful GUI's that match your underlying platform's standards. Ttk also includes theme aware treeview and notebook controls.

Re: Partition Recursive

2010-12-24 Thread macm
Thanks all In [11]: reps = 5 In [12]: t = Timer("url = 'http://docs.python.org/dev/library/ stdtypes.html? highlight=partition#str.partition' ;sp = re.compile('(//?|[;?:@=&#.])'); filter(len, sp.split(url))", 'import re') In [13]: print sum(t.repeat(repeat=reps, number=1)) / reps 4.94003295898e-0

Re: using python ftp

2010-12-24 Thread Giampaolo Rodolà
Starting from Python 2.7, yes: http://docs.python.org/library/ftplib.html#ftplib.FTP_TLS Regards, --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2010/12/23 Octavian Rasnita : > Can this lib also work with ftps? > > Thanks. > > Octavian > > - Original Mes

using strings from extension module question + possible documentation error

2010-12-24 Thread Oleg Leschov
Hi, I am writing an extension module in which I want to do some heavy number crunching on large amount of data. The input data is prepared using Python code and passed to this extension module via strings containing binary data, and the result is also passed back as a list of pretty large strings

Re: How to pop the interpreter's stack?

2010-12-24 Thread Carl Banks
On Dec 24, 1:24 am, Steven D'Aprano wrote: > On Thu, 23 Dec 2010 22:38:05 -0800, Carl Banks wrote: > > OTOH, going the extra mile to hide useful information from a user is > > asinine. As a user, I will decide for myself how I want to use > > implementation-defined information, and I don't want th

Re: How to pop the interpreter's stack?

2010-12-24 Thread Steven D'Aprano
On Thu, 23 Dec 2010 22:38:05 -0800, Carl Banks wrote: >> Do you accept that, as a general principle, unhandled errors should be >> reported as close as possible to where the error occurs? If your answer >> to that is No, then where do you think unhandled errors should be >> reported? > > "No", an

Re: round in 2.6 and 2.7

2010-12-24 Thread Hrvoje Niksic
"Martin v. Loewis" writes: >> Type "help", "copyright", "credits" or "license" for more information. > 9.95 >> 9.9493 > "%.16g" % 9.95 >> '9.949' > round(9.95, 1) >> 10.0 >> >> So it seems that Python is going out of its way to intuitively round >> 9.95, while