Re: Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Thomas 'PointedEars' Lahn
Andrew Berg wrote: > […] As for your question in the Subject, I do not know since I am reading the newsgroup. Therefore, however, I can tell you that the mailing list to Usenet gateway is seriously borked, as missing References header fields are not generated by the gateway. As a result, the

Re: Using decorators with argument in Python

2011-06-29 Thread Ethan Furman
Ian Kelly wrote: @enclose def test5(string, func): print(func(string)) test5('broken', func=str.upper) Yes, that is a limitation -- one loses the func keyword for the decorated function. If I were to actually use this, I'd probably go with '_func' as the keyword. ~Ethan~ PS Thanks f

Re: get() attribute for Entry in Tkinter

2011-06-29 Thread Peter Otten
Robert Upton wrote: > I am in the process of generating a simple GUI that wants to read a > string and print it to the terminal after engaging a button. I am > running into a problem where Python says it does not understand the > get() attribute for Entry. Please don't paraphrase Python's erro

Re: Using decorators with argument in Python

2011-06-29 Thread Ian Kelly
On Wed, Jun 29, 2011 at 3:29 PM, Ethan Furman wrote: > 8< > class enclose(object): >    func = None >    def __init__(self, char='#'): >        self.char = char >        if callable(char):  # was a function passed in directly? >      

Re: Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Patty
- Original Message - From: "Andrew Berg" To: "comp.lang.python" Sent: Wednesday, June 29, 2011 1:34 PM Subject: Is the Usenet to mailing list gateway borked? I didn't get at least two messages from the "call a function every 10 seconds thread", and possibly some other messages, and

Re: Using decorators with argument in Python

2011-06-29 Thread Ethan Furman
Ian Kelly wrote: On Wed, Jun 29, 2011 at 1:30 PM, Ethan Furman wrote: How about just having one bit of code that works either way? How would you adapt that code if you wanted to be able to decorate a function that takes arguments? 8<--

Re: Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Andrew Berg
I forgot to mention I don't have Usenet access, and Google Groups' archives don't have messages from the last couple of days, so I can't check the Usenet side. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Andrew Berg
On 2011.06.29 03:53 PM, Noah Hall wrote: > I think the more likely answer is that it was sent without being also > sent to python-list. Possible, but they were two messages from two different people and happened within a few hours of each other, so it could be that the two messages didn't go throug

Re: Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Noah Hall
On Wed, Jun 29, 2011 at 9:34 PM, Andrew Berg wrote: > I didn't get at least two messages from the "call a function every 10 > seconds thread", and possibly some other messages, and I access the > group via the mailing list. I use the latest stable Thunderbird, if that > matters. I've only noticed

Re: Safely modify a file in place -- am I doing it right?

2011-06-29 Thread Chris Torek
In article <4e0b6383$0$29996$c3e8da3$54964...@news.astraweb.com> wrote: >I have a script running under Python 2.5 that needs to modify files in >place. I want to do this with some level of assurance that I won't lose >data. ... I have come up with this approach: [create temp file in suitable dir

Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Andrew Berg
I didn't get at least two messages from the "call a function every 10 seconds thread", and possibly some other messages, and I access the group via the mailing list. I use the latest stable Thunderbird, if that matters. I've only noticed this recently, and I'm still getting other messages. In fact,

google docs / apps API

2011-06-29 Thread milosh zorica
am new to the list and kinda new to python too would like to meet fellow developers who work on google docs API and app engine am developing an app for that will add extra security layer to google docs -- http://mail.python.org/mailman/listinfo/python-list

Re: Using decorators with argument in Python

2011-06-29 Thread Ian Kelly
On Wed, Jun 29, 2011 at 1:30 PM, Ethan Furman wrote: > How about just having one bit of code that works either way? How would you adapt that code if you wanted to be able to decorate a function that takes arguments? This also won't work if the argument to the decorator is itself a callable, such

get() attribute for Entry in Tkinter

2011-06-29 Thread Robert Upton
Dear Pythoners, I am in the process of generating a simple GUI that wants to read a string and print it to the terminal after engaging a button. I am running into a problem where Python says it does not understand the get() attribute for Entry. My code is very simple and is shown below. Please

Re: Using decorators with argument in Python

2011-06-29 Thread Ethan Furman
John Posner wrote: Investigating how this fact fit in with the current thread, I came up with an alternative to the three levels of "def" (pronounced "three levels of death"). Following is code for two decorators: * the first one encloses the output of a function with lines of "#" characters, an

Re: Safely modify a file in place -- am I doing it right?

2011-06-29 Thread Grant Edwards
On 2011-06-29, steve+comp.lang.pyt...@pearwood.info wrote: > I have a script running under Python 2.5 that needs to modify files in > place. I want to do this with some level of assurance that I won't lose > data. E.g. this is not safe: > > def unsafe_modify(filename): > fp = open(filename, '

Re: Automatic placement of a text box? ie empty legend [matplotlib]

2011-06-29 Thread Cousin Stanley
Christopher Barrington-Leigh wrote: > I'd like to have the Sample A box place itself > in the optimal empty space, so as not to overlay > any graphing elements (if possible): > A simple alternative might be to place the label just outside of the plot region either at the top or the

Re: how to call a function for evry 10 secs

2011-06-29 Thread Max Countryman
Yeah it won't work. Recursion depth will be reached. Steven's suggestion is much better. -- Max Countryman +1-917-971-8472 On Wednesday, June 29, 2011 at 2:05 PM, santosh h s wrote: > how to end ths over a period of time > > On Wed, Jun 29, 2011 at 11:25 PM, Max Countryman (mailto:m...@me.c

Re: Using decorators with argument in Python

2011-06-29 Thread John Posner
On 2:59 PM, Lie Ryan wrote: >> Can any of you guys explain me advantages and disadvantages of >> using each of them > Simplicity is one, using @decor() means you have at least three-level > nested functions, which means the code is likely to be very huge and > perhaps unnecessarily. Bruce Eckel po

Re: how to call a function for evry 10 secs

2011-06-29 Thread Steven D'Aprano
hisan wrote: > Hi All, > I need to call a function for evry 10 secs > how can i achieve this in python import time while True: time.sleep(10) function() -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Safely modify a file in place -- am I doing it right?

2011-06-29 Thread steve+comp . lang . python
I have a script running under Python 2.5 that needs to modify files in place. I want to do this with some level of assurance that I won't lose data. E.g. this is not safe: def unsafe_modify(filename): fp = open(filename, 'r') data = modify(fp.read()) fp.close() fp = open(filename,

how to call a function for evry 10 secs

2011-06-29 Thread hisan
Hi All, I need to call a function for evry 10 secs how can i achieve this in python -- http://mail.python.org/mailman/listinfo/python-list

Re: using an instance of Object as an empty class

2011-06-29 Thread steve+comp . lang . python
Ulrich Eckhardt wrote: > Peter Otten wrote: >> Examples for classes that don't accept attributes are builtins >> like int, tuple, and -- obviously -- dict. You can make your own >> using the __slot__ mechanism: >> > class A(object): >> ... __slots__ = ["x", "y"] >> ... > a = A() >

Re: using an instance of Object as an empty class

2011-06-29 Thread Peter Otten
Ulrich Eckhardt wrote: > Peter Otten wrote: >> Examples for classes that don't accept attributes are builtins >> like int, tuple, and -- obviously -- dict. You can make your own >> using the __slot__ mechanism: >> > class A(object): >> ... __slots__ = ["x", "y"] >> ... > a = A() >

Re: Automatic placement of a text box? ie empty legend [matplotlib]

2011-06-29 Thread Christopher Barrington-Leigh
I still need help with this. I'd like to have the Sample A box place itself in the optimal empty space, so as not to overly any graphing elements (if possible): import numpy.random import matplotlib.pyplot as plt fig = plt.figure(1, figsize=(5,5)) fig.clf() ax = fig.add_subplot(111) ax.set_a

Re: using an instance of Object as an empty class

2011-06-29 Thread Christian Heimes
Am 29.06.2011 16:58, schrieb Ulrich Eckhardt: > Now, follow-up question: > 1. The slots are initialized to None, right? Or are they just reserved? IOW, > would "print a.x" right after creation of the object print anything or raise > an AttributeError? No, slots don't have a default value. It wou

Re: using an instance of Object as an empty class

2011-06-29 Thread Ulrich Eckhardt
Peter Otten wrote: > Examples for classes that don't accept attributes are builtins > like int, tuple, and -- obviously -- dict. You can make your own > using the __slot__ mechanism: > class A(object): > ... __slots__ = ["x", "y"] > ... a = A() a.x = 42 a.y = "yadda" a

Python Ldap Compiliation Issue

2011-06-29 Thread Lunershot
Hi Everyone, I am having an issue with getting python-ldap to compile in my RHEL enviroment. I am running python 2.7.2 from source, and I have the openldap-devel package installed but still can not get this to work. Here is the output: extra_compile_args: -g extra_objects: include_dirs: /opt/op

Re: using an instance of Object as an empty class

2011-06-29 Thread Peter Otten
AlienBaby wrote: > I'm just wondering why something is so, and whats going on under the > hood. > > Now and again I use something like > > class empty(object): > pass > > > simply so I can make an instance, and set some attributes on it. > > a=empty() > a.whatever=something > > > Poking ar

using an instance of Object as an empty class

2011-06-29 Thread AlienBaby
Hi, I'm just wondering why something is so, and whats going on under the hood. Now and again I use something like class empty(object): pass simply so I can make an instance, and set some attributes on it. a=empty() a.whatever=something Poking around with this, I assumed I could instead say

Re: Using decorators with argument in Python

2011-06-29 Thread jigar tanna
okie i agree with  your comment, if the case is simple we would prefer not to make it complex but if required there would be nor harm in using decorators with Arguments Thanks, J --- On Tue, 28/6/11, Lie Ryan wrote: From: Lie Ryan Subject: Re: Using decorators with argument in Pyt

Attribute Error in xml.sax.saxutils.XMLGenerator on Arch Linux (64bit)

2011-06-29 Thread Andreas Hasenkopf
Hi there, after switching from Ubuntu to Arch Linux I noticed a disturbing problem in a Python script I wrote (see http://sourceforge.net/projects/emcdutilityprog/files/). Using Windows (Python 2.6) and Ubuntu 11.04 (Python 2.7) I did not experience any problems. Using Arch Linux (Python 2.7) I got

Re: Using decorators with argument in Python

2011-06-29 Thread jigar tanna
yes for this case you will have to use @memoize() as all the arguments are optional ... Thanks, J --- On Tue, 28/6/11, Ian Kelly wrote: From: Ian Kelly Subject: Re: Using decorators with argument in Python To: "Jigar Tanna" Cc: python-list@python.org Date: Tuesday, 28 June, 2011, 10:50 PM

OT, but very funny

2011-06-29 Thread Frank Millman
Hope you find the following as amusing as I did - http://www.davidnaylor.co.uk/eu-cookies-directive-interactive-guide-to-25th-may-and-what-it-means-for-you.html Background - On 26 May new legislation came into force in the UK regulating how web sites use cookies. It is the outcome of amendment

Re: Change the name with the random names in a text file

2011-06-29 Thread Ulrich Eckhardt
Amaninder Singh wrote: > I am fairly new to the language and programing. I am trying to solve a > problem in a text file. Where names are something like in this manner > [**Name2 (NI) 98**] > > [**Last Name (STitle) 97**] > [**First Name4 (NamePattern1) 93**] > [**Last Name (NamePattern1) 94**]