Re: Run Python script from JS

2011-06-16 Thread Tim Roberts
Gnarlodious wrote: > >Is there any way to call a Py script from Javascript in a webpage? It is POSSIBLE to install Python as an active language, so that Internet Explorer lets you write

Re: break in a module

2011-06-16 Thread Eric Snow
On Thu, Jun 16, 2011 at 11:56 PM, Chris Angelico wrote: > On Fri, Jun 17, 2011 at 3:20 PM, Erik Max Francis wrote: >> Yes, which could be rephrased as the fact that `break` and `continue` are >> restricted to looping control structures, so reusing `break` in this context >> would be a bad idea. >

Re: How do you copy files from one location to another?

2011-06-16 Thread Andrew Berg
On 2011.06.17 12:06 AM, John Salerno wrote: > "On Windows, if dst already exists, OSError will be raised even if it > is a file.." If you try to create a file or directory that already exists on Windows, you'll get a WindowsError with error code 183: >>> os.mkdir('C:\\common\\games') Traceback (mos

Re: break in a module

2011-06-16 Thread Steven D'Aprano
On Thu, 16 Jun 2011 22:20:50 -0700, Erik Max Francis wrote: [...] > Yes, which could be rephrased as the fact that `break` and `continue` > are restricted to looping control structures, so reusing `break` in this > context would be a bad idea. You know, kind of like the exact point I > made earli

Re: break in a module

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 3:20 PM, Erik Max Francis wrote: > Yes, which could be rephrased as the fact that `break` and `continue` are > restricted to looping control structures, so reusing `break` in this context > would be a bad idea. Which is why I believe 'return' would be a better choice, even

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

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 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 pro

Re: break in a module

2011-06-16 Thread Ian Kelly
On Thu, Jun 16, 2011 at 10:21 PM, Erik Max Francis 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, al

Re: break in a module

2011-06-16 Thread Ian Kelly
On Thu, Jun 16, 2011 at 10:24 PM, Erik Max Francis 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 proposal, it's

Re: os.path and Path

2011-06-16 Thread rusi
On Jun 17, 7:55 am, Ned Deily wrote: > In article , >  Chris Torek wrote: > > > >Steven D'Aprano wrote: > > >> Why do you think there's no Path object in the standard library? *wink* > > > In article > > Ethan Furman   wrote: > > >Because I can't find one in either 2.7 nor 3.2, and every referen

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 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 be used for membe

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. -- Eri

Re: os.path and Path

2011-06-16 Thread Ned Deily
In article , Chris Torek wrote: > >Steven D'Aprano wrote: > >> Why do you think there's no Path object in the standard library? *wink* > > In article > Ethan Furman wrote: > >Because I can't find one in either 2.7 nor 3.2, and every reference I've > >found has indicated that the other Path

Re: Embedding Python in a shell script

2011-06-16 Thread rusi
On Jun 17, 6:05 am, Chris Angelico 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: 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 wrote: Chris Angelico wrote: On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis wrote: It's quite consistent on which control structures you can break out of -- it's the looping ones. Plus funct

Re: break in a module

2011-06-16 Thread Ian Kelly
On Thu, Jun 16, 2011 at 7:21 PM, Erik Max Francis 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 constants, e

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 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

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 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 not some_condition:

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 wrote: Chris Angelico wrote: On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis wrote: It's quite consistent on which control structures you can break out of -- it's the looping ones. Plus functions. No: def f(): ...

Re: Embedding Python in a shell script

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 10:57 AM, Jason Friedman 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 python -c "if Tr

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 Ethan Furman wrote: Because I can't find one in either 2.7 nor 3.2, and every reference I've found has indicated that the other Path contenders were too all-encompa

Re: os.path and Path

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 2:32 AM, Christian Heimes 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 Windows pr

Re: break in a module

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 10:48 AM, Steven D'Aprano 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 not some_condition: fro

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 prefe

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 Ethan Furman wrote: >Because I can't find one in either 2.7 nor 3.2, and every reference I've >found has indicated that the other Path contenders were too >all-encompassing. What I t

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

Re: break in a module

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

Re: break in a module

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

Re: break in a module

2011-06-16 Thread Ian Kelly
On Tue, Jun 14, 2011 at 4:57 PM, MRAB 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 me. -- http://

Re: Run Python script from JS

2011-06-16 Thread Chris Rebert
On Thu, Jun 16, 2011 at 3:11 PM, Gnarlodious 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 though. Cheers, Chr

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 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 "", line 2 SyntaxError: 'break' outside loop -- Erik Max F

Re: break in a module

2011-06-16 Thread Chris Angelico
On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis 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: HTTPConncetion - HEAD request

2011-06-16 Thread Ian Kelly
On Thu, Jun 16, 2011 at 4:43 PM, gervaz 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

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/listi

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

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 lookup

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 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. There's nothing

Re: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* srinivas hn [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: > loggi

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 tr

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 wha

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

Re: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* srinivas hn [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) > conn.comm

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 cont

Re: Trapping MySQLdb warnings

2011-06-16 Thread Terry Reedy
On 6/16/2011 3:01 PM, Tim Johnson wrote: * Terry Reedy [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 stdout. No way t

Re: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* Terry Reedy [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: std.debug("e",e,0,0,

[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 inter

Re: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* Terry Reedy [110616 10:50]: > On 6/16/2011 11:55 AM, Tim Johnson wrote: > >* Tim Johnson [110615 18:53]: > >>* geremy condra [110615 18:03]: > >>>On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnson wrote: > Using Python 2.6.5 on linux. > > When using MySQLdb I am getting warnings printe

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, e

Re: Trapping MySQLdb warnings

2011-06-16 Thread Terry Reedy
On 6/16/2011 11:55 AM, Tim Johnson wrote: * Tim Johnson [110615 18:53]: * geremy condra [110615 18:03]: On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnson wrote: Using Python 2.6.5 on linux. When using MySQLdb I am getting warnings printed to stdout, but I would like to trap, display and log tho

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 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 C:\Windows\SysWOW64. Did

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 limit

Re: os.path and Path

2011-06-16 Thread Eric Snow
On Thu, Jun 16, 2011 at 10:41 AM, Steven D'Aprano 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 Windows. > > On a classic Mac (does

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 filename='something.

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 impossib

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 Window

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 o

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 w

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 the

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: Trapping MySQLdb warnings

2011-06-16 Thread Tim Johnson
* Tim Johnson [110615 18:53]: > * geremy condra [110615 18:03]: > > On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnson wrote: > > > Using Python 2.6.5 on linux. > > > > > > When using MySQLdb I am getting warnings printed to stdout, but I would > > > like to trap, display and log those warnings. > <..

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.

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? .

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. http://www.youtub

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

Re: Composing regex from a list

2011-06-16 Thread Vlastimil Brom
2011/6/16 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? > In simple cases, you can just join the list of alternatives on "|" and incorporate it in the pattern

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): alternati

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. -- http://mail.python.org

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 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 -- http:

[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 nonl

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'

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: 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. --

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 McCur

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 wrote: > A

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

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([], dt

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

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 im

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

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: 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

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