RE: Lazy Attribute

2012-11-15 Thread Andriy Kornatskyy
Ian, Thank you for mentioning about this research, really appreciate that. Thanks. Andriy Kornatskyy > From: ian.g.ke...@gmail.com > Date: Thu, 15 Nov 2012 15:46:19 -0700 > Subject: Re: Lazy Attribute > To: python-list@python.org > > On Thu, Nov 15, 20

RE: Lazy Attribute

2012-11-15 Thread Andriy Kornatskyy
Ian, Thank you for the comments. > The name "attribute" is not very descriptive. Why not "lazy_attribute" > instead? It just shorter and still descriptive. > If accessing the descriptor on the class object has no special > meaning, then the custom is to return the descriptor object itself, as

Understanding '?' in regular expressions

2012-11-15 Thread krishna . k . kishor3
Can someone explain the below behavior please? >>> re1 = re.compile(r'(?:((?:1000|1010|1020))[ ]*?[\,]?[ ]*?){1,3}') >>> re.findall(re_obj,'1000,1020,1000') ['1000'] >>> re.findall(re_obj,'1000,1020, 1000') ['1020', '1000'] However when I use "[\,]??" instead of "[\,]?" as below, I see a differen

Re: Simple Question regarding running .py program

2012-11-15 Thread Chris Angelico
On Fri, Nov 16, 2012 at 5:37 PM, Chris Angelico wrote: > Spam filtering is nothing unique. > (Don't get me wrong though, that doesn't stop it from being a good thing. It's just not a reason to use GG above all else.) ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Question regarding running .py program

2012-11-15 Thread Chris Angelico
On Fri, Nov 16, 2012 at 3:10 PM, rusi wrote: > One small addition: GG allows spam posts to be marked as spam. > > This feature costs a few seconds and can help everyone (if a few more > GG users would use it) And Gmail lets you do the exact same thing, but I almost never need to do it, because th

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-15 Thread Ethan Furman
Emile van Sebille wrote: brucegoodst...@gmail.com wrote: Using a decorator works when named arguments are not used. When named arguments are used, unexpected keyword error is reported. Is there a simple fix? Extend def wrapper(*args) to handle *kwargs as well Emile Code: - from funct

Re: Simple Question regarding running .py program

2012-11-15 Thread rusi
On Nov 16, 2:29 am, ru...@yahoo.com wrote: > But of course, our genius doesn't keep any records > and the cases where he is wrong don't make as much > impression on his memory.  Further, he doesn't bother > to check the headers on the non-crap posts.  Even a > junior-high science student could see

Re: Simple Question regarding running .py program

2012-11-15 Thread Grant Edwards
On 2012-11-15, Mark Lawrence wrote: > On 15/11/2012 21:29, ru...@yahoo.com wrote: > > All I'll say is that when I read something on gmane via Thunderbird on > Windows Vista on any of the 25 Python mailing lists that I subscribe to, > I don't want to read the double spaced crap that comes from G$

Re: debugging in eclipse

2012-11-15 Thread alex23
On Nov 16, 3:05 am, Steven D'Aprano wrote: > > ``1/0`` is shorter.  ;-) > > It is also guaranteed to run, unlike assert. Only if they actively pass the command line switch to turn it off, which I'd assume someone intentionally using an assertion wouldn't do. -- http://mail.python.org/mailman/li

Re: Subprocess puzzle and two questions

2012-11-15 Thread Roy Smith
In article , Nobody wrote: > That's because the high-level routines aren't tied to DNS. This is true. >> gethostbyname() and getaddrinfo() use the NSS (name-service switch) > mechanism, which is configured via /etc/nsswitch.conf. Depending upon > configuration, hostnames can be looked up via a

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-15 Thread Emile van Sebille
brucegoodst...@gmail.com wrote: Using a decorator works when named arguments are not used. When named arguments are used, unexpected keyword error is reported. Is there a simple fix? Extend def wrapper(*args) to handle *kwargs as well Emile Code: - from functools import wraps def fix

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-15 Thread brucegoodstein
On Saturday, November 10, 2012 10:35:12 AM UTC-5, Aahz wrote: > In article , > > Peter Otten <__pete...@web.de> wrote: > > >Miki Tebeka wrote: > > > > > >>> Is there a simpler way to modify all arguments in a function before using > > >>> the arguments? > > >> > > >> You can use a decorator

Re: Subprocess puzzle and two questions

2012-11-15 Thread Nobody
On Wed, 14 Nov 2012 20:49:19 -0500, Roy Smith wrote: >> I'm slightly surprised that there's no way with the Python stdlib to >> point a DNS query at a specific server > > Me too, including the "only slightly" part. The normal high-level C > resolver routines (getaddrinfo/getnameinfo, or even t

Re: Lazy Attribute

2012-11-15 Thread Ian Kelly
On Thu, Nov 15, 2012 at 12:33 PM, Andriy Kornatskyy wrote: > > A lazy attribute is an attribute that is calculated on demand and only once. > > The post below shows how you can use lazy attribute in your Python class: > > http://mindref.blogspot.com/2012/11/python-lazy-attribute.html > > Comments

Re: Lazy Attribute

2012-11-15 Thread Ian Kelly
On Thu, Nov 15, 2012 at 12:33 PM, Andriy Kornatskyy wrote: > > A lazy attribute is an attribute that is calculated on demand and only once. > > The post below shows how you can use lazy attribute in your Python class: > > http://mindref.blogspot.com/2012/11/python-lazy-attribute.html > > Comments

Re: Simple Question regarding running .py program

2012-11-15 Thread Mark Lawrence
On 15/11/2012 21:29, ru...@yahoo.com wrote: All I'll say is that when I read something on gmane via Thunderbird on Windows Vista on any of the 25 Python mailing lists that I subscribe to, I don't want to read the double spaced crap that comes from G$. I hence perceive a problem. 1) G$ are to

Re: error importing smtplib

2012-11-15 Thread Terry Reedy
On 11/15/2012 1:48 PM, Eric Frederich wrote: Thanks for the idea. sys.path was the same before and after the login Too bad. That seems to be a typical cause of import failure. What else should I be checking? No idea. You are working beyond my knowledge. But I might either look at the foo-l

Re: Simple Question regarding running .py program

2012-11-15 Thread rurpy
On 11/14/2012 04:07 PM, Steven D'Aprano wrote: > On Wed, 14 Nov 2012 10:20:13 -0800, rurpy wrote: I'll skip the issues already addressed by Joshua Landau. >[...] > I don't understand why you suggest counting setup time for the > alternatives to Google Groups, but *don't* consider setup time for

Re: Python questions help

2012-11-15 Thread Joshua Landau
On 15 November 2012 01:47, su29090 <129k...@gmail.com> wrote: > I brought a python book and i'm a beginner and I read and tried to do the > questions and I still get it wrong. > > How to create a program that reads an uspecified number of integers, that > determines how many positive and negative

Re: Dictionary of Functions

2012-11-15 Thread Joshua Landau
On 15 November 2012 17:13, Chris Kaynor wrote: > On Thu, Nov 15, 2012 at 8:04 AM, Kevin Gullikson > wrote: > > Hi all, > > > > I am trying to make a dictionary of functions, where each entry in the > > dictionary is the same function with a few of the parameters set to > specific > > parameters.

Lazy Attribute

2012-11-15 Thread Andriy Kornatskyy
A lazy attribute is an attribute that is calculated on demand and only once. The post below shows how you can use lazy attribute in your Python class: http://mindref.blogspot.com/2012/11/python-lazy-attribute.html Comments or suggestions are welcome. Thanks. Andriy Kornatskyy

Re: error importing smtplib

2012-11-15 Thread Eric Frederich
Sorry, only saw your first response, didn't see the others. I compiled Python 2.7.2 myself with --enable-shared To create standalone applications that interact with this 3rd party program your main C file instead of having a "main" function has a FOO_user_main function. When you link your program

Re: error importing smtplib

2012-11-15 Thread Eric Frederich
Thanks for the idea. sys.path was the same before and after the login What else should I be checking? On Thu, Nov 15, 2012 at 11:57 AM, Terry Reedy wrote: > On 11/15/2012 9:38 AM, Eric Frederich wrote: > >> Hello, >> >> I created some bindings to a 3rd party library. >> I have found that when I

Re: Getting "empty" attachment with smtplib

2012-11-15 Thread Tobiah
I can already say that "smtplib" is not to blame. It is (mostly) unconcerned with the internal structure of the message -- and by itself will not empty attachments. On the advice of a co-worker, I tried using web2py's gluon.tools.Mail. It was easier to accomplish the attachment, and Thunderbird

Re: Dictionary of Functions

2012-11-15 Thread Chris Kaynor
On Thu, Nov 15, 2012 at 8:04 AM, Kevin Gullikson wrote: > Hi all, > > I am trying to make a dictionary of functions, where each entry in the > dictionary is the same function with a few of the parameters set to specific > parameters. My actual use is pretty complicated, but I managed to boil down

Re: debugging in eclipse

2012-11-15 Thread Steven D'Aprano
On Thu, 15 Nov 2012 07:56:17 -0800, Aahz wrote: > In article , Roy Smith > wrote: >>In article , >> Dave Angel wrote: >>> >>> I'd also add a print statement, just to assure yourself that it's >>> running. >> >>My trick to make sure something is running is to add "assert 0". > > ``1/0`` is shor

Re: error importing smtplib

2012-11-15 Thread Terry Reedy
On 11/15/2012 9:38 AM, Eric Frederich wrote: Hello, I created some bindings to a 3rd party library. I have found that when I run Python and import smtplib it works fine. If I first log into the 3rd party application using my bindings however I get a bunch of errors. What do you think this 3rd p

Re: Dictionary of Functions

2012-11-15 Thread MRAB
On 2012-11-15 16:04, Kevin Gullikson wrote: Hi all, I am trying to make a dictionary of functions, where each entry in the dictionary is the same function with a few of the parameters set to specific parameters. My actual use is pretty complicated, but I managed to boil down the issue I am havin

Re: Detect file is locked - windows

2012-11-15 Thread Aahz
In article , Tim Golden wrote: >On 14/11/2012 00:33, Ali Akhavan wrote: >> >> I am trying to open a file in 'w' mode open('file', 'wb'). open() >> will throw with IOError with errno 13 if the file is locked by >> another application or if user does not have permission to open/write >> to the file

Re: debugging in eclipse

2012-11-15 Thread Aahz
In article , Roy Smith wrote: >In article , > Dave Angel wrote: >> >> I'd also add a print statement, just to assure yourself that it's running. > >My trick to make sure something is running is to add "assert 0". ``1/0`` is shorter. ;-) -- Aahz (a...@pythoncraft.com) <*> htt

error importing smtplib

2012-11-15 Thread Eric Frederich
Hello, I created some bindings to a 3rd party library. I have found that when I run Python and import smtplib it works fine. If I first log into the 3rd party application using my bindings however I get a bunch of errors. What do you think this 3rd party login could be doing that would affect the

Re: debugging in eclipse

2012-11-15 Thread chip9munk
On Thursday, November 15, 2012 3:21:52 PM UTC+1, Alister wrote: > doing it that way means that it will only call test when executed > directly & not when imported as a module I see, thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: debugging in eclipse

2012-11-15 Thread chip9munk
On Thursday, November 15, 2012 2:43:26 PM UTC+1, Ulrich Eckhardt wrote: > Should that be "return c" instead of "c" on a line? oh it is just a silly example function, the functionality is not important. It does not have to return anything... > For a start, I would try to actually call the functio

Re: debugging in eclipse

2012-11-15 Thread Alister
On Thu, 15 Nov 2012 05:46:49 -0800, chip9munk wrote: > On Thursday, November 15, 2012 2:44:22 PM UTC+1, Martin P. Hellwig > wrote: >> I assume you have at the end of the debugTest.py file something like >> this: >> if __name__ == '__main__': >>test() > > no i did not have it... > > is main r

Re: debugging in eclipse

2012-11-15 Thread Ulrich Eckhardt
Am 15.11.2012 13:29, schrieb chip9m...@gmail.com: I have a python module, lets call it debugTest.py. and it contains: def test(): a=1 b=2 c=a+b c so as simple as possible. Should that be "return c" instead of "c" on a line? Now I would like to debug it in eclipse.. (I h

Re: debugging in eclipse

2012-11-15 Thread Roy Smith
In article , Dave Angel wrote: > I'd also add a print statement, just to assure yourself that it's running. My trick to make sure something is running is to add "assert 0". To be fair, I usually start by adding a print statement, as Dave suggests. If I see the output, I know it ran. But if

Re: debugging in eclipse

2012-11-15 Thread chip9munk
On Thursday, November 15, 2012 2:44:22 PM UTC+1, Martin P. Hellwig wrote: > I assume you have at the end of the debugTest.py file something like this: > if __name__ == '__main__': >test() no i did not have it... is main really necessary? -- http://mail.python.org/mailman/listinfo/python-li

Re: debugging in eclipse

2012-11-15 Thread chip9munk
On Thursday, November 15, 2012 2:42:09 PM UTC+1, Dave Angel wrote: > Add a call to test() to the end of the file, and it might do better. > > I'd also add a print statement, just to assure yourself that it's running. > > thanks, that is it, (stupid me) now if I have many functions in the model

Re: debugging in eclipse

2012-11-15 Thread chip9munk
On Thursday, November 15, 2012 1:49:22 PM UTC+1, Roy Smith wrote: > Heh. It took me a while to realize that the subject line was not > referring to > http://en.wikipedia.org/wiki/Solar_eclipse_of_November_13,_2012 :)) -- http://mail.python.org/mailman/listinfo/python-list

Re: debugging in eclipse

2012-11-15 Thread Martin P. Hellwig
On Thursday, 15 November 2012 12:29:04 UTC, chip...@gmail.com wrote: > Hi all! > > > > I have a stupid problem, for which I cannot find a solution... > > > > I have a python module, lets call it debugTest.py. > > > > and it contains: > > def test(): > > a=1 > > b=2 > > c=a

Re: debugging in eclipse

2012-11-15 Thread Dave Angel
On 11/15/2012 07:29 AM, chip9m...@gmail.com wrote: > Hi all! > > I have a stupid problem, for which I cannot find a solution... > > I have a python module, lets call it debugTest.py. > > and it contains: > def test(): > a=1 > b=2 > c=a+b > c > > so as simple as possible. > > Now I w

Re: debugging in eclipse

2012-11-15 Thread Roy Smith
In article , chip9m...@gmail.com wrote: > Now I would like to debug it in eclipse.. Heh. It took me a while to realize that the subject line was not referring to http://en.wikipedia.org/wiki/Solar_eclipse_of_November_13,_2012 -- http://mail.python.org/mailman/listinfo/python-list

debugging in eclipse

2012-11-15 Thread chip9munk
Hi all! I have a stupid problem, for which I cannot find a solution... I have a python module, lets call it debugTest.py. and it contains: def test(): a=1 b=2 c=a+b c so as simple as possible. Now I would like to debug it in eclipse.. (I have pydev and all) so the question is h

Re: Python garbage collector/memory manager behaving strangely

2012-11-15 Thread Thomas Rachel
Am 17.09.2012 04:28 schrieb Jadhav, Alok: Thanks Dave for clean explanation. I clearly understand what is going on now. I still need some suggestions from you on this. There are 2 reasons why I was using self.rawfile.read().split('|\n') instead of self.rawfile.readlines() - As you have seen, t

Re: Python-list Digest, Vol 110, Issue 106

2012-11-15 Thread Jean-Michel Pichavant
- Original Message - > Hi, > I have a question about Django. I easy_installed Django1.4 and > psycopg2, and python manage.py syncdb. And gave me a error; No > module named psycopg2.extensions. posgre9.1 is installed. > It works fine on my MAC but not my Windows. Does anyone know about > t

Re: Printing a text over an image

2012-11-15 Thread Marco Nawijn
On Wednesday, November 7, 2012 5:52:36 PM UTC+1, Martha Morrigan wrote: > Hi guys, > > > > Using python, wxpython and sqlite in a windows system, Im trying to > > print some certificates/diplomas/cards with a image at background with > > the name of person/text over it. > > > > I know the b