pyNVML - GPU Monitoring and Management

2011-06-16 Thread Robert Alexander
I'm pleased to announce the release of pyNVML 2.0: Python Bindings for the NVIDIA Management Library pyNVML provides programmatic access to static information and monitoring data for NVIDIA GPUs, as well as limited management capabilities. http://pypi.python.org/pypi/nvidia-ml-py/

PyCon Finland 2011 Call For Proposals

2011-06-16 Thread Jyry Suvilehto
PyCon Finland will take place October 17-18 in Turku. The first day will feature presentations and the second is reserved for sprints. We are currently accepting proposals for both talks and sprints. If you would like to give a presentation, organize a sprint or see presentations on a particular

Nimp: Nested Imports (a la Java)

2011-06-16 Thread Tomer Filiba
Nimp (Nested Imports) is a little meta-importer hook for Python 2.3-2.7 and 3.0-3.2 that enables the use of *nested packages* (`com.ibm.foo.bar`), as is commonplace in Java and various other languages. It works by collecting all packages that begin with a common prefix on your `sys.path` and

[ANN] OpenOpt Suite release 0.34

2011-06-16 Thread dmitrey
Hi all, I'm glad to inform you about new quarterly release 0.34 of the free (even for commercial purposes, license: BSD) cross-platform OOSuite package software (OpenOpt, FuncDesigner, SpaceFuncs, DerApproximator), Main changes: * Python 3 compatibility * Lots of improvements and speedup for

read() does not read new content on FreeBSD/OpenBSD/OSX

2011-06-16 Thread Dieter
Hi group, I have a problem while reading from a file on BSD-like systems. I have a writer process which continuously appends data to a file and a reader (a data logger, something like tail -f), which should read and analyse date from the file. It works on Linux, but on BSD-like systems, it only

Re: os.path and Path

2011-06-16 Thread Laurent Claessens
So, I suppose I shall have to let go of my dreams of -- Path('/some/path/and/file') == '\\some\\path\\and\\file' and settle for -- Path('...') == Path('...') but I don't have to like it. :( Why not define the hash method to first convert to '/some/path/and/file' and then hash ? By

Fast Python in Programming Contests

2011-06-16 Thread KK
How can the execution time of python program be increased in programming contest so that we dont get TLE for gud algos.. -- http://mail.python.org/mailman/listinfo/python-list

Re: read() does not read new content on FreeBSD/OpenBSD/OSX

2011-06-16 Thread Dieter
oh, I forgot the versions: Mac OS X 10.6.7, python 2.6.1 OpenBSD 4.8, python 2.6.5 FreeBSD 8.0, python 2.6.4 dieter -- http://mail.python.org/mailman/listinfo/python-list

Re: os.path and Path

2011-06-16 Thread Steven D'Aprano
On Wed, 15 Jun 2011 19:00:07 -0700, Ethan Furman wrote: Thread 1: objects of different types compare unequal self: nonsense! we have the power to say what happens in __eq__! Thread 2: objects that __hash__ the same *must* compare __eq__! self: um, what? ... wait, only immutable

Re: os.path and Path

2011-06-16 Thread Steven D'Aprano
On Thu, 16 Jun 2011 09:03:58 +0200, Laurent Claessens wrote: So, I suppose I shall have to let go of my dreams of -- Path('/some/path/and/file') == '\\some\\path\\and\\file' and settle for -- Path('...') == Path('...') but I don't have to like it. :( Why not define the hash

data type and logarithm

2011-06-16 Thread simona bellavista
Hi, I am quite new to python and I am trying to do some simple plots. I am using python Python 2.6.4 and numpy/1.5.1 I have an ASCII data file that I am reading with the following lines of code: import pylab import numpy as np filename='something.dat' file = open(filename) rho = np.array([],

Re: data type and logarithm

2011-06-16 Thread Nobody
On Thu, 16 Jun 2011 01:37:08 -0700, simona bellavista wrote: print rho.dtype print entropy.dtype I get |S22 , what's that? A string. You probably want to convert columns to floats before appending its elements to the array. -- http://mail.python.org/mailman/listinfo/python-list

Re: data type and logarithm

2011-06-16 Thread afy...@gmail.com
I tried to cast it to float by rho = float(np.append(rho,columns[0])) but I get TypeError: don't know how to convert scalar number to float By the way, if I avoid to perform the logarithm and do a plot like pylab.plot(rho, entropy) it works! Any idea? On Jun 16, 11:16 am, Nobody

Create social networks easily using Redis and Python

2011-06-16 Thread Vivek Narayanan
Its really simple to create a scalable social network using Redis, to demonstrate this I wrote a small library called resn in python that can provide out of the box support for friends, news feed, asymmetric connections (like Twitter) and authentication. It uses the redis-py library by Andy

Re: How to avoid () when writing a decorator accepting optional arguments?

2011-06-16 Thread zeekay
I wrote a little library that does this a couple weeks ago, it's on pypi: http://pypi.python.org/pypi/Decorum/. It's pretty simple, the last example illustrates how to do what you want. After thinking about it though, I think it's probably not a great idea to allow the parenthesis to be omitted.

add referrence

2011-06-16 Thread Umesh Sharma
hello, I am doing outlook automation and i need to add a reference of a .dll file for accessing some property of mail without warning , so can anyone tell me how to add .dll reference in python script Umesh Kumar Sharma -- http://mail.python.org/mailman/listinfo/python-list

Re: data type and logarithm

2011-06-16 Thread Peter Otten
simona bellavista wrote: Hi, I am quite new to python and I am trying to do some simple plots. I am using python Python 2.6.4 and numpy/1.5.1 I have an ASCII data file that I am reading with the following lines of code: import pylab import numpy as np filename='something.dat' file =

[ANN] OpenOpt Suite release 0.34

2011-06-16 Thread dmitrey
Hi all, I'm glad to inform you about new quarterly release 0.34 of the OOSuite package software (OpenOpt, FuncDesigner, SpaceFuncs, DerApproximator) . Main changes: * Python 3 compatibility * Lots of improvements and speedup for interval calculations * Now interalg can obtain all solutions of

Re: Function within class and in modules

2011-06-16 Thread TheSaint
Zach Dziura wrote: Just repeat this to yourself: Python ISN'T Java I never had to do anything in Java. But mostly something in Sumatra :D I'm getting the point that I'll need class very seldom. Only to understand some more the use of self, whether I'll use a class. -- goto /dev/null --

Composing regex from a list

2011-06-16 Thread TheSaint
Hello, Is it possible to compile a regex by supplying a list? lst= ['good', 'brilliant'. 'solid'] re.compile(r'^'(any_of_lst)) without to go into a *for* cicle? -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: Function within class and in modules

2011-06-16 Thread Andrew Berg
On 2011.06.15 08:57 AM, Zach Dziura wrote: Just repeat this to yourself: Python ISN'T Java. class MainClass: def public static void main(*args): print('Am I doin' it right?') :P Or something like that. I've forgotten almost everything I learned about Java. --

Re: Composing regex from a list

2011-06-16 Thread Steven D'Aprano
On Thu, 16 Jun 2011 20:48:46 +0800, TheSaint wrote: Hello, Is it possible to compile a regex by supplying a list? lst= ['good', 'brilliant'. 'solid'] re.compile(r'^'(any_of_lst)) without to go into a *for* cicle? How about this? def compile_alternatives(*args): alternatives =

Re: Composing regex from a list

2011-06-16 Thread Vlastimil Brom
2011/6/16 TheSaint nob...@nowhere.net.no: Hello, Is it possible to compile a regex by supplying a list? lst= ['good', 'brilliant'. 'solid'] re.compile(r'^'(any_of_lst)) without to go into a *for* cicle? In simple cases, you can just join the list of alternatives on | and incorporate it in

Python mode: make emacs use existing *Python* frame, and not open a new one

2011-06-16 Thread Lars Bungum
Hi, I am using python-mode to write python code in Emacs, and when I use the useful C-c C-c key combination to interpret the buffer, Emacs always opens another window inside the window I am using. I prefer using Emacs split in two windows (one on each physical screen) where I program in one

TurboVNC used in python program

2011-06-16 Thread PyNewbie
Does anyone have experience with TubroVNC? I'm having an issue with the refresh rate for 2D vs. 3D. I have posted a sample video illustrating the issue below. As you can see the 2D images do not appear to be refreshing correctly. The 3D background appears real-time and correct.

Re: os.path and Path

2011-06-16 Thread Ethan Furman
Steven D'Aprano wrote: On Wed, 15 Jun 2011 19:00:07 -0700, Ethan Furman wrote: Thread 1: objects of different types compare unequal self: nonsense! we have the power to say what happens in __eq__! Thread 2: objects that __hash__ the same *must* compare __eq__! self: um, what? ...

Re: Function within class and in modules

2011-06-16 Thread Zachary Dziura
On Thursday, June 16, 2011 9:02:45 AM UTC-4, Andrew Berg wrote: On 2011.06.15 08:57 AM, Zach Dziura wrote: Just repeat this to yourself: Python ISN'T Java. class MainClass: def public static void main(*args): print('Am I doin' it right?') :P Or something like that. I've

Re: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* Tim Johnson t...@johnsons-web.com [110615 18:53]: * geremy condra debat...@gmail.com [110615 18:03]: On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnson t...@johnsons-web.com wrote: Using Python 2.6.5 on linux. When using MySQLdb I am getting warnings printed to stdout, but I would like

Missing python27.dll on Win 7 64-bit

2011-06-16 Thread David Aldrich
Hi I am building a 32-bit C++ application using Visual C++ Express 2008 on 64-bit Windows 7. The application links to Python, so I installed 32-bit Python 2.7.2 by running python-2.7.2.msi. When I run my app, I get error: ... python27.dll is missing from your computer ... and, indeed, it is

Re: os.path and Path

2011-06-16 Thread Ethan Furman
Steven D'Aprano wrote: If Path is intended to be platform independent, then these two paths could represent the same location: 'a/b/c:d/e' # on Linux or OS X 'a:b:c/d:e' # on classic Mac pre OS X and be impossible on Windows. So what's the canonical path it should be converted to? Are

Re: os.path and Path

2011-06-16 Thread Christian Heimes
Am 16.06.2011 18:16, schrieb Ethan Furman: Steven D'Aprano wrote: If Path is intended to be platform independent, then these two paths could represent the same location: 'a/b/c:d/e' # on Linux or OS X 'a:b:c/d:e' # on classic Mac pre OS X and be impossible on Windows. So what's the

Re: os.path and Path

2011-06-16 Thread Steven D'Aprano
On Thu, 16 Jun 2011 09:16:22 -0700, Ethan Furman wrote: Steven D'Aprano wrote: If Path is intended to be platform independent, then these two paths could represent the same location: 'a/b/c:d/e' # on Linux or OS X 'a:b:c/d:e' # on classic Mac pre OS X and be impossible on Windows. So

Re: os.path and Path

2011-06-16 Thread Ethan Furman
Christian Heimes wrote: Am 16.06.2011 18:16, schrieb Ethan Furman: Steven D'Aprano wrote: If Path is intended to be platform independent, then these two paths could represent the same location: 'a/b/c:d/e' # on Linux or OS X 'a:b:c/d:e' # on classic Mac pre OS X and be impossible on

Re: os.path and Path

2011-06-16 Thread Ethan Furman
Steven D'Aprano wrote: On Thu, 16 Jun 2011 09:16:22 -0700, Ethan Furman wrote: Steven D'Aprano wrote: If Path is intended to be platform independent, then these two paths could represent the same location: 'a/b/c:d/e' # on Linux or OS X 'a:b:c/d:e' # on classic Mac pre OS X and be

Re: data type and logarithm

2011-06-16 Thread Terry Reedy
On 6/16/2011 4:37 AM, simona bellavista wrote: Hi, I am quite new to python and I am trying to do some simple plots. I am using python Python 2.6.4 and numpy/1.5.1 I have an ASCII data file that I am reading with the following lines of code: import pylab import numpy as np

Re: os.path and Path

2011-06-16 Thread Eric Snow
On Thu, Jun 16, 2011 at 10:41 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On a Linux or OS X box, you could have a file e inside a directory c:d inside b inside a. It can't be treated as platform independent, because c:d is not a legal path component under classic Mac or

Re: Fast Python in Programming Contests

2011-06-16 Thread Terry Reedy
On 6/16/2011 3:09 AM, KK wrote: How can the execution time of python program be increased in decreased programming contest so that we dont get TLE for gud algos.. TLE = time limit expired? Sites or 'contests' that have the same time limit for Python as for C, especially when the

Re: Missing python27.dll on Win 7 64-bit

2011-06-16 Thread Terry Reedy
On 6/16/2011 12:44 PM, Dennis Lee Bieber wrote: On Thu, 16 Jun 2011 16:26:31 +0100, David Aldrich david.aldr...@emea.nec.com declaimed the following in gmane.comp.python.general: ... python27.dll is missing from your computer ... and, indeed, it is in neither C:\Windows\System32 nor

Re: Trapping MySQLdb warnings

2011-06-16 Thread Terry Reedy
On 6/16/2011 11:55 AM, Tim Johnson wrote: * Tim Johnsont...@johnsons-web.com [110615 18:53]: * geremy condradebat...@gmail.com [110615 18:03]: On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnsont...@johnsons-web.com wrote: Using Python 2.6.5 on linux. When using MySQLdb I am getting warnings

Re: Trapping MySQLdb warnings

2011-06-16 Thread srinivas hn
Hi Tim, Use this method it will sort tour problem. def do_query(insert_query): import warnings with warnings.catch_warnings(): warnings.simplefilter('error', MySQLdb.Warning) try: cursor.execute(insert_query) conn.commit() return 'Success' except MySQLdb.Error,

Re: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* Terry Reedy tjre...@udel.edu [110616 10:50]: On 6/16/2011 11:55 AM, Tim Johnson wrote: * Tim Johnsont...@johnsons-web.com [110615 18:53]: * geremy condradebat...@gmail.com [110615 18:03]: On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnsont...@johnsons-web.com wrote: Using Python 2.6.5 on

[ANN] OpenOpt Suite release 0.34

2011-06-16 Thread dmitrey
Hi all, I'm glad to inform you about new quarterly release 0.34 of the free (even for commercial purposes, license: BSD) cross-platform OOSuite package software (OpenOpt, FuncDesigner, SpaceFuncs, DerApproximator), Main changes: * Python 3 compatibility * Lots of improvements and speedup for

Re: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* Terry Reedy tjre...@udel.edu [110616 10:50]: ... Substitute specific MySQLdb warning class, whatever it is, for Warning. Hmm! Consider the following code: try : self.__rdb.execute(S) raise MySQLdb.Warning('danger, danger Monte Python') ## just for grins except MySQLdb.Warning,e:

Re: Trapping MySQLdb warnings

2011-06-16 Thread Terry Reedy
On 6/16/2011 3:01 PM, Tim Johnson wrote: * Terry Reedytjre...@udel.edu [110616 10:50]: The machinery in the warnings module is only for instances of subsclasses of Warning. Are the warnings from MySQLdb properly such objects? If so, what class are they? The warnings are sent directly to

Using __abstractmethod__ with non-methods

2011-06-16 Thread Eric Snow
This is a long post, so to sum up: Is it bad to set __abstractmethod__ on non-functions in order to trigger the ABC abstractness checks? If not, are __isabstractmethod__ on objects and __abstractmethods__ on classes misleading names? I don't mean to imply that Python has it wrong. On the

Re: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* srinivas hn hnsr...@gmail.com [110616 11:06]: Hi Tim, Use this method it will sort tour problem. def do_query(insert_query): import warnings with warnings.catch_warnings(): warnings.simplefilter('error', MySQLdb.Warning) try: cursor.execute(insert_query)

Re: Nimp: Nested Imports (a la Java)

2011-06-16 Thread Stefan Behnel
Tomer Filiba, 16.06.2011 10:48: Nimp (Nested Imports) is a little meta-importer hook for Python 2.3-2.7 and 3.0-3.2 that enables the use of *nested packages* (`com.ibm.foo.bar`), as is commonplace in Java and various other languages. It works by collecting all packages that begin with a common

ANN: fathom 0.4.0, fathom-tools 0.1.0, qfathom 0.1.0

2011-06-16 Thread Filip Gruszczyński
Hello everyone! I would like to announce new version of fathom as well as two more packages built on top fathom. All this code is still very young and experimental, so it is not supposed to be production ready. However, I would greatly appreciate any advice or ideas on what could be useful and

Re: data type and logarithm

2011-06-16 Thread Robert Kern
On 6/16/11 12:20 PM, Terry Reedy wrote: rho = mp.append(rho, float(r)) # same with entropy) does numpy really not let you write Python stype rho.append(float(r)) ? No. numpy arrays are not extensible in-place in general because we use view semantics for slices and similar operations like

Re: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* srinivas hn hnsr...@gmail.com [110616 11:06]: Hi Tim, import warnings with warnings.catch_warnings(): warnings.simplefilter('error', MySQLdb.Warning) try: cursor.execute(insert_query) conn.commit() return 'Success' except MySQLdb.Error, error:

Re: break in a module

2011-06-16 Thread Erik Max Francis
Eric Snow wrote: On Tue, Jun 14, 2011 at 5:51 PM, Erik Max Francis m...@alcyone.com wrote: Ethan Furman wrote: To me, too -- too bad it doesn't work: c:\temp\python32\python early_abort.py File early_abort.py, line 7 return ^ SyntaxError: 'return' outside function Nor should it.

Re: break in a module

2011-06-16 Thread Erik Max Francis
Eric Snow wrote: Like I said, my main motivation is to reduce my levels of indentation somewhat. I was trying to see if I could apply a pattern I use in functions and loops to modules. If your sole goal here is to reduce clutter, then turn a repeated if/elif/else case into a dictionary

Run Python script from JS

2011-06-16 Thread Gnarlodious
Is there any way to call a Py script from Javascript in a webpage? I don't have to tell you how messy JS is… -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list

HTTPConncetion - HEAD request

2011-06-16 Thread gervaz
Hi all, can someone tell me why the read() function in the following py3 code returns b''? h = http.client.HTTPConnection(www.twitter.com) h.connect() h.request(HEAD, /, HTTP 1.0) r = h.getresponse() r.read() b'' Thanks, Mattia -- http://mail.python.org/mailman/listinfo/python-list

Re: HTTPConncetion - HEAD request

2011-06-16 Thread Ian Kelly
On Thu, Jun 16, 2011 at 4:43 PM, gervaz ger...@gmail.com wrote: Hi all, can someone tell me why the read() function in the following py3 code returns b''? h = http.client.HTTPConnection(www.twitter.com) h.connect() h.request(HEAD, /, HTTP 1.0) r = h.getresponse() r.read() b'' You mean

Re: break in a module

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis m...@alcyone.com wrote: It's quite consistent on which control structures you can break out of -- it's the looping ones. Plus functions. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: break in a module

2011-06-16 Thread Erik Max Francis
Chris Angelico wrote: On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis m...@alcyone.com wrote: It's quite consistent on which control structures you can break out of -- it's the looping ones. Plus functions. No: def f(): ... break ... File stdin, line 2 SyntaxError: 'break' outside

Re: Run Python script from JS

2011-06-16 Thread Chris Rebert
On Thu, Jun 16, 2011 at 3:11 PM, Gnarlodious gnarlodi...@gmail.com wrote: Is there any way to call a Py script from Javascript in a webpage? Where is the script located, and where do you want it to run? Server or client? I don't have to tell you how messy JS is… Indeed. jQuery dulls the pain

Re: break in a module

2011-06-16 Thread Ian Kelly
On Tue, Jun 14, 2011 at 4:57 PM, MRAB pyt...@mrabarnett.plus.com wrote: To me, the obvious choice would be return, not break. No, return returns a value. Modules do not return values. Therefore return would be inappropriate. If this feature were deemed desirable, break would make more sense to

Re: break in a module

2011-06-16 Thread Eric Snow
On Thu, Jun 16, 2011 at 5:29 PM, Erik Max Francis m...@alcyone.com wrote: Chris Angelico wrote: On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis m...@alcyone.com wrote: It's quite consistent on which control structures you can break out of -- it's the looping ones. Plus functions. No:

Re: break in a module

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 9:29 AM, Erik Max Francis m...@alcyone.com wrote: Chris Angelico wrote: On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis m...@alcyone.com wrote: It's quite consistent on which control structures you can break out of -- it's the looping ones. Plus functions. No:

Re: break in a module

2011-06-16 Thread Steven D'Aprano
On Thu, 16 Jun 2011 15:07:23 -0700, Erik Max Francis wrote: Eric Snow wrote: The only ways that I know of to accomplish this currently is either by putting everything inside if-else blocks, or raise some kind of ImportBreak exception and catch it in an import hook. You're still not

Re: os.path and Path

2011-06-16 Thread Chris Torek
Steven D'Aprano wrote: Why do you think there's no Path object in the standard library? *wink* In article mailman.16.1308239495.1164.python-l...@python.org Ethan Furman et...@stoneleaf.us wrote: Because I can't find one in either 2.7 nor 3.2, and every reference I've found has indicated that

Embedding Python in a shell script

2011-06-16 Thread Jason Friedman
$ cat test.sh #!/bin/bash for i in 1 2 3 4; do python -c for j in range($i): print j done $ sh test.sh 0 0 1 0 1 2 0 1 2 3 The code behaves as I expect and want, but the de-denting of the Python call is unattractive, especially unattractive the longer the Python call becomes. I'd prefer

Re: break in a module

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 10:48 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Perhaps the most sensible alternative is conditional importing: # === module extras.py === def ham(): pass def cheese(): pass def salad(): pass # === module other.py === def spam(): pass if

Re: os.path and Path

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 2:32 AM, Christian Heimes li...@cheimes.de wrote: c:d is a valid directory name on Linux. :] The different naming rules come in handy now and then. Wine creates directories (symlinks, I think, but same diff) called c: and d: and so on, which then become the drives that

Re: os.path and Path

2011-06-16 Thread Ethan Furman
Chris Torek wrote: Steven D'Aprano wrote: Why do you think there's no Path object in the standard library? *wink* In article mailman.16.1308239495.1164.python-l...@python.org Ethan Furman et...@stoneleaf.us wrote: Because I can't find one in either 2.7 nor 3.2, and every reference I've

Re: Embedding Python in a shell script

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 10:57 AM, Jason Friedman ja...@powerpull.net wrote: The code behaves as I expect and want, but the de-denting of the Python call is unattractive, especially unattractive the longer the Python call becomes.  I'd prefer something like: #!/bin/bash for i in 1 2 3 4; do

Re: break in a module

2011-06-16 Thread Erik Max Francis
Chris Angelico wrote: On Fri, Jun 17, 2011 at 9:29 AM, Erik Max Francis m...@alcyone.com wrote: Chris Angelico wrote: On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis m...@alcyone.com wrote: It's quite consistent on which control structures you can break out of -- it's the looping ones.

Re: break in a module

2011-06-16 Thread Erik Max Francis
Chris Angelico wrote: On Fri, Jun 17, 2011 at 10:48 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Perhaps the most sensible alternative is conditional importing: # === module extras.py === def ham(): pass def cheese(): pass def salad(): pass # === module other.py === def

Re: break in a module

2011-06-16 Thread Ethan Furman
Erik Max Francis wrote: Chris Angelico wrote: On Fri, Jun 17, 2011 at 10:48 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Perhaps the most sensible alternative is conditional importing: # === module extras.py === def ham(): pass def cheese(): pass def salad(): pass # ===

Re: break in a module

2011-06-16 Thread Ian Kelly
On Thu, Jun 16, 2011 at 7:21 PM, Erik Max Francis m...@alcyone.com wrote: This would, if I understand imports correctly, have ham() operate in one namespace and spam() in another. Depending on what's being done, that could be quite harmless, or it could be annoying (no sharing module-level

Re: break in a module

2011-06-16 Thread Ethan Furman
Erik Max Francis wrote: Chris Angelico wrote: On Fri, Jun 17, 2011 at 9:29 AM, Erik Max Francis m...@alcyone.com wrote: Chris Angelico wrote: On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis m...@alcyone.com wrote: It's quite consistent on which control structures you can break out of --

Re: Embedding Python in a shell script

2011-06-16 Thread rusi
On Jun 17, 6:05 am, Chris Angelico ros...@gmail.com wrote: Python call becomes.  I'd prefer something like: #!/bin/bash for i in 1 2 3 4; do   python -c if True: # comfortably indented python code Thanks. Nice! -- http://mail.python.org/mailman/listinfo/python-list

Re: os.path and Path

2011-06-16 Thread Ned Deily
In article ite8950...@news6.newsguy.com, Chris Torek nos...@torek.net wrote: Steven D'Aprano wrote: Why do you think there's no Path object in the standard library? *wink* In article mailman.16.1308239495.1164.python-l...@python.org Ethan Furman et...@stoneleaf.us wrote: Because I can't

Re: break in a module

2011-06-16 Thread Erik Max Francis
Ethan Furman wrote: The Context: It's quite consistent on which control structures you can break out of Hmmm Nope, nothing there to suggest you were talking about the 'break' keyword. That's what I wrote, all right, but not its context. I suspect you're just being difficult. -- Erik

Re: break in a module

2011-06-16 Thread Erik Max Francis
Ian Kelly wrote: On Thu, Jun 16, 2011 at 7:21 PM, Erik Max Francis m...@alcyone.com wrote: Neither makes sense. `break` exits out of looping structures, which the top-level code of a module most certainly is not. Why does that matter? It seems a bit like arguing that the `in` keyword can't

Re: os.path and Path

2011-06-16 Thread rusi
On Jun 17, 7:55 am, Ned Deily n...@acm.org wrote: In article ite8950...@news6.newsguy.com,  Chris Torek nos...@torek.net wrote: Steven D'Aprano wrote: Why do you think there's no Path object in the standard library? *wink* In article mailman.16.1308239495.1164.python-l...@python.org

Re: break in a module

2011-06-16 Thread Ian Kelly
On Thu, Jun 16, 2011 at 10:24 PM, Erik Max Francis m...@alcyone.com wrote: True.  So let's use `in` to represent breaking out of the top-level code of a module.  Why not, it's not the first time a keyword has been reused, right? The point is, if it's not obvious already from that facetious

Re: break in a module

2011-06-16 Thread Ian Kelly
On Thu, Jun 16, 2011 at 10:21 PM, Erik Max Francis m...@alcyone.com wrote: Ethan Furman wrote: The Context: It's quite consistent on which control structures you can break out of Hmmm Nope, nothing there to suggest you were talking about the 'break' keyword. That's what I wrote, all

Re: break in a module

2011-06-16 Thread Erik Max Francis
Ian Kelly wrote: On Thu, Jun 16, 2011 at 10:24 PM, Erik Max Francis m...@alcyone.com wrote: True. So let's use `in` to represent breaking out of the top-level code of a module. Why not, it's not the first time a keyword has been reused, right? The point is, if it's not obvious already from

How do you copy files from one location to another?

2011-06-16 Thread John Salerno
Based on what I've read, it seems os.rename is the proper function to use, but I'm a little confused about the syntax. Basically I just want to write a simple script that will back up my saved game files when I run it. So I want it to copy a set of files/directories from a location on my C:\ drive

[issue6056] socket.setdefaulttimeout affecting multiprocessing Manager

2011-06-16 Thread Derek Wilson
Derek Wilson jderekwil...@gmail.com added the comment: While having multiprocessing use a timeout would be great, I didn't really have the time to fiddle with the c code. Instead of using the socket timeout, I'm modifying all the sockets created by the socket module to have no timeout (and

[issue12345] Add math.tau

2011-06-16 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: -1 -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12345 ___

[issue12346] Python 2.7.2 source code build (release) depends on mercurial

2011-06-16 Thread Graeme Winter
New submission from Graeme Winter xia2.supp...@gmail.com: Trying to build 2.7.2 from source on RHEL5 32 bit get errors: gcc -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE \

[issue12313] make install misses packaging module

2011-06-16 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: It's not packaging-related, but other directories are also missing from LIBSUBDIRS: test/test_email test/test_email/data IMO it's not ideal to use find(1), as in theory a developer may have some directories with matching names in the

[issue12344] A kind of 'reinitialize_command' function which can initialize a command with key-value pair should be added for Command class

2011-06-16 Thread higery
Changes by higery shoulderhig...@gmail.com: -- hgrepos: +28 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12344 ___ ___ Python-bugs-list mailing

[issue12313] make install misses test dirs for packaging and email modules

2011-06-16 Thread Vinay Sajip
Changes by Vinay Sajip vinay_sa...@yahoo.co.uk: -- nosy: +r.david.murray title: make install misses packaging module - make install misses test dirs for packaging and email modules ___ Python tracker rep...@bugs.python.org

[issue12345] Add math.tau

2011-06-16 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: The golden ratio is more commonly denoted with phi (although tau does get used sometimes). Popularity isn't the point though, it's the fact that tau *makes geometric sense* in ways that 2*pi doesn't. --

[issue12346] Python 2.7.2 source code build (release) depends on mercurial

2011-06-16 Thread Graeme Winter
Graeme Winter xia2.supp...@gmail.com added the comment: Some more information: It has picked up that I have mercurial installed: [gw56@ws050 Python-2.7.2_cci]$ cat config.log | grep HG ac_cv_prog_HAS_HG=found HAS_HG='found' HGBRANCH='hg id -b $(srcdir)' HGTAG='hg id -t $(srcdir)'

[issue12345] Add math.tau

2011-06-16 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I like this issue number, but I don't think that Python needs this new constant: it's trivial to add it to your own project. We have pi and e, it's enough. If we begin to add a new constant, others will ask to add much more

[issue12345] Add math.tau

2011-06-16 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Nick, you just have to write: tau = 2 * math.pi and you're done. there are million of other constants Actually, I've heard there are an infinity of them. -- nosy: +pitrou resolution: - rejected status: open - pending

[issue12345] Add math.tau

2011-06-16 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Actually, I've heard there are an infinity of them. Can you prove that? -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12345

[issue12345] Add math.tau

2011-06-16 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12345 ___ ___ Python-bugs-list

[issue12343] Python 2.7.2 regression: ssl.SSLError: [Errno 2] _ssl.c:503: The operation did not complete (read)

2011-06-16 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: This is not a bug. With a non-blocking socket, the handshake itself is non-blocking, so you have to be prepared to retry. Your snippet also fails under Python 2.6 for me, so this isn't a regression either. If you want to know how to do a

[issue12343] Python 2.7.2 regression: ssl.SSLError: [Errno 2] _ssl.c:503: The operation did not complete (read)

2011-06-16 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: I am not getting the error in the handshake. I am getting it when transfering data, after a few Kbytes are already transfered. This code has been working for the last 8 years, including 2.7.1. It is failing now, under 2.7.2. OpenSSL version

[issue12343] Python 2.7.2 regression: ssl.SSLError: [Errno 2] _ssl.c:503: The operation did not complete (read)

2011-06-16 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: I am talking about the code in production, not the code I pasted yesterday. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12343 ___

[issue12343] Python 2.7.2 regression: ssl.SSLError: [Errno 2] _ssl.c:503: The operation did not complete (read)

2011-06-16 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I am not getting the error in the handshake. I am getting it when transfering data, after a few Kbytes are already transfered. Your traceback (and mine as well) occurs in wrap_socket() which itself calls do_handshake(). I don't understand how

[issue12343] Python 2.7.2 regression: ssl.SSLError: [Errno 2] _ssl.c:503: The operation did not complete (read)

2011-06-16 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Ah, ok, looks like your messages crossed each other. Can you try to devise another test case, then? Or, at least, explain the context and how and where it fails? -- ___ Python tracker

[issue12343] Python 2.7.2 regression: ssl.SSLError: [Errno 2] _ssl.c:503: The operation did not complete (read)

2011-06-16 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: Protecting my reads retrying when getting this exception does the trick, but now my code is convoluted and never before I had to manage this directly. This worked fine in 2.7.1. Previously Python seemed to do the retry itself. --

  1   2   >