Re: generators as decorators simple issue

2012-09-12 Thread Thomas Rachel
Am 12.09.2012 04:28 schrieb j.m.dagenh...@gmail.com: I'm trying to call SetName on an object to prevent me from ever having to call it explictly again on that object. Best explained by example. def setname(cls): '''this is the proposed generator to call SetName on the object''' try:

Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py

2012-09-12 Thread Thomas Rachel
Am 11.09.2012 05:46 schrieb Steven D'Aprano: Good for you. (Sorry, that comes across as more condescending than it is intended as.) Monkey-patching often gets used for quick scripts and tiny pieces of code because it works. Just beware that if you extend that technique to larger bodies of

Re: Which Version of Python?

2012-09-12 Thread Mark Lawrence
On 11/09/2012 17:49, Charles Hottel wrote: I have a lot of programming experience in many different languages and now I want to learn Python. Which version do you suggest I download, Python 2.x or Python 3.x ? Also why should I prefer one over the other? Right now I am thinkng Python 3.x as

Re: pythonOCC examples doesn't work?

2012-09-12 Thread Mark Lawrence
On 12/09/2012 05:02, Jayden wrote: I installed (1) pythonxy2.7.2.3 (with python2.7) and (2) pythonOCC-0.5-all-in-one.win32.py26 Can you safely mix these? on windows 7 64 bit computer. I try run pythonOCC examples in its example folder, such as the helloworld.py and got errors as follows:

Re: pythonOCC examples doesn't work?

2012-09-12 Thread Dwight Hutto
So used to google, forgot to check the python docs: http://docs.python.org/faq/windows.html and this should be useful as well, which is from: http://stackoverflow.com/questions/5030362/how-to-use-opencv-in-python I suspect you have the same problem I've run into. If you have a 64-bit version

Re: pythonOCC examples doesn't work?

2012-09-12 Thread Mark Lawrence
On 12/09/2012 08:19, Dwight Hutto wrote: So used to google, forgot to check the python docs: http://docs.python.org/faq/windows.html and this should be useful as well, which is from: http://stackoverflow.com/questions/5030362/how-to-use-opencv-in-python I suspect you have the same problem

Re: pythonOCC examples doesn't work?

2012-09-12 Thread Dwight Hutto
On Wed, Sep 12, 2012 at 3:37 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 12/09/2012 08:19, Dwight Hutto wrote: So used to google, forgot to check the python docs: http://docs.python.org/faq/windows.html and this should be useful as well, which is from:

Re: Which Version of Python?

2012-09-12 Thread alex23
On 12 Sep, 16:31, Mark Lawrence breamore...@yahoo.co.uk wrote: Perhaps this will sway youhttp://docs.python.org/dev/whatsnew/3.3.html There is no longer an equivalent document for the Python 1.x or 2.x series of releases. Perhaps not for 1.x but the 2.x series is still covered:

Re: Which Version of Python?

2012-09-12 Thread Ramchandra Apte
On Wednesday, 12 September 2012 14:04:56 UTC+5:30, alex23 wrote: On 12 Sep, 16:31, Mark Lawrence breamore...@yahoo.co.uk wrote: Perhaps this will sway youhttp://docs.python.org/dev/whatsnew/3.3.html There is no longer an equivalent document for the Python 1.x or 2.x series of

Re: Which Version of Python?

2012-09-12 Thread Ramchandra Apte
On Wednesday, 12 September 2012 14:11:56 UTC+5:30, Ramchandra Apte wrote: On Wednesday, 12 September 2012 14:04:56 UTC+5:30, alex23 wrote: On 12 Sep, 16:31, Mark Lawrence breamore...@yahoo.co.uk wrote: Perhaps this will sway youhttp://docs.python.org/dev/whatsnew/3.3.html

Re: Double sided double underscored variable names

2012-09-12 Thread Joshua Landau
On 12/09/2012, Chris Angelico ros...@gmail.com wrote: On Wed, Sep 12, 2012 at 11:38 AM, Joshua Landau joshua.landau...@gmail.com wrote: On 12 September 2012 02:14, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 12 Sep 2012 08:52:10 +1000, Chris Angelico wrote: Inline

Re: generators as decorators simple issue

2012-09-12 Thread pyjoshsys
The output is still not what I want. Now runtime error free, however the output is not what I desire. def setname(cls): '''this is the proposed generator to call SetName on the object''' try: cls.SetName(cls.__name__) except Exception as e: print e finally:

Re: generators as decorators simple issue

2012-09-12 Thread Oscar Benjamin
On Wed, 12 Sep 2012 03:22:31 -0700 (PDT), pyjoshsys j.m.dagenh...@gmail.com wrote: The output is still not what I want. Now runtime error free, however the output is not what I desire. def setname(cls): '''this is the proposed generator to call SetName on the object''' try:

Re: Single leading dash in member variable names?

2012-09-12 Thread Tim Chase
On 09/12/12 00:10, Dwight Hutto wrote: Not to jump in with another question(this seems somewhat relevant to the conversation, maybe not), but is this similar to a private,public, or protected class similar to the C type langs? Close, but C-like languages tend to strictly enforce it, while in

Re: SAP MM Cupertino, CA

2012-09-12 Thread Diabolic Preacher
I really hoped for at least one mention of Python in there. Like 'knows how to use it to calculate numbers'. anything. Does GMail learn from Google Groups' spam reporting? Thanks SNIP Please explain what does this have to do with Python. -- Diabolic Preacher As Is Blog:

Re: generators as decorators simple issue

2012-09-12 Thread pyjoshsys
so decorators only pass the object and not any instance of the object as the implied argument? Is this right? The idea was to use @setname instead of instance.SetName(instance.__name__). I thought decorators would do this, but it seems not. --

Re: SAP MM Cupertino, CA

2012-09-12 Thread Dwight Hutto
Looks to me like someone recruiting experienced programmers, and there is a demographic here who would probably like a job like that. Definitely not considered SPAM by me. They're not selling, they're trying to gainfully employ a good programmer from a list meant to interact and learn. If I had

Re: SAP MM Cupertino, CA

2012-09-12 Thread Dwight Hutto
On Wed, Sep 12, 2012 at 6:58 AM, Diabolic Preacher pintoo...@gmail.com wrote: I really hoped for at least one mention of Python in there. It does seem like a blanketed letter to several groups, but maybe they're looking for any good programmer. Once you learn a language, and in my opinion learn

Re: forked processes and testing

2012-09-12 Thread Kushal Kumaran
On Wed, Sep 12, 2012 at 3:50 PM, andrea crotti andrea.crott...@gmail.com wrote: I wrote a decorator that takes a function, run it in a forked process and return the PID: def on_forked_process(func): from os import fork Decorator that forks the process, runs the function and gives

Re: Which Version of Python?

2012-09-12 Thread Jamie Paul Griffin
[ Ramchandra Apte wrote on Tue 11.Sep'12 at 19:58:29 -0700 ] On Tuesday, 11 September 2012 22:19:08 UTC+5:30, Charles Hottel wrote: I have a lot of programming experience in many different languages and now I want to learn Python. Which version do you suggest I download, Python 2.x

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-12 Thread Pete Forman
John Nagle na...@animats.com writes: I want to parse standard ISO date/time strings such as 2012-09-09T18:00:00-07:00 into Python datetime objects. Consider whether RFC 3339 might be a more suitable format. It is a subset of ISO 8601 extended format. Some of the restrictions are

Boolean function on variable-length lists

2012-09-12 Thread Libra
Hello, I need to implement a function that returns 1 only if all the values in a list satisfy given constraints (at least one constraint for each element in the list), and zero otherwise. For example, I may have a list L = [1, 2, 3, 4] and the following constraints: L[0] = 1 L[1] = 3 L[2] == 2

avoid the redefinition of a function

2012-09-12 Thread Jabba Laci
Hi, I have an installer script that contains lots of little functions. It has an interactive menu and the corresponding function is called. Over time it grew long and when I want to add a new function, I should give a unique name to that function. However, Python allows the redefinition of

Re: Boolean function on variable-length lists

2012-09-12 Thread Jussi Piitulainen
Libra writes: Hello, I need to implement a function that returns 1 only if all the values in a list satisfy given constraints (at least one constraint for each element in the list), and zero otherwise. For example, I may have a list L = [1, 2, 3, 4] and the following constraints: L[0]

Re: Boolean function on variable-length lists

2012-09-12 Thread Steven D'Aprano
On Wed, 12 Sep 2012 05:48:09 -0700, Libra wrote: Hello, I need to implement a function that returns 1 only if all the values in a list satisfy given constraints (at least one constraint for each element in the list), and zero otherwise. What are the restrictions on the constraints

Re: avoid the redefinition of a function

2012-09-12 Thread Ramchandra Apte
On Wednesday, 12 September 2012 18:26:36 UTC+5:30, Jabba Laci wrote: Hi, I have an installer script that contains lots of little functions. It has an interactive menu and the corresponding function is called. Over time it grew long and when I want to add a new function, I should

Re: Boolean function on variable-length lists

2012-09-12 Thread Tim Chase
On 09/12/12 08:02, Jussi Piitulainen wrote: Libra writes: For example, I may have a list L = [1, 2, 3, 4] and the following constraints: L[0] = 1 L[1] = 3 L[2] == 2 L[3] = 3 So you would associate each constraint with an index. You could maintain a list of constraints and apply it to

Re: Boolean function on variable-length lists

2012-09-12 Thread Libra
On Wednesday, September 12, 2012 3:02:44 PM UTC+2, Jussi Piitulainen wrote: So you would associate each constraint with an index. You could maintain a list of constraints and apply it to the values as follows: Yes, even though there could be more constraints for each value in the list (at

Re: Boolean function on variable-length lists

2012-09-12 Thread Libra
On Wednesday, September 12, 2012 3:11:42 PM UTC+2, Steven D'Aprano wrote: On Wed, 12 Sep 2012 05:48:09 -0700, Libra wrote: I need to implement a function that returns 1 only if all the values in a list satisfy given constraints (at least one constraint for each element in the list), and

Re: avoid the redefinition of a function

2012-09-12 Thread Ken Seehart
Use lambda expressions to define some constraints: gt = lambda x: lambda y: xy eq = lambda x: lambda y: x==y constraints = [gt(2), eq(1)] data = [3,1] for i,c in enumerate(constraints): print c(data[i]) On 9/12/2012 5:56 AM, Jabba Laci wrote: Hi, I have an installer script that

Re: Boolean function on variable-length lists

2012-09-12 Thread Libra
On Wednesday, September 12, 2012 3:19:28 PM UTC+2, Libra wrote: {False, True} Actually, I don't understand the output. Why it is both False and True? Ok, I have understood now, I didn't noticed it was a set and not a list. Regards -- http://mail.python.org/mailman/listinfo/python-list

Re: Boolean function on variable-length lists

2012-09-12 Thread Jussi Piitulainen
Libra writes: On Wednesday, September 12, 2012 3:02:44 PM UTC+2, Jussi Piitulainen wrote: So you would associate each constraint with an index. You could maintain a list of constraints and apply it to the values as follows: Yes, even though there could be more constraints for each

Re: Boolean function on variable-length lists

2012-09-12 Thread Oscar Benjamin
On 12 September 2012 14:25, Libra librar...@gmail.com wrote: On Wednesday, September 12, 2012 3:11:42 PM UTC+2, Steven D'Aprano wrote: On Wed, 12 Sep 2012 05:48:09 -0700, Libra wrote: I need to implement a function that returns 1 only if all the values in a list satisfy given

Re: Boolean function on variable-length lists

2012-09-12 Thread Ken Seehart
Putting a few of peoples ideas together... gt = lambda x: lambda y: xy eq = lambda x: lambda y: x==y def constrain(c,d): return all({f(x) for f, x in zip(c, d)}) constraints = [gt(2), eq(1)] data0 = [1,1] data1 = [3,1] print constrain(constraints, data0) print constrain(constraints,

Re: avoid the redefinition of a function

2012-09-12 Thread D'Arcy Cain
On Wed, 12 Sep 2012 14:56:12 +0200 Jabba Laci jabba.l...@gmail.com wrote: This will call the 2nd function. Now my functions are called step_ID (like step_27(), step_28(), etc.). How to avoid the danger of redefinition? Now, when I write a new function, I search for its name to see if it's

Re: avoid the redefinition of a function

2012-09-12 Thread Alister
On Wed, 12 Sep 2012 06:15:21 -0700, Ramchandra Apte wrote: On Wednesday, 12 September 2012 18:26:36 UTC+5:30, Jabba Laci wrote: Hi, I have an installer script that contains lots of little functions. It has an interactive menu and the corresponding function is called. Over time it

RE: odt2sphinx 0.2.3 released

2012-09-12 Thread bamba777
ߒߤߒߡߜߦߡ ߠߧ -Original Message- From: Christophe de Vienne Sent: Thu, 06 Sep 2012 15:15:23 +0200 To: python-annou...@python.org Subject: odt2sphinx 0.2.3 released Hello, odt2sphinx 0.2.3 is now available on pypi : http://pypi.python.org/pypi/odt2sphinx/. Odt2sphinx convert

Re: avoid the redefinition of a function

2012-09-12 Thread Michael Torrie
On 09/12/2012 06:56 AM, Jabba Laci wrote: I have an installer script that contains lots of little functions. It has an interactive menu and the corresponding function is called. Over time it grew long and when I want to add a new function, I should give a unique name to that function. However,

using text file to get ip address from hostname

2012-09-12 Thread dkatorza
hello , i'm new to Python and i searched the web and could not find an answer for my issue. i need to get an ip address from list of hostnames which are in a textfile. this is what i have so far -- #!/usr/bin/env python

Re: Boolean function on variable-length lists

2012-09-12 Thread Mark Lawrence
On 12/09/2012 14:51, Ken Seehart wrote: [snip] Could you please not top post on this list, thanks. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: using text file to get ip address from hostname

2012-09-12 Thread Chris Angelico
On Thu, Sep 13, 2012 at 12:24 AM, dkato...@gmail.com wrote: i'm new to Python and i searched the web and could not find an answer for my issue. i need to get an ip address from list of hostnames which are in a textfile. This is sounding like homework, so I'll just give you a basic pointer.

Re: using text file to get ip address from hostname

2012-09-12 Thread dkatorza
בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת dkat...@gmail.com: hello , i'm new to Python and i searched the web and could not find an answer for my issue. i need to get an ip address from list of hostnames which are in a textfile. this is what i have so far

Re: generators as decorators simple issue

2012-09-12 Thread Ian Kelly
On Wed, Sep 12, 2012 at 4:22 AM, pyjoshsys j.m.dagenh...@gmail.com wrote: The output is still not what I want. Now runtime error free, however the output is not what I desire. [SNIP] class Trial(object): '''class to demonstrate with''' def __init__(self):

Re: odt2sphinx 0.2.3 released

2012-09-12 Thread Dustin J. Mitchell
On Wed, Sep 12, 2012 at 10:06 AM, bamba...@gmail.com wrote: ߒߤߒߡߜߦߡ ß ß§ And that's why you shouldn't let your kids play with your iPad :) Dustin -- http://mail.python.org/mailman/listinfo/python-list

Re: pythonOCC examples doesn't work?

2012-09-12 Thread jelle
You installed python 2.7 and expect a 2.6 module to work with it. That won't work. Finally, you need to install the OpenCasCade libs to be able to run PythonOCC. -jelle -- http://mail.python.org/mailman/listinfo/python-list

Re: Single leading dash in member variable names?

2012-09-12 Thread Ian Kelly
On Tue, Sep 11, 2012 at 11:10 PM, Dwight Hutto dwightdhu...@gmail.com wrote: Not to jump in with another question(this seems somewhat relevant to the conversation, maybe not), but is this similar to a private,public, or protected class similar to the C type langs? More like this is an

Re: Single leading dash in member variable names?

2012-09-12 Thread e . doxtator
On Tuesday, September 11, 2012 5:02:31 PM UTC-5, Erik Max Francis wrote: On 09/11/2012 01:53 PM, me wrote: On Tuesday, September 11, 2012 2:06:45 PM UTC-5, Ian wrote: On Tue, Sep 11, 2012 at 12:45 PM, I wrote: What is the significance of the leading underscore in self._bongo?

Re: using subprocess.Popen does not suppress terminal window on Windows

2012-09-12 Thread janis . judvaitis
Hi, and I'm sorry for using this old thread, but I'm experiencing the same problem, except, that I wan't to execute any shell script or exe without blank terminal window. Is there any way in python to supress blank console screen while script is executing? Multiplatform solution would be

Add a key parameter to bisect* functions?

2012-09-12 Thread Giacomo Alzetta
I've just noticed that the bisect module lacks of the key parameter. The documentation points to a recipe that could be used to handle a sorted collection, but I think it's an overkill if I want to bisect my sequence only once or twice with a key. Having something like `bisect(sequence,

Re: Boolean function on variable-length lists

2012-09-12 Thread MRAB
On 12/09/2012 14:51, Ken Seehart wrote: Putting a few of peoples ideas together... gt = lambda x: lambda y: xy eq = lambda x: lambda y: x==y def constrain(c,d): return all({f(x) for f, x in zip(c, d)}) If you're going to use 'all', why use a set? return all(f(x) for f, x in zip(c,

Creating socket.connect while in epoll loop

2012-09-12 Thread Miki Tebeka
Greetings, I'm trying to write a reverse TCP proxy using epoll (just for learning). I've started with the code at http://scotdoyle.com/python-epoll-howto.html and got to https://gist.github.com/3707665. However, I can't create a new connection. When reaching line 34 (backend.connect), I get

Re: Add a key parameter to bisect* functions?

2012-09-12 Thread Miki Tebeka
I've just noticed that the bisect module lacks of the key parameter. ... Is there some reason behind this lack? See full discussion at http://bugs.python.org/issue4356. Guido said it's going in, however there's no time frame for it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Add a key parameter to bisect* functions?

2012-09-12 Thread Giacomo Alzetta
Il giorno mercoledì 12 settembre 2012 17:54:31 UTC+2, Giacomo Alzetta ha scritto: I've just noticed that the bisect module lacks of the key parameter. The documentation points to a recipe that could be used to handle a sorted collection, but I think it's an overkill if I want to bisect

Re: Python-list Digest, Vol 108, Issue 98

2012-09-12 Thread David Shi
Hi, Where do I find ArcPy.py? It seems that the link disappeared. Regards. David-- http://mail.python.org/mailman/listinfo/python-list

Re: Add a key parameter to bisect* functions?

2012-09-12 Thread Giacomo Alzetta
Il giorno mercoledì 12 settembre 2012 18:05:10 UTC+2, Miki Tebeka ha scritto: I've just noticed that the bisect module lacks of the key parameter. ... Is there some reason behind this lack? See full discussion at http://bugs.python.org/issue4356. Guido said it's going in, however

Re: Single leading dash in member variable names?

2012-09-12 Thread Ian Kelly
On Wed, Sep 12, 2012 at 9:23 AM, e.doxta...@gmail.com wrote: On Tuesday, September 11, 2012 5:02:31 PM UTC-5, Erik Max Francis wrote: On 09/11/2012 01:53 PM, me wrote: PEP 8 says this is bad form. What do you think? Where does it say that? Apologies. It's in David Goodger's Code

Re: Single leading dash in member variable names?

2012-09-12 Thread mdengler
On Wednesday, September 12, 2012 4:23:49 PM UTC+1, (unknown) wrote: [...] David Goodger's Code Like A Pythonista in the Naming section [says single leading underscore is bad form]. (http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#naming) Looks like it says the opposite:

Re: avoid the redefinition of a function

2012-09-12 Thread Jabba Laci
For example: def install_java(): pass def install_tomcat(): pass Thanks for the answers. I decided to use numbers in the name of the functions to facilitate function calls. Now if you have this menu option for instance: (5) install mc You can type just 5 as user input and step_5()

Re: pythonOCC examples doesn't work?

2012-09-12 Thread Jayden
On Wednesday, September 12, 2012 11:12:55 AM UTC-4, jelle wrote: You installed python 2.7 and expect a 2.6 module to work with it. That won't work. Finally, you need to install the OpenCasCade libs to be able to run PythonOCC. -jelle I think that is the reason. Thanks a lot!! --

Re: Add a key parameter to bisect* functions?

2012-09-12 Thread Miki Tebeka
Correct me if I'm wrong, but the reason for this absence is that people could think that doing repeated bisects using keys would be fast, even though keys has to be recomputed? I think the main point Raymond had was: If we added key= to bisect, it would encourage bad design and steer

Re: avoid the redefinition of a function

2012-09-12 Thread Tim Chase
On 09/12/12 11:56, Jabba Laci wrote: For example: def install_java(): pass def install_tomcat(): pass Thanks for the answers. I decided to use numbers in the name of the functions to facilitate function calls. Now if you have this menu option for instance: (5) install mc

Re: using text file to get ip address from hostname

2012-09-12 Thread Alister
On Wed, 12 Sep 2012 07:41:10 -0700, dkatorza wrote: בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת dkat...@gmail.com: hello , i'm new to Python and i searched the web and could not find an answer for my issue. i need to get an ip address from list of hostnames which are in

Re: avoid the redefinition of a function

2012-09-12 Thread Alister
On Wed, 12 Sep 2012 18:56:46 +0200, Jabba Laci wrote: For example: def install_java(): pass def install_tomcat(): pass Thanks for the answers. I decided to use numbers in the name of the functions to facilitate function calls. Now if you have this menu option for instance:

Re: avoid the redefinition of a function

2012-09-12 Thread MRAB
On 12/09/2012 19:04, Alister wrote: On Wed, 12 Sep 2012 18:56:46 +0200, Jabba Laci wrote: For example: def install_java(): pass def install_tomcat(): pass Thanks for the answers. I decided to use numbers in the name of the functions to facilitate function calls. Now if you have this

Java Python Developer Required at NYC NY

2012-09-12 Thread Sanith Nair
Hi, I am looking for a Java Python developer at NYC NY for one of our direct client. It is a 6 Months contract position. We need a person with experience in developing trading applications and very good with Python Development. If interested, please send me your resume to my email address, ie

Re: Creating socket.connect while in epoll loop

2012-09-12 Thread calderone . jeanpaul
On Wednesday, September 12, 2012 12:01:58 PM UTC-4, Miki Tebeka wrote: Greetings, I'm trying to write a reverse TCP proxy using epoll (just for learning). I've started with the code at http://scotdoyle.com/python-epoll-howto.html and got to https://gist.github.com/3707665. However, I

Re: avoid the redefinition of a function

2012-09-12 Thread Terry Reedy
On 9/12/2012 8:56 AM, Jabba Laci wrote: This will call the 2nd function. Now my functions are called step_ID (like step_27(), step_28(), etc.). How to avoid the danger of redefinition? Now, when I write a new function, I search for its name to see if it's unique but there must be a better way.

Re: forked processes and testing

2012-09-12 Thread Terry Reedy
On 9/12/2012 6:20 AM, andrea crotti wrote: I wrote a decorator that takes a function, run it in a forked process and return the PID: This strikes me as an abuse of the decorator syntax. @wrap def f(): pass is just syntactic sugar for def f(): pass f = wrap(f) but that is not what you are

Re: Creating socket.connect while in epoll loop

2012-09-12 Thread Miki Tebeka
You cannot synchronously set up a new TCP connection using a non-blocking socket. Instead, you begin the connection attempt and it fails with EINPROGRESS and then you use epoll to find out when the attempt completes. OK. I suggest reading the implementation of a Twisted reactor to see an

Re: using text file to get ip address from hostname

2012-09-12 Thread Terry Reedy
On 9/12/2012 10:41 AM, dkato...@gmail.com wrote: it's not really homework, i found a lab exercise on the web and i;m trying to study with it. maybe not the most efficient way. i have a file with hostnames ordered line by line. Key fact for this exercise: open files are iterable. So your

Re: pythonOCC examples doesn't work?

2012-09-12 Thread Terry Reedy
On 12/09/2012 08:19, Dwight Hutto wrote: The easiest solution is to: 1. Uninstall 64-bit Python No need to do this, at least not on windows. 2. Install a 32-bit distribution. in a separate directory. I have had both on my win7 machine so I could run (test) python code on both.

Re: avoid the redefinition of a function

2012-09-12 Thread D'Arcy Cain
On Wed, 12 Sep 2012 18:56:46 +0200 Jabba Laci jabba.l...@gmail.com wrote: (5) install mc You can type just 5 as user input and step_5() is called automatically. If I use descriptive names like install_java() then selecting a menu point would be more difficult. And I don't want users to type

Re: avoid the redefinition of a function

2012-09-12 Thread D'Arcy Cain
On Wed, 12 Sep 2012 16:37:11 -0400 Terry Reedy tjre...@udel.edu wrote: assures one that the test is being run. (I don't always test first, but I once discovered a test not being run when I modified it in a way that should have made it fail, but it didn't.) 1. Write the test 2. Run the test -

Re: avoid the redefinition of a function

2012-09-12 Thread D'Arcy Cain
On Wed, 12 Sep 2012 18:04:51 GMT Alister alister.w...@ntlworld.com wrote: No No NO! you cant just pass user input to system calls without validating it first (google sql injection for examples of the damage unsanitised input can cause, it is not just as SQL problem) http://xkcd.com/327/ --

Re: avoid the redefinition of a function

2012-09-12 Thread Tim Chase
On 09/12/12 16:47, D'Arcy Cain wrote: On Wed, 12 Sep 2012 16:37:11 -0400 Terry Reedy tjre...@udel.edu wrote: assures one that the test is being run. (I don't always test first, but I once discovered a test not being run when I modified it in a way that should have made it fail, but it

conflicting installations of python

2012-09-12 Thread azandi
I installed python 2.7.3 using macports on Lion, and used port select python python27. However python version still shows 2.7.1. Any ideas why is that happenning? And how to fix it? Thanks in advance, -- http://mail.python.org/mailman/listinfo/python-list

Re: using subprocess.Popen does not suppress terminal window on Windows

2012-09-12 Thread Dave Angel
On 09/12/2012 11:26 AM, janis.judvai...@gmail.com wrote: Hi, and I'm sorry for using this old thread, but I'm experiencing the same problem, except, that I wan't to execute any shell script or exe without blank terminal window. Is there any way in python to supress blank console screen

Re: avoid the redefinition of a function

2012-09-12 Thread Dave Angel
On 09/12/2012 12:56 PM, Jabba Laci wrote: Thanks for the answers. I decided to use numbers in the name of the functions to facilitate function calls. Now if you have this menu option for instance: (5) install mc You can type just 5 as user input and step_5() is called automatically. If I

Some questions about atexit

2012-09-12 Thread Roy Smith
The atexit docs (http://docs.python.org/library/atexit.html) are very confusing. In one place they say, The order in which the functions are called is not defined. In another place, all functions registered are called in last in, first out order. Which is correct? Also, it's not clear how

Re: submit jobs on multi-core

2012-09-12 Thread Jason Friedman
I have a python script in which I have a list of files to input one by one and for each file I get a number as an output. I used for loop to submit the file to script. My script uses one file at a time and returns the output. My computers has 8 cores. Is there any way that I could submit 8

Re: Some questions about atexit

2012-09-12 Thread Terry Reedy
On 9/12/2012 8:58 PM, Roy Smith wrote: The atexit docs (http://docs.python.org/library/atexit.html) are very confusing. In one place they say, The order in which the functions are called is not defined. In another place, all functions registered are called in last in, first out order. Which

confused in decorate and closure

2012-09-12 Thread 月忧茗
HI, I have some test code: def num(num): def deco(func): def wrap(*args, **kwargs): inputed_num = num return func(*args, **kwargs) return wrap return deco @num(5) def test(a): return a + inputed_num print test(1) when run this code, I

Re: avoid the redefinition of a function

2012-09-12 Thread D'Arcy Cain
On Wed, 12 Sep 2012 17:45:52 -0500 Tim Chase python.l...@tim.thechases.com wrote: On 09/12/12 16:47, D'Arcy Cain wrote: And run all of your tests every day. You will sleep better at night. Though I usually try to do test-driven development, I confess a fondness for Titus Brown's Stupidity

Re: conflicting installations of python

2012-09-12 Thread Ned Deily
In article da05ab8f-dbb4-4f23-8cbc-6b9a7b4f6...@googlegroups.com, azandi aza...@adconion.com wrote: I installed python 2.7.3 using macports on Lion, and used port select python python27. However python version still shows 2.7.1. Any ideas why is that happenning? And how to fix it?

Re: using text file to get ip address from hostname

2012-09-12 Thread Jason Friedman
i need to get an ip address from list of hostnames which are in a textfile. this is what i have so far -- #!/usr/bin/env python #Get the IP Address import socket hostname = 'need it to read from a text file' addr =

Re: conflicting installations of python

2012-09-12 Thread azandi
Hi Ned, Thanks for your response, I think the path is fine, since which python outputs the location where macports should install python i.e. /opt/local/bin/python. also port list active | fgrep python python27 @2.7.3 lang/python27 and port location python27

Re: conflicting installations of python

2012-09-12 Thread Ned Deily
In article fd1894aa-2a5a-42ca-b9db-60a343d6d...@googlegroups.com, aza...@adconion.com wrote: Thanks for your response, I think the path is fine, since which python outputs the location where macports should install python i.e. /opt/local/bin/python. also port list active | fgrep

[issue15928] Open url with proxy causes TypeError

2012-09-12 Thread Senthil Kumaran
Senthil Kumaran added the comment: Have a look at the ProxyHandler example in the Examples here - http://docs.python.org/library/urllib2.html#examples Also, construct the full url properly with urlencoded data as params. Your report does not give any details of problem. -- nosy:

[issue15928] Open url with proxy causes TypeError

2012-09-12 Thread Senthil Kumaran
Changes by Senthil Kumaran sent...@uthcode.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15928 ___ ___

[issue15928] Open url with proxy causes TypeError

2012-09-12 Thread zhang kai
zhang kai added the comment: Well, I do have encoded the params, that is not the problem. Also these code did work for most of the time, I don't know why this bug happen so I don't know any details about the problem. Sorry about that. -- ___ Python

[issue15926] Segmentation fault after multiple reinitializations

2012-09-12 Thread Stefan Krah
Stefan Krah added the comment: The segfault occurs in a path in import.c that has a comment XXX this this should really not happen.: Program received signal SIGSEGV, Segmentation fault. 0x0047d733 in type_dealloc (type=0x8381e0) at Objects/typeobject.c:2694 2694

[issue15926] Segmentation fault after multiple reinitializations

2012-09-12 Thread Stefan Krah
Stefan Krah added the comment: Maybe related: If you increase the number of passes in Modules/_testembed.c, pass 9 fails: --- Pass 9 --- _testembed: Objects/typeobject.c:2693: type_dealloc: Assertion `type-tp_flags (1L9)' failed. Aborted -- ___

[issue15926] Segmentation fault after multiple reinitializations

2012-09-12 Thread Stefan Krah
Changes by Stefan Krah stefan-use...@bytereef.org: -- components: +Interpreter Core stage: - needs patch type: - crash ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15926 ___

[issue5766] Mac/scripts/BuildApplet.py reset of sys.executable during install can cause it to use wrong modules

2012-09-12 Thread Ned Deily
Ned Deily added the comment: This problem was caused by a conflict between the expat parser included with Python and the expat parser included with the MacPorts ports of the obsolete pyxml package. The MacPorts project has subsequently deleted the py*-xml ports. A solution for this issue is

[issue15898] OSX TTY bug

2012-09-12 Thread Martin v . Löwis
Martin v. Löwis added the comment: Am 11.09.2012 09:11, schrieb Andrew Moffat: I'm not sure I follow the problem exactly. So you're saying that the failing version uses _cancel sys calls, and that __pthread_testcancel may result in EINTR. But that this is not happening in the trace, and

[issue15881] multiprocessing 'NoneType' object is not callable

2012-09-12 Thread Mitar
Changes by Mitar mmi...@gmail.com: -- nosy: +mitar ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15881 ___ ___ Python-bugs-list mailing list

[issue15929] argparse non alphanum characters replacement

2012-09-12 Thread Julien Castets
New submission from Julien Castets: argparse.add_argument replaces dashes with underscores. If an argument contains another non alphanum character, accessing to it will result to a syntax error. #! /usr/bin/env python import argparse if __name__ == '__main__': argParser =

[issue15928] Open url with proxy causes TypeError

2012-09-12 Thread R. David Murray
R. David Murray added the comment: What is proxy? Perhaps it does not implement readline correctly. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15928 ___

[issue15929] argparse non alphanum characters replacement

2012-09-12 Thread R. David Murray
R. David Murray added the comment: It would probably be better to have the namespace object support subscripting in order to satisfy this use case. You can use getattr to do it now. (Note that the namespace object should probably use a real dict and a __getattr__ method, since I don't think

[issue15929] argparse non alphanum characters replacement

2012-09-12 Thread Steven Bethard
Steven Bethard added the comment: If you need to get things that aren't valid Python identifiers, use vars() to get the dictionary: http://docs.python.org/dev/library/argparse.html#the-namespace-object Changing all non-alphanumeric characters to underscores would be a backwards incompatible

  1   2   >