executing arbitrary statements

2011-09-30 Thread Jason Swails
Hello everyone, I'm probably missing something pretty obvious, but I was wondering if there was a way of executing an arbitrary line of code somehow (such as a line of code based on user-input). There's the obvious use of "eval" that will evaluate a function call, but that doesn't allow all thing

Re: Suggested coding style

2011-09-30 Thread alex23
> > On Sep 29, 10:23 pm, rantingrick wrote: > > > What is so bad about breaking code in obscure places? > On Sep 29, 9:50 pm, alex23 wrote: > > Try coding in PHP across minor release versions and see how you feel > > about deprecating core functions on a whim. On Sep 30, 11:54 pm, rantingrick

Re: overloading operators for a function object

2011-09-30 Thread Chris Rebert
On Fri, Sep 30, 2011 at 9:50 PM, Fletcher Johnson wrote: > Is it possible to overload operators for a function? > > For instance I would like to do something roughly like... > > def func_maker(): >  def func(): pass > >  def __eq__(other): >    if other == "check":  return True >    return False >

overloading operators for a function object

2011-09-30 Thread Fletcher Johnson
Is it possible to overload operators for a function? For instance I would like to do something roughly like... def func_maker(): def func(): pass def __eq__(other): if other == "check": return True return False func.__eq__ = __eq__ return func newfunc = func_maker() newfunc ==

RE: [OT] Off-Topic Posts and Threads on the Python Mailing List

2011-09-30 Thread Navkirat Singh
Lol you all sound like google's angry birds with their feathers ruffled by a comment. You guys should open up another mailing list to extinguish your virtually bruised egos. . . . On Sep 30, 2011 10:27 PM, "Prasad, Ramit" wrote: -- http://mail.python.org/mailman/listinfo/python-list

Re: Python without a tty

2011-09-30 Thread Hans Mulder
On 30/09/11 20:34:37, RJB wrote: You could try the old UNIX "nohup ...&" technique for running a process in the background (the&) with no HangUP if you log out: $ nohup python -c "import sys,os; print os.isatty(sys.stdout.fileno())"& appending output to nohup.out $ cat nohup.out False But that

Re: Simplest way to resize an image-like array

2011-09-30 Thread Jon Clements
On Sep 30, 5:40 pm, John Ladasky wrote: > Hi folks, > > I have 500 x 500 arrays of floats, representing 2D "grayscale" images, > that I need to resample at a lower spatial resolution, say, 120 x 120 > (details to follow, if you feel they are relevant). > > I've got the numpy, and scipy, and matplo

Re: Modifying external running process using python

2011-09-30 Thread Nobody
On Thu, 29 Sep 2011 23:02:55 -0700, bingbang wrote: > Beginner here. I am trying to figure out how to modify a running > process on a linux system using Python. > I looked up trace and some other modules but they all seem to do with > following the currently executing python process. ptrace() is

Re: Python without a tty

2011-09-30 Thread Nobody
On Thu, 29 Sep 2011 11:53:12 +0200, Alain Ketterlin wrote: >> I have a Python script which I would like to test without a tty attached >> to the process. I could run it as a cron job, but is there an easier way? >> >> I am running Linux. > > Isn't os.setsid() what you're looking for? It makes th

Re: Suggested coding style

2011-09-30 Thread Alec Taylor
Meh, so run your own web-server. If wave isn't right, search on sourceforge for a while. On 10/1/11, Prasad, Ramit wrote: >>> The answer to any news/mail client with feature X type question is >>> normally "gnus" - although I don't know what "Gmail-like style" is. >>Yeah > > Gah, I got distracte

Re: Benefit and belief

2011-09-30 Thread Westley Martínez
On Fri, Sep 30, 2011 at 11:08:16AM -0700, rantingrick wrote: > On Sep 30, 11:36 am, Westley Martínez wrote: > > On Fri, Sep 30, 2011 at 09:22:59AM -0700, rusi wrote: > > > On Sep 30, 8:58�pm, Neil Cerutti wrote: > > > > On 2011-09-30, DevPlayer wrote: > > > > > > > I still assert that contradi

Re: Motion Tracking with Python

2011-09-30 Thread Derek Simkowiak
/How was her project received at school?/ She got an "Outstanding" blue ribbon award. The teachers were impressed. (It was only a mandatory school project; it was not part of a regional competition or anything fancy like that.) --Derek On 09/30/2011 09:40 AM, Irmen de Jong wrot

Re: Motion Tracking with Python

2011-09-30 Thread Derek Simkowiak
> /I am having problems with getting data from the CCD (basically i don't know how to do it :), can you give me a tip for doing this? Or explain how you did it please?/ I am using the OpenCV library to grab images. Here are the specific lines of code: self.capture = cv.CaptureFromCAM(0)

Re: Python without a tty

2011-09-30 Thread RJB
On Sep 29, 3:52 am, Steven D'Aprano wrote: > Alain Ketterlin wrote: > > Steven D'Aprano writes: > > >> I have a Python script which I would like to test without a tty attached > >> to the process. I could run it as a cron job, but is there an easier way? > > >> I am running Linux. > > > Isn't os.

Re: Benefit and belief

2011-09-30 Thread rantingrick
On Sep 30, 11:36 am, Westley Martínez wrote: > On Fri, Sep 30, 2011 at 09:22:59AM -0700, rusi wrote: > > On Sep 30, 8:58�pm, Neil Cerutti wrote: > > > On 2011-09-30, DevPlayer wrote: > > > > > I still assert that contradiction is caused by narrow perspective. > > > > > By that I mean: just bec

RE: Suggested coding style

2011-09-30 Thread Prasad, Ramit
>> The answer to any news/mail client with feature X type question is >> normally "gnus" - although I don't know what "Gmail-like style" is. >Yeah Gah, I got distracted mid-email and forgot to finish. What I wanted to say was, "Yeah, not knowing what 'Gmail-like style' makes a big difference ;)"

RE: Suggested coding style

2011-09-30 Thread Prasad, Ramit
May I suggest a[n] email client that can group mailing list threads? > The answer to any news/mail client with feature X type question is > normally "gnus" - although I don't know what "Gmail-like style" is. Yeah >slrn. Is good. Unless I am missing something, it does not do email. >http://in

Re: Suggested coding style

2011-09-30 Thread Alec Taylor
http://incubator.apache.org/wave/ On 10/1/11, Neil Cerutti wrote: > On 2011-09-30, Paul Rudin wrote: >> "Prasad, Ramit" writes: >> May I suggest a[n] email client that can group mailing list threads? >>> >>> Please do. Bonus points if it handles threading in a Gmail-like style. >> >> The an

Re: Suggested coding style

2011-09-30 Thread Neil Cerutti
On 2011-09-30, Paul Rudin wrote: > "Prasad, Ramit" writes: > >>>May I suggest a[n] email client that can group mailing list threads? >> >> Please do. Bonus points if it handles threading in a Gmail-like style. > > The answer to any news/mail client with feature X type question is > normally "gnus

Re: Suggested coding style

2011-09-30 Thread Alec Taylor
Maybe one Apache's Buzz? On 10/1/11, Prasad, Ramit wrote: >>> Please do. Bonus points if it handles threading in a Gmail-like style. >>> >> >>May I suggest Gmail? It handles threading in a very Gmail-like style. > > Curses, foiled by my lack of specificity! I meant desktop client. > Although...if

Re: Suggested coding style

2011-09-30 Thread Paul Rudin
"Prasad, Ramit" writes: >>May I suggest a[n] email client that can group mailing list threads? > > Please do. Bonus points if it handles threading in a Gmail-like style. The answer to any news/mail client with feature X type question is normally "gnus" - although I don't know what "Gmail-like st

Re: Benefit and belief

2011-09-30 Thread Ethan Furman
rusi wrote: On Sep 30, 9:41 pm, Chris Angelico wrote: On Sat, Oct 1, 2011 at 2:38 AM, Dennis Lee Bieber wrote: And I would argue that by starting with "Look out your window..." you have explicitly excluded the rest of the world from consideration in answering; you have narrowed the fo

Re: Suggested coding style

2011-09-30 Thread Chris Angelico
On Sat, Oct 1, 2011 at 3:05 AM, Prasad, Ramit wrote: > Curses, foiled by my lack of specificity! I meant desktop client. > Although...if another website does similar threading it would be good to > know. Never know when I will want to start avoiding Gmail :) > Ah, *desktop* client! Hm. I actual

RE: Suggested coding style

2011-09-30 Thread Prasad, Ramit
>> Please do. Bonus points if it handles threading in a Gmail-like style. >> > >May I suggest Gmail? It handles threading in a very Gmail-like style. Curses, foiled by my lack of specificity! I meant desktop client. Although...if another website does similar threading it would be good to know. Ne

Re: Suggested coding style

2011-09-30 Thread Chris Angelico
On Sat, Oct 1, 2011 at 2:06 AM, Prasad, Ramit wrote: >>May I suggest a[n] email client that can group mailing list threads? > > Please do. Bonus points if it handles threading in a Gmail-like style. > May I suggest Gmail? It handles threading in a very Gmail-like style. ChrisA running and duckin

Re: Benefit and belief

2011-09-30 Thread rusi
On Sep 30, 9:41 pm, Chris Angelico wrote: > On Sat, Oct 1, 2011 at 2:38 AM, Dennis Lee Bieber > wrote: > > >        And I would argue that by starting with "Look out your window..." > > you have explicitly excluded the rest of the world from consideration in > > answering; you have narrowed the

RE: [OT] Off-Topic Posts and Threads on the Python Mailing List

2011-09-30 Thread Prasad, Ramit
>I didn't say it would be on-topic. But we don't cease to be well-rounded >human beings with concerns beyond the narrow world of Python programming >just because we are writing on a programming forum. Everything is on topic to programmers! To (mis)quote Sheldon Cooper: "I'm a [programmer]. I have

RE: Suggested coding style

2011-09-30 Thread Prasad, Ramit
>May I suggest a[n] email client that can group mailing list threads? Please do. Bonus points if it handles threading in a Gmail-like style. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 -Origi

Simplest way to resize an image-like array

2011-09-30 Thread John Ladasky
Hi folks, I have 500 x 500 arrays of floats, representing 2D "grayscale" images, that I need to resample at a lower spatial resolution, say, 120 x 120 (details to follow, if you feel they are relevant). I've got the numpy, and scipy, and matplotlib. All of these packages hint at the fact that the

Re: Motion Tracking with Python

2011-09-30 Thread Irmen de Jong
On 30-9-2011 4:16, Derek Simkowiak wrote: > Hello, > I have a neat Python project I'd like to share. It does real-time motion > tracking, using > the Python bindings to the OpenCV library: > > http://derek.simkowiak.net/motion-tracking-with-python/ > > There is a YouTube video showing the script

Re: Benefit and belief

2011-09-30 Thread Chris Angelico
On Sat, Oct 1, 2011 at 2:38 AM, Dennis Lee Bieber wrote: >        And I would argue that by starting with "Look out your window..." > you have explicitly excluded the rest of the world from consideration in > answering; you have narrowed the focus to only the region visible from > "my window". >

Re: Benefit and belief

2011-09-30 Thread Westley Martínez
On Fri, Sep 30, 2011 at 09:22:59AM -0700, rusi wrote: > On Sep 30, 8:58 pm, Neil Cerutti wrote: > > On 2011-09-30, DevPlayer wrote: > > > > > > > > > I still assert that contradiction is caused by narrow perspective. > > > > > By that I mean: just because an objects scope may not see a certain >

Re: Benefit and belief

2011-09-30 Thread rusi
On Sep 30, 8:58 pm, Neil Cerutti wrote: > On 2011-09-30, DevPlayer wrote: > > > > > I still assert that contradiction is caused by narrow perspective. > > > By that I mean: just because an objects scope may not see a certain > > condition, doesn't mean that condition is non-existant. > > > I also

Re: Benefit and belief

2011-09-30 Thread Neil Cerutti
On 2011-09-30, DevPlayer wrote: > I still assert that contradiction is caused by narrow perspective. > > By that I mean: just because an objects scope may not see a certain > condition, doesn't mean that condition is non-existant. > > I also propose that just because something seems to contradict

Re: Installing Python 2.6.7 on Windows

2011-09-30 Thread Blockheads Oi Oi
On Sep 29, 2:59 am, rantingrick wrote: > On Sep 27, 11:25 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > > The Python development team is relatively small and chronically busy: too > > much to do and not enough time to do it. > > If that is the case then why do they snub their no

Re: Benefit and belief

2011-09-30 Thread DevPlayer
I still assert that contradiction is caused by narrow perspective. By that I mean: just because an objects scope may not see a certain condition, doesn't mean that condition is non-existant. I also propose that just because something seems to contradict doesn't mean it is false. Take for instance

Re: Suggested coding style

2011-09-30 Thread Chris Angelico
On Fri, Sep 30, 2011 at 11:54 PM, rantingrick wrote: > Well "alex", like yourself, i hold expertise in many fields BESIDES > programming. One of which being psychology. > I *knew* it! We're all part of a huge experiment to see how much the human psyche can withstand. If we succeed on the Rick tes

Re: Suggested coding style

2011-09-30 Thread rantingrick
Note: I am quoting "Passiday" to get this thread back on subject however my reply is for "alex23" the philosopher" On Sep 29, 9:50 pm, alex23 wrote: > On Sep 29, 10:23 pm, rantingrick wrote: > > > What is so bad about breaking code in obscure places? > > Try coding in PHP across minor release ve

Re: Suggested coding style

2011-09-30 Thread rantingrick
On Sep 29, 11:49 pm, Ian Kelly wrote: > Nope, that doesn't work. > > >>> "{0:0>10}".format("-1234") > > '0-1234' > > The whole point of zfill is that it handles signs correctly. py> "{0:-010d}".format(-1234) '-01234' My point was: Use the {char}{repeat}d format for integers and the {char

Re: Benefit and belief

2011-09-30 Thread DevPlayer
from attitude import humour Funny. url link to gif. Funny. Youtube video. Funny. True Pythonees do not speak in English they speak in Python. Shame, this discussion will be sent to the Pearly gates or the Flaming Iron Bars in 5 days. Well, not so much a shame. -- http://mail.python.org/mailman

Re: Motion Tracking with Python

2011-09-30 Thread Ricardo Mansilla
On Thursday 29 September 2011 21:16:52 you wrote: > Hello, > I have a neat Python project I'd like to share. It does real-time motion > tracking, using the Python bindings to the OpenCV library: > > http://derek.simkowiak.net/motion-tracking-with-python/ > > There is a YouTube video showing the s

Re: Benefit and belief

2011-09-30 Thread rantingrick
On Sep 29, 10:05 pm, alex23 wrote: > On Sep 30, 9:37 am, MRAB wrote: > > alex23: > > """And like the Bible, the Zen was created by humans as a joke. If you're > > taking it too seriously, that's your problem.""" > > Strangely, calling the bible self-contradictory wasn't seen as > inflammatory...

Re: regexp compilation error

2011-09-30 Thread Vlastimil Brom
2011/9/30 Ovidiu Deac : > This is only part of a regex taken from an old perl application which > we are trying to understand/port to our new Python implementation. > > The original regex was considerably more complex and it didn't compile > in python so I removed all the parts I could in order to

Re: [OT] Benefit and belief

2011-09-30 Thread Devin Jeanpierre
> If you are more upset at my describing the Catholic Church as protecting > child molesters than you are at the Church for actually protecting child > molesters I'm not, and your rhetoric is ridiculous. Devin On Thu, Sep 29, 2011 at 11:10 PM, Steven D'Aprano wrote: > Devin Jeanpierre wrote: >

parse xml

2011-09-30 Thread 守株待兔
please click the http://www.secinfo.com/d14qfp.q9j.htm then ,click the following: 44: XML IDEA: Condensed Consolidating Statements of Income XML 5.11M (Details)--R158 there is the citigroup's annual financial report --statements of income,xml file. how can i get a table of statemen

Re: Benefit and belief

2011-09-30 Thread Neil Cerutti
On 2011-09-30, Chris Angelico wrote: > On Fri, Sep 30, 2011 at 5:24 PM, rusi wrote: >> "You are right," said Nasrudin after carefully hearing one side. >> "You are right," he said after carefully hearing the other side. >> "But both cannot be right!" said the court clerk bewildered. >> After prof

Re: regexp compilation error

2011-09-30 Thread Hans Mulder
On 30/09/11 11:10:48, Ovidiu Deac wrote: I have the following regexp which fails to compile. Can somebody explain why? re.compile(r"""^(?: [^y]* )*""", re.X) [...] sre_constants.error: nothing to repeat Is this a bug or a feature? A feature: the message explains why this pattern is not all

Re: regexp compilation error

2011-09-30 Thread Steven D'Aprano
Ovidiu Deac wrote: re.compile(r"""^(?: [^y]* )*""", re.X) > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.6/re.py", line 190, in compile > return _compile(pattern, flags) > File "/usr/lib/python2.6/re.py", line 245, in _compile > raise error,

Re: regexp compilation error

2011-09-30 Thread Ovidiu Deac
This is only part of a regex taken from an old perl application which we are trying to understand/port to our new Python implementation. The original regex was considerably more complex and it didn't compile in python so I removed all the parts I could in order to isolate the problem such that I c

回复: how to run in xp?

2011-09-30 Thread 守株待兔
the command : 2to3-3.2 getcode3.py -w can run in linux it can't run in window xp,can i make it in window xp? -- 原始邮件 -- 发件人: "1248283536"<1248283...@qq.com>; 发送时间: 2011年9月28日(星期三) 晚上7:50 收件人: "Peter Otten"<__pete...@web.de>; "python-list"; 主题: Re: how to run in

Re: regexp compilation error

2011-09-30 Thread Chris Angelico
On Fri, Sep 30, 2011 at 7:26 PM, Ovidiu Deac wrote: > $ python --version > Python 2.6.6 Ah, I think I was misinterpreting the traceback. You do actually have a useful message there; it's the same error that my Py3.2 produced: sre_constants.error: nothing to repeat I'm not sure what your regex i

Re: regexp compilation error

2011-09-30 Thread Ovidiu Deac
$ python --version Python 2.6.6 On Fri, Sep 30, 2011 at 12:18 PM, Chris Angelico wrote: > On Fri, Sep 30, 2011 at 7:10 PM, Ovidiu Deac wrote: >> I have the following regexp which fails to compile. Can somebody explain why? >> > re.compile(r"""^(?: [^y]* )*""", re.X) >> Traceback (most recen

Re: regexp compilation error

2011-09-30 Thread Chris Angelico
On Fri, Sep 30, 2011 at 7:10 PM, Ovidiu Deac wrote: > I have the following regexp which fails to compile. Can somebody explain why? > re.compile(r"""^(?: [^y]* )*""", re.X) > Traceback (most recent call last): >  File "", line 1, in >  File "/usr/lib/python2.6/re.py", line 190, in compile >

Re: Counting the number of call of a function

2011-09-30 Thread Laurent Claessens
The keys of globals() are the _names_. You're giving it the function itself. Ow, ok. I didn't caught it. I understand now. > A decorator would be better. Yes. I keep the solution with foo=Wraper(foo) Thanks a lot all ! Laurent -- http://mail.python.org/mailman/listinfo/python-list

regexp compilation error

2011-09-30 Thread Ovidiu Deac
I have the following regexp which fails to compile. Can somebody explain why? >>> re.compile(r"""^(?: [^y]* )*""", re.X) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/re.py", line 190, in compile return _compile(pattern, flags) File "/usr/lib/python2.6/

Re: Motion Tracking with Python

2011-09-30 Thread Chris Angelico
On Fri, Sep 30, 2011 at 4:39 PM, alex23 wrote: >> or writing a MS Word virus in Python... > > Now that's just crazy talk. > ... and I thought all three were. You know what they say - truth is stranger than fiction, because fiction has to make sense! Although the device driver example you cite is

Re: Benefit and belief

2011-09-30 Thread Chris Angelico
On Fri, Sep 30, 2011 at 5:24 PM, rusi wrote: > "You are right," said Nasrudin after carefully hearing one side. > "You are right," he said after carefully hearing the other side. > "But both cannot be right!" said the court clerk bewildered. > After profound thought said the Mulla: > >  "You are r

Re: Benefit and belief

2011-09-30 Thread rusi
On Sep 30, 4:03 am, Devin Jeanpierre wrote: > > But anyway, no, we don't agree on what it means to be friendly or what > a hostile atmosphere is. I've noticed that people tend to be a lot > harsher here than what I'm used to, so perhaps your attitude to it is > more common on mailing-lists and I s