mohammedimran

2011-08-29 Thread mohammed imran
http://123maza.com/65/fun564/ -- http://mail.python.org/mailman/listinfo/python-list

Re: killing a script

2011-08-29 Thread Thomas Jollans
On 2011-08-29 05:08, Russ P. wrote: Yes, but if I am not mistaken, that will require me to put a line or two after each os.system call. That's almost like whack-a-mole at the code level rather than the Control-C level. OK, not a huge deal for one script, but I was hoping for something simpler.

Re: Unpickle error -- "object has no attribute ...."

2011-08-29 Thread Peter Otten
luvspython wrote: > I have an application that needs to keep a history of the values of > several attributes of each of many instances of many classes. The > history-keeping logic is in a helper class, HistoryKeeper, that's > inherited by classes like Vehicle in the example below. > > Pickling a

Calling Script from Command line not working

2011-08-29 Thread Sathish S
Hi Ppl, We created a DLL using cygwin and have written a class based python module for the same. We have created a sample script for the class based python module, that creates an object of the class and calls various methods in the class. This Test script works fine while I run it from IDLE. Howe

Get reference to parent class from subclass?

2011-08-29 Thread John O'Hagan
class P(): pass class C(P): pass Can I get P from C? IOW, can I get a reference to the object P from the object C? This should be obvious one way or the other, but I haven't been able to find the answer. Regards, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Get reference to parent class from subclass?

2011-08-29 Thread johnohagan
On Sun, 28 Aug 2011 14:00:24 +1000 John O'Hagan wrote: > class P(): > pass > > class C(P): > pass > > Can I get P from C? > Never mind, it's __bases__ (not found in dir(C)) > > Regards, > > John -- http://mail.python.org/mailman/listinfo/python-list

Re: Interact with SQL Database using Python 2.4 or lower

2011-08-29 Thread python
> Personally, I'm a major fan of Webfaction -- from price to plans to what's > supported to actual effectiveness of their tech support. +1 Malcolm -- http://mail.python.org/mailman/listinfo/python-list

A tale of yak shaving

2011-08-29 Thread Steven D'Aprano
This is not exactly fresh (it was written back in March), but it's the first time I saw it and I thought I'd share. Barry Warsaw, one of the lead Python developers, describes one of his most ... interesting ... debugging experiences. http://www.wefearchange.org/2011/03/charming-snakes-and-shaving-

Returning a value from exec or a better solution

2011-08-29 Thread Jack Trades
I'm writing a Scheme interpreter and I need to be able to create and return a Python function from a string. This is a port of another Scheme interpreter I wrote in Scheme. What I'm trying to do looked like this: (define (scheme-syntax expr) (hash-table-set! global-syntax (car expr) (eval (cad

Re: is there any principle when writing python function

2011-08-29 Thread Neil Cerutti
On 2011-08-26, Chris Angelico wrote: > On Sat, Aug 27, 2011 at 1:48 AM, Tobiah > wrote: >> While I understand and agree with that basic tenet, I think >> that the capitalized 'ONLY' is too strong. ?I do split out >> code into function for readability, even when the function >> will only be called

Re: Checking Signature of Function Parameter

2011-08-29 Thread Dan Stromberg
On Sun, Aug 28, 2011 at 2:20 PM, Travis Parks wrote: > There are some things I want to make sure of. 1) I want to make sure > that source is iterable. 2) More importantly, I want to make sure that > predicate is callable, accepting a thing, returning a bool. > You can check a lot of this stuff ve

Re: Some problems refer to install 3rd party package of Python on mac OS 10.6.8

2011-08-29 Thread Gee Chen
On Aug 29, 9:14 am, Chris Rebert wrote: > On Sun, Aug 28, 2011 at 5:35 PM, Gee Chen wrote: > > -- > > the Python environment on my mac is: > > > Python 2.6.4 (r264:75706, Aug 28 2011, 22:29:24) > > [GCC 4.2.1 (Apple Inc. build 5664)] on darwin > > For future refere

Re: Unpickle error -- "object has no attribute ...."

2011-08-29 Thread luvspython
On Aug 29, 5:02 am, Peter Otten <__pete...@web.de> wrote: > luvspython wrote: > > I have an application that needs to keep a history of the values of > > several attributes of each of many instances of many classes.  The > > history-keeping logic is in a helper class, HistoryKeeper, that's > > inhe

Re: Checking Signature of Function Parameter

2011-08-29 Thread Travis Parks
On Aug 29, 2:30 am, Nobody wrote: > On Sun, 28 Aug 2011 14:20:11 -0700, Travis Parks wrote: > > More importantly, I want to make sure that > > predicate is callable, accepting a thing, returning a bool. > > The "callable" part is do-able, the rest isn't. > > The predicate may accept an arbitrary s

Re: Returning a value from exec or a better solution

2011-08-29 Thread Rob Williscroft
Jack Trades wrote in news:CAG5udOg=GtFGPmTB=1ojnvnrpdyucxdokn1wjqmomv9gx0+...@mail.gmail.com in gmane.comp.python.general: > ... I wanted to allow the user to manually return the > function from the string, like this: > > a = exec(""" > def double(x): > return x * 2 > double > """) > > Howeve

Re: Checking Signature of Function Parameter

2011-08-29 Thread Ian Kelly
On Mon, Aug 29, 2011 at 10:45 AM, Travis Parks wrote: > I wanted to allow for calls like this: > > extend(range(0, 1000)).map(lambda x: x * x).where(lambda x: x % 2 == > 0).first(lambda x: x % 7 == 0) > > It allows me to compose method calls similarly to LINQ in C#. I think > this looks better tha

Re: Button Label change on EVT_BUTTON in wxpython!!!

2011-08-29 Thread Rob Williscroft
Ven wrote in news:aa1212bb-35e5-4bf9-b8ad-7a3c083749c2 @x2g2000yql.googlegroups.com in gmane.comp.python.general: > So, here is what I did/want: > > self.run_button=wx.Button(self.panel,ID_RUN_BUTTON,label='Install') > self.Bind(wx.EVT_BUTTON, self.OnRun,id=ID_RUN_BUTTON) > > def OnRun(self,evt)

Help me understand this logging config

2011-08-29 Thread Roy Smith
I'm using django 1.3 and python 2.6. My logging config is: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '%(asctime)s: %(name)s %(levelname)s % (funcName)s %(message)s' } }, 'handlers':

Re: Checking Signature of Function Parameter

2011-08-29 Thread Travis Parks
On Aug 29, 1:42 pm, Ian Kelly wrote: > On Mon, Aug 29, 2011 at 10:45 AM, Travis Parks wrote: > > I wanted to allow for calls like this: > > > extend(range(0, 1000)).map(lambda x: x * x).where(lambda x: x % 2 == > > 0).first(lambda x: x % 7 == 0) > > > It allows me to compose method calls similarl

Re: is there any principle when writing python function

2011-08-29 Thread Chris Angelico
On Tue, Aug 30, 2011 at 12:52 AM, Neil Cerutti wrote: >> I would split the function only when both halves (caller and >> callee) can be given short and useful names - if you can't >> explain what a block of code does in a few words, it's probably >> a poor choice for splitting out into a function.

Help parsing a text file

2011-08-29 Thread William Gill
I haven't done much with Python for a couple years, bouncing around between other languages and scripts as needs suggest, so I have some minor difficulty keeping Python functionality Python functionality in my head, but I can overcome that as the cobwebs clear. Though I do seem to keep trippin

Re: Unpickle error -- "object has no attribute ...."

2011-08-29 Thread Chris Angelico
On Tue, Aug 30, 2011 at 2:22 AM, luvspython wrote: > I can figure out most things, though perhaps very slowly and > painfully, if I can trace through code.  I use WingIDE (love it), but > the execution > of the C code is of course hidden, which helped stymie on this > problem.  Is there another to

Re: Help parsing a text file

2011-08-29 Thread Philip Semanchuk
On Aug 29, 2011, at 2:21 PM, William Gill wrote: > I haven't done much with Python for a couple years, bouncing around between > other languages and scripts as needs suggest, so I have some minor difficulty > keeping Python functionality Python functionality in my head, but I can > overcome th

Re: is there any principle when writing python function

2011-08-29 Thread Neil Cerutti
On 2011-08-29, Chris Angelico wrote: >> In my house, I'm dad. In my chorus, I'm Neil. In town I'm Neil >> Cerutti, and in the global scope I have to use a meaningless >> unique identifier. Hopefully no Python namespace ever gets that >> big. > > Chorus? Does that imply that you sing? Neat :) Wait

Re: Help parsing a text file

2011-08-29 Thread William Gill
On 8/29/2011 2:31 PM, Philip Semanchuk wrote: If the syntax really is close to XML, would it be all that difficult to convert it to proper XML? Then you have nice libraries like ElementTree to use for parsing. Possibly, but I would still need the same search algorithms to find the opening

Re: is there any principle when writing python function

2011-08-29 Thread Chris Angelico
On Tue, Aug 30, 2011 at 4:40 AM, Neil Cerutti wrote: > Wait... not all Python programmers sing? I do, and there seems to be more than coincidental overlap between musos and coders. > The problem with that scenario is that, in real life, there's > more than one Cerutti.Neil, and they like to move

Instituições que utilizam Python.

2011-08-29 Thread Bruno Andrade
Olá, boa tarde! Eu, estou entrando em contato com vocês, pois eu gostaria de saber quais instituições brasileiras usam regularmente Python para o desenvolvimento de suas atividades. Essas instituições podem ser usuários de sistemas desenvolvidos usando a linguagem Python, ou podem ser institu

Re: killing a script

2011-08-29 Thread Jason Swails
On Sun, Aug 28, 2011 at 10:41 PM, Russ P. wrote: > > > You could look at the return value of os.system, which may tell you the > > exit status of the process. > > Thanks for the suggestion. Yeah, I guess I could do that, but it seems > that there should be a simpler way to just kill the "whole en

Re: Help parsing a text file

2011-08-29 Thread Thomas Jollans
On 29/08/11 20:21, William Gill wrote: > I haven't done much with Python for a couple years, bouncing around > between other languages and scripts as needs suggest, so I have some > minor difficulty keeping Python functionality Python functionality in my > head, but I can overcome that as the cobwe

Re: killing a script

2011-08-29 Thread Russ P.
On Aug 28, 8:16 pm, Chris Rebert wrote: > On Sun, Aug 28, 2011 at 8:08 PM, Russ P. wrote: > > On Aug 28, 7:51 pm, Chris Angelico wrote: > >> On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: > >> > On Aug 28, 6:52 pm, MRAB wrote: > >> >> You could look at the return value of os.system, which ma

Re: Returning a value from exec or a better solution

2011-08-29 Thread Jack Trades
On Mon, Aug 29, 2011 at 12:30 PM, Rob Williscroft wrote: > Jack Trades wrote in > > ... I wanted to allow the user to manually return the > > function from the string, like this: > > > > a = exec(""" > > def double(x): > > return x * 2 > > double > > """) > > > > However it seems that exec does

For some value of “sing” (was: is there any principle when writing python function)

2011-08-29 Thread Ben Finney
Neil Cerutti writes: > On 2011-08-29, Chris Angelico wrote: > > Chorus? Does that imply that you sing? Neat :) > > Wait... not all Python programmers sing? All Python programmers sing. Some of them should not. -- \ “To be is to do” —Plato | `\

Re: Instituições que utilizam Python.

2011-08-29 Thread Tim Delaney
2011/8/30 Bruno Andrade > Olá, boa tarde! > > Eu, estou entrando em contato com vocês, pois eu gostaria de saber quais > instituições brasileiras usam regularmente Python para o desenvolvimento de > suas atividades. Essas instituições podem ser usuários de sistemas > desenvolvidos usando a lingu

Re: Returning a value from exec or a better solution

2011-08-29 Thread Arnaud Delobelle
On 29 August 2011 23:14, Jack Trades wrote: > On Mon, Aug 29, 2011 at 12:30 PM, Rob Williscroft wrote: >> >> Jack Trades wrote in >> > ... I wanted to allow the user to manually return the >> > function from the string, like this: >> > >> > a = exec(""" >> > def double(x): >> >   return x * 2 >>

Re: killing a script

2011-08-29 Thread Arnaud Delobelle
On 29 August 2011 04:08, Russ P. wrote: > On Aug 28, 7:51 pm, Chris Angelico wrote: >> On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: >> > On Aug 28, 6:52 pm, MRAB wrote: >> >> You could look at the return value of os.system, which may tell you the >> >> exit status of the process. >> >> > Th

Re: Checking Signature of Function Parameter

2011-08-29 Thread Ethan Furman
Travis Parks wrote: I wrote a post a few days ago about how I know the syntax and libraries fairly well, but I don't have the "philosophy". I haven't seen a lot of tricks and I am never sure what is the "norm" in Python. I am sure if an experienced Python programmer looked at my code, they'd imme

Re: Returning a value from exec or a better solution

2011-08-29 Thread Jack Trades
On Mon, Aug 29, 2011 at 5:50 PM, Arnaud Delobelle wrote: > > Hi Jack, > > Here is a possible solution for your problem (Python 3): > > > >>> class CapturingDict(dict): > ... def __setitem__(self, key, val): > ... self.key, self.val = key, val > ... dict.__setitem__(self, key,

Re: A tale of yak shaving

2011-08-29 Thread Seebs
On 2011-08-29, Steven D'Aprano wrote: > This is not exactly fresh (it was written back in March), but it's the first > time I saw it and I thought I'd share. Barry Warsaw, one of the lead Python > developers, describes one of his most ... interesting ... debugging > experiences. That is a truly e

Re: killing a script

2011-08-29 Thread Steven D'Aprano
On Tue, 30 Aug 2011 08:53 am Arnaud Delobelle wrote: [...] >> Yes, but if I am not mistaken, that will require me to put a line or >> two after each os.system call. That's almost like whack-a-mole at the >> code level rather than the Control-C level. OK, not a huge deal for >> one script, but I wa