Re: print() a list

2009-09-04 Thread Dero
On Sep 5, 2:35 pm, "Mark Tolonen" wrote: > "DarkBlue" wrote in message > > news:b9c0c4ac-5f8f-4133-b928-9e55ab4b2...@x5g2000prf.googlegroups.com... > > > > >I am trying to get used to the new print() syntax prior to installing > > python 3.1: > > > test=[["VG", "Virgin Islands, British"],["VI", "

Re: The future of Python immutability

2009-09-04 Thread Steven D'Aprano
On Fri, 04 Sep 2009 22:30:44 -0700, sturlamolden wrote: > On 5 Sep, 07:04, Steven D'Aprano > wrote: > >> How does Matlab speed compare to Python in general? > > Speed-wise Matlab is slower, but it is not the interpreter limiting the > speed here. How do you know? -- Steven -- http://mail.p

Re: File Handling Problem

2009-09-04 Thread Chris Rebert
On Fri, Sep 4, 2009 at 11:39 PM, SUBHABRATA BANERJEE wrote: > And one small question does Python has any increment operator like ++ in C. No. We do x += 1 instead. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

Re: File Handling Problem

2009-09-04 Thread SUBHABRATA BANERJEE
Dear Sir, Thank you for your kind reply. I would surely check your code. Meanwhile, I solved it using readlines() but not in your way. I will definitely have a look in your code. My solution came so smart that I felt I should not have posted this question. But I would like to know about, i) File

Re: print() a list

2009-09-04 Thread Mark Tolonen
"DarkBlue" wrote in message news:b9c0c4ac-5f8f-4133-b928-9e55ab4b2...@x5g2000prf.googlegroups.com... I am trying to get used to the new print() syntax prior to installing python 3.1: test=[["VG", "Virgin Islands, British"],["VI", "Virgin Islands, U.S."], ["WF", "Wallis and Futuna"],["EH", "We

Re: print() a list

2009-09-04 Thread Mark Tolonen
"DarkBlue" wrote in message news:b9c0c4ac-5f8f-4133-b928-9e55ab4b2...@x5g2000prf.googlegroups.com... I am trying to get used to the new print() syntax prior to installing python 3.1: test=[["VG", "Virgin Islands, British"],["VI", "Virgin Islands, U.S."], ["WF", "Wallis and Futuna"],["EH", "We

print() a list

2009-09-04 Thread DarkBlue
I am trying to get used to the new print() syntax prior to installing python 3.1: test=[["VG", "Virgin Islands, British"],["VI", "Virgin Islands, U.S."], ["WF", "Wallis and Futuna"],["EH", "Western Sahara"],["YE", "Yemen"], ["ZM", "Zambia"],["ZW", "Zimbabwe"],] #old print for z in test: if z[0

Re: possible attribute-oriented class

2009-09-04 Thread Ken Newton
On Fri, Sep 4, 2009 at 9:49 PM, Steven D'Aprano wrote: ... > >> The old discussion, the above link points to, shows that such a >> dot-accessible dict-like class is something that many people need and >> repeatedly implemet it (more or less perfectly) for themselves. > > I think it's something whic

Re: The future of Python immutability

2009-09-04 Thread sturlamolden
On 5 Sep, 07:04, Steven D'Aprano wrote: > How does Matlab speed compare to Python in general? Speed-wise Matlab is slower, but it is not the interpreter limiting the speed here. -- http://mail.python.org/mailman/listinfo/python-list

Re: The future of Python immutability

2009-09-04 Thread sturlamolden
On 5 Sep, 07:04, Steven D'Aprano wrote: > Your code does a lot of unnecessary work if you're just trying to > demonstrate immutability is faster or slower than mutability. No ... I was trying to compute D4 wavelet transforms. I wanted to see how NumPy compared with Matlab. > How does Matlab sp

Re: Application-global "switches"?

2009-09-04 Thread Ethan Furman
kj wrote: I'm looking for the "best-practice" way to define application-global read-only switches, settable from the command line. The best example I can think of of such global switch is the built-in variable __debug__. This variable is visible everywhere in a program, and broadly affects it

expy 0.1.2 released!

2009-09-04 Thread Yingjie Lan
Hi, This is to announce the release of expy 0.1.2 What's new? -- 1. allow both keywords and positional arguments to functions/methods. 2. allow wrapping up your returned value by yourself. (example is provided in tutorial) What is expy? -- expy is an expressway to exte

Re: The future of Python immutability

2009-09-04 Thread Steven D'Aprano
On Fri, 04 Sep 2009 20:48:13 -0700, sturlamolden wrote: > > Is the difference because of mutability versus immutability, or > > because of C code in Numpy versus Matlab code? Are you comparing > > bananas and pears? > > It consisted of something like this Your code does a lot of unnecessary wor

Re: recursive decorator

2009-09-04 Thread sturlamolden
On 4 Sep, 14:50, Michele Simionato wrote: > # requires byteplay by Noam Raphael > # seehttp://byteplay.googlecode.com/svn/trunk/byteplay.py > from byteplay import Code, LOAD_GLOBAL, STORE_FAST, LOAD_FAST Incrediby cool :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: What python can NOT do?

2009-09-04 Thread Steven D'Aprano
On Fri, 04 Sep 2009 22:27:39 -0500, Grant Edwards wrote: >> Take (almost) any arbitrary piece of Python code. Replace all newlines >> by nulls. Escape any quotation marks. Wrap the whole thing in quotes, >> and pass it to exec as above, and you have an arbitrarily complex >> one-liner. > > I don'

Re: possible attribute-oriented class

2009-09-04 Thread Steven D'Aprano
On Fri, 04 Sep 2009 22:37:15 +0200, Jan Kaliszewski wrote: > Named tuples (which indeed are really very nice) are read-only, but the > approach they represent could (and IMHO should) be extended to some kind > of mutable objects. What do you mean "read-only"? Do you mean immutable? What sort of

Re: Usage of main()

2009-09-04 Thread alex23
Carl Banks wrote: > Sorry, alex, unfortunately you are wrong, although it's understandable > that you've missed this. > [...] > The speedup comes because local lookups are much faster.  Accessing a > local is a simple index operation, and a nonlocal is a pointer deref > or two, then an indexing.  

Re: recursive decorator

2009-09-04 Thread Michele Simionato
On Sep 4, 7:03 pm, Ethan Furman wrote: > Just to verify, using the decorator module is portable, yes? Yes, it is portable. BTW, here is what you want to do (requires decorator-3.1.2): from decorator import FunctionMaker def bindfunc(f): name = f.__name__ signature = ', '.join(FunctionM

Re: The future of Python immutability

2009-09-04 Thread Steven D'Aprano
On Fri, 04 Sep 2009 06:36:59 -0700, Adam Skutt wrote: > Nope, preventing mutation of the objects themselves is not enough. You > also have to forbid variables from being rebound (pointed at another > object). Consider this simple example: > > -- Thread 1 -- | -- Thread 2

Re: The future of Python immutability

2009-09-04 Thread sturlamolden
On 5 Sep, 05:12, Steven D'Aprano wrote: > Is the difference because of mutability versus immutability, or because > of C code in Numpy versus Matlab code? Are you comparing bananas and > pears? It consisted of something like this import numpy def D4_Transform(x, s1=None, d1=None, d2=None):

Re: What python can NOT do?

2009-09-04 Thread Grant Edwards
On 2009-09-05, Steven D'Aprano wrote: > On Fri, 04 Sep 2009 08:21:15 -0700, Mike Coleman wrote: > >> It is true, though, that Python >> cannot be used to write arbitrarily complex one-liners, though. > > Incorrect. > exec "x=1\0while x < 5:\0 x+=1\0print x".replace('\0','\n') > 5 > > Take (a

Re: How to download directly to a file?

2009-09-04 Thread Chris Rebert
On Fri, Sep 4, 2009 at 4:35 PM, kj wrote: > In <7gdgslf2ogf8...@mid.uni-berlin.de> "Diez B. Roggisch" > writes: > >>kj schrieb: >>> I want to send a POST request and have the returned content put >>> directly into a file.  Is there a way to do this easily in Python? >>> I've been looking at the d

Re: What python can NOT do?

2009-09-04 Thread Steven D'Aprano
On Fri, 04 Sep 2009 08:21:15 -0700, Mike Coleman wrote: > It is true, though, that Python > cannot be used to write arbitrarily complex one-liners, though. Incorrect. >>> exec "x=1\0while x < 5:\0 x+=1\0print x".replace('\0','\n') 5 Take (almost) any arbitrary piece of Python code. Replace all

Re: The future of Python immutability

2009-09-04 Thread Steven D'Aprano
On Fri, 04 Sep 2009 19:23:06 -0700, sturlamolden wrote: > I one did a test of NumPy's mutable arrays against Matlab's immutable > arrays on D4 wavelet transforms. On an array of 64 MB of double > precision floats, the Python/NumPy version was faster by an order of > magnitude. Is the difference b

Re: pexpect and unicode strings

2009-09-04 Thread Sean DiZazzo
On Sep 4, 7:11 pm, Mathew Oakes wrote: > Is there anything that can be done to make pexpect spawns send unicode lines? > > In this example they are just middot characters, but this process > needs to be able to handle languages in other character sets. > > >>> spokentext = u'Nation . Search the FO

Re: The future of Python immutability

2009-09-04 Thread sturlamolden
On 3 Sep, 20:03, John Nagle wrote: >      Python doesn't have immutable objects as a general concept, but > it may be headed in that direction.  There was some fooling around > with an "immmutability API" associated with NumPy back in 2007, but > that was removed.  As more immutable types are add

SEI Job Opening

2009-09-04 Thread bilawal samoon
SEI is seeking a FT, YR Photovoltaic Technical Manager. If you are a team player with a minimum of 4 years PV installation, curriculum and education development, management experience, the ability to multitask, strong verbal and written communication skills, and a sense of humor, SEI invites you to

Two schools in Argentina provide model for Jewish education

2009-09-04 Thread bilawal samoon
BUENOS AIRES, Argentina (JTA) -- The old Citroen on the campus of one of ORT’s two schools in Buenos Aires sits stripped to a skeleton, its doors removed, dangling wires spilling out of the dashboard. For more details www.technicaledu.blogspot.com -- http://mail.python.org/mailman/listinfo/python-

pexpect and unicode strings

2009-09-04 Thread Mathew Oakes
Is there anything that can be done to make pexpect spawns send unicode lines? In this example they are just middot characters, but this process needs to be able to handle languages in other character sets. >>> spokentext = u'Nation . Search the FOX Nation . czars \xb7 Health care >>> \xb7 t

Re: The future of Python immutability

2009-09-04 Thread sturlamolden
On 4 Sep, 06:20, John Nagle wrote: > > In the current CPython implementation, every object has a reference > > count, even immutable ones. This must be a writable field - and here you > > have your race condition, even for immutable objects. > >     That's an implementation problem with CPython.

Re: Annoying octal notation

2009-09-04 Thread NevilleDNZ
On Sep 3, 2:57 pm, James Harris wrote: > On 3 Sep, 14:26, Albert van der Horst > wrote: > > > In article > > <6031ba08-08c8-416b-91db-ce8ff57ae...@w6g2000yqw.googlegroups.com>, > > James Harris   wrote: > > > > > >So you are saying that Smalltalk has r where > > >r is presumably for radix? That

Re: global variable not working inside function. Increment

2009-09-04 Thread Helvin Lui
Wow!!! Thanks a million!! It worked! = DThanks for the fast reply too! Helvin On Sat, Sep 5, 2009 at 11:52 AM, Rami Chowdhury wrote: >global no_picked >>no_picked = 0 >> >>def picked(object, event): >> no_picked += 1 >> print no_picked >> > > In order to be able t

Re: global variable not working inside function. Increment

2009-09-04 Thread Rami Chowdhury
global no_picked no_picked = 0 def picked(object, event): no_picked += 1 print no_picked In order to be able to affect variables in the global scope, you need to declare them global inside the function, and not at the global scope. So your code should read:

global variable not working inside function. Increment

2009-09-04 Thread Helvin
Hi, This increment thing is driving me nearly to the nuts-stage. > < I have a function that allows me to pick points. I want to count the number of times I have picked points. global no_picked no_picked = 0 def picked(object, event): no_picked += 1 print no_picke

Re: How to download directly to a file?

2009-09-04 Thread kj
In <7gdgslf2ogf8...@mid.uni-berlin.de> "Diez B. Roggisch" writes: >kj schrieb: >> I want to send a POST request and have the returned content put >> directly into a file. Is there a way to do this easily in Python? >> I've been looking at the documentation for urllib2, but I can't >> see a dire

Re: setting Referer for urllib.urlretrieve

2009-09-04 Thread E
On Aug 10, 10:21 am, samwyse wrote: > On Aug 9, 9:41 am, Steven D'Aprano > cybersource.com.au> wrote: > > On Sun, 09 Aug 2009 06:13:38 -0700,samwysewrote: > > > Here's what I have so far: > > > > import urllib > > > > class AppURLopener(urllib.FancyURLopener): > > >     version = "App/1.7" > > >

Re: incorrect DeprecationWarning?

2009-09-04 Thread Terry Reedy
Alan G Isaac wrote: Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. class MyError(Exception): ... def __init__(self, message): ... Exception.__init__(self) ... self.

Problems with hex-conversion functions

2009-09-04 Thread Arnon Yaari
Hello everyone. Perhaps I'm missing something, but I see several problems with the two hex-conversion function pairs that Python offers: 1. binascii.hexlify and binascii.unhexlify 2. bytes.fromhex and bytes.hex Problem #1: bytes.hex is not implemented, although it was specified in PEP 358. This me

incorrect DeprecationWarning?

2009-09-04 Thread Alan G Isaac
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. class MyError(Exception): ... def __init__(self, message): ... Exception.__init__(self) ... self.message = message ...

Re: How to download directly to a file?

2009-09-04 Thread Diez B. Roggisch
kj schrieb: I want to send a POST request and have the returned content put directly into a file. Is there a way to do this easily in Python? I've been looking at the documentation for urllib2, but I can't see a direct way to do this, other than saving the returned contents to an in-memory varia

How to download directly to a file?

2009-09-04 Thread kj
I want to send a POST request and have the returned content put directly into a file. Is there a way to do this easily in Python? I've been looking at the documentation for urllib2, but I can't see a direct way to do this, other than saving the returned contents to an in-memory variable and wri

Compiler.ast helper function "literal_eval" in python 2.4

2009-09-04 Thread Sean Talts
Hi, I'm trying to parse some python with the compiler module, select a subset of the AST returned, and then evaluate that subset, all in python 2.4. It seems like in python 2.6 the compiler.ast.literal_eval function may be what I'm looking for, but unfortunately for my project we are restricted t

Re: Subclassing list and splicing

2009-09-04 Thread Nobody
On Thu, 03 Sep 2009 17:10:12 +, Kreso wrote: > I would prefer that resulting object m belonged to myclist class. > How to obtain such behaviour? Must I somehow implement __getslice__ > method myself? Yes; you should also implement __getitem__(), as this is used for extended slices. -- http:

Re: obscure problem using elementtree to make xhtml website

2009-09-04 Thread Nobody
On Fri, 04 Sep 2009 13:21:54 +0200, Stefan Behnel wrote: Not a bug in IE (this time), which is correctly parsing the file as html. >>> ... which is obviously not the correct thing to do when it's XHTML. >> >> It isn't though; it's HTML with a XHTML DOCTYPE > > Not the page I look at (i.e. t

Re: Running Sum script

2009-09-04 Thread Chris Rebert
On Fri, Sep 4, 2009 at 1:49 PM, <><><><> wrote: > On Sep 4, 4:37 pm, Maggie wrote: >> On Sep 4, 4:37 pm, Tobiah wrote: >> >> > > in the terminal i get a very strange "permission denied" error that might >> > > not have anything to do with the code. I checked permissions for the file >> > > and th

Re: [Python-ideas] possible attribute-oriented class

2009-09-04 Thread George Sakkis
On Fri, Sep 4, 2009 at 4:37 PM, Jan Kaliszewski wrote: > 04-09-2009 Ken Newton wrote: > >> I like this version very much. I'm ready to put this into practice to see >> how it works in practice. > > [snip] > > Not only you (Ken) and me. :-) It appears that the idea is quite old. Nick > Coghlan repl

Re: Problem w/ mysqldump

2009-09-04 Thread Victor Subervi
I got essentially the same printout. There were the following, among many others: mysqldump.exe mysqldump.pdb What's a *.pdb file? Don't know it matters. If there were just some darn way to know where that daggone database is, I could copy it and move it to another machine. TIA, V On Thu, Sep 3, 2

Re: Support for Windows 7 ?

2009-09-04 Thread Martin P. Hellwig
Michel Claveau - MVP wrote: Du coup, j'ai envie de déduire : - Que certains étudiants d'écoles de commerce françaises préfèrent travailler avec "l'étranger" plutôt qu'avec "le français". - Il faudra dire à d'autres étudiants d'écoles de commerce françaises que le fait de ne pas arriver/sav

Re: Running Sum script

2009-09-04 Thread <><><><>
On Sep 4, 4:37 pm, Maggie wrote: > On Sep 4, 4:37 pm, Tobiah wrote: > > > > in the terminal i get a very strange "permission denied" error that might > > > not have anything to do with the code. I checked permissions for the file > > > and they are set to "read and write" so, again, I am really n

Re: How to access ODBC databases ?

2009-09-04 Thread Martin P. Hellwig
Timothy Madden wrote: Martin P. Hellwig wrote: Timothy Madden wrote: >>> conn = pyodbc.connect('DRIVER={PostgreSQL Unicode};Servername=127.0.0.1;UID=pikantBlue;Database=pikantBlue') Traceback (most recent call last): File "", line 1, in pyodbc.Error: ('0', '[0] [nxDC (202) (SQLDriverCo

Re: Running Sum script

2009-09-04 Thread Rami Chowdhury
try it where? code or terminal? Please try these in the terminal -- the permission denied error may be due to your shell not being able to execute the Python script, instead of your Python script not being able to open the data file. On Fri, 04 Sep 2009 13:37:10 -0700, Maggie wrote: On

Re: Application-global "switches"?

2009-09-04 Thread Ethan Furman
ici wrote: On Sep 4, 9:29 pm, kj wrote: I'm looking for the "best-practice" way to define application-global read-only switches, settable from the command line. The best example I can think of of such global switch is the built-in variable __debug__. This variable is visible everywhere in a

Re: Running Sum script

2009-09-04 Thread Maggie
On Sep 4, 4:37 pm, Tobiah wrote: > > in the terminal i get a very strange "permission denied" error that might > > not have anything to do with the code. I checked permissions for the file > > and they are set to "read and write" so, again, I am really not sure what > > going wrong. > > Try: > >

Re: Running Sum script

2009-09-04 Thread Tobiah
> in the terminal i get a very strange "permission denied" error that might > not have anything to do with the code. I checked permissions for the file > and they are set to "read and write" so, again, I am really not sure what > going wrong. Try: python myfile Or chmod +x myf

Re: possible attribute-oriented class

2009-09-04 Thread Jan Kaliszewski
04-09-2009 Ken Newton wrote: I like this version very much. I'm ready to put this into practice to see how it works in practice. [snip] Not only you (Ken) and me. :-) It appears that the idea is quite old. Nick Coghlan replied at python-id...@python.org: Jan Kaliszewski wrote: What do you

Re: cross platform distribution

2009-09-04 Thread ianaré
These are all good suggestions. I just wanted to add that you can distribute pre-built Linux packages for the most popular distros like one for RHEL/Centos/Fedora as RPM and one for Debian/Ubuntu as DEB. Any C code in them would be compiled. On Sep 4, 9:33 am, Philip Semanchuk wrote: > On Sep 4,

Re: cross platform distribution

2009-09-04 Thread vpr
On Sep 4, 3:33 pm, Philip Semanchuk wrote: > On Sep 4, 2009, at 9:24 AM, vpr wrote: > > > > > On Sep 4, 3:19 pm, Philip Semanchuk wrote: > >> On Sep 4, 2009, at 4:44 AM, vpr wrote: > > >>> Hi All > > >>> After a couple of experiments, searching around and reading Steve > >>> Holden's lament about

Re: Running Sum script

2009-09-04 Thread Juli Dolzhenko
On Sep 4, 2:52 pm, "Rami Chowdhury" wrote: > Could you let us know what kind of error you are getting? > > I don't know if this is your error, but this line won't run: > > > readData = formisanoOpen.readLines() > > Since Python is case-sensitive, you would need a lower-case 'l' in > 'readlines()'

Re: How to access ODBC databases ?

2009-09-04 Thread Timothy Madden
Martin P. Hellwig wrote: Timothy Madden wrote: >>> conn = pyodbc.connect('DRIVER={PostgreSQL Unicode};Servername=127.0.0.1;UID=pikantBlue;Database=pikantBlue') Traceback (most recent call last): File "", line 1, in pyodbc.Error: ('0', '[0] [nxDC (202) (SQLDriverConnectW)') Not sure (i

Re: Application-global "switches"?

2009-09-04 Thread ici
On Sep 4, 9:29 pm, kj wrote: > I'm looking for the "best-practice" way to define application-global > read-only switches, settable from the command line.  The best > example I can think of of such global switch is the built-in variable > __debug__.  This variable is visible everywhere in a program

Re: Running Sum script

2009-09-04 Thread Rami Chowdhury
Could you let us know what kind of error you are getting? I don't know if this is your error, but this line won't run: readData = formisanoOpen.readLines() Since Python is case-sensitive, you would need a lower-case 'l' in 'readlines()' -- perhaps that would solve your problem? On Fri, 04

Re: Running Sum script

2009-09-04 Thread David Smith
Jul wrote: > On Sep 4, 2:21 pm, Stephen Fairchild wrote: >> Jul wrote: >>> hello, >>> I have a .txt file that is in this format -- >>> 12625 >>> 17000 >>> 12000 >>> 14500 >>> 17000 >>> 12000 >>> 17000 >>> 14500 >>> 14500 >>> 12000 >>> ...and so on... >>> i need to create a python script that will

Re: Application-global "switches"?

2009-09-04 Thread Terry Reedy
kj wrote: I'm looking for the "best-practice" way to define application-global read-only switches, settable from the command line. The best example I can think of of such global switch is the built-in variable __debug__. This variable is visible everywhere in a program, and broadly affects it

Application-global "switches"?

2009-09-04 Thread kj
I'm looking for the "best-practice" way to define application-global read-only switches, settable from the command line. The best example I can think of of such global switch is the built-in variable __debug__. This variable is visible everywhere in a program, and broadly affects its operation

Re: Running Sum script

2009-09-04 Thread Jul
On Sep 4, 2:21 pm, Stephen Fairchild wrote: > Jul wrote: > > hello, > > > I have a .txt file that is in this format -- > > > 12625 > > 17000 > > 12000 > > 14500 > > 17000 > > 12000 > > 17000 > > 14500 > > 14500 > > 12000 > > ...and so on... > > > i need to create a python script that will open thi

Re: Support for Windows 7 ?

2009-09-04 Thread Martin v. Löwis
> Given that the problem is with reading the file system, it is likely to > be w/ sth else > > than Windows 7, maybe some weird HD partition combination? Without having seen any details, I refuse to guess. Most likely, it is a user mistake. Regards, Martin -- http://mail.python.org/mailman/lis

Re: Running Sum script

2009-09-04 Thread Stephen Fairchild
Jul wrote: > hello, > > I have a .txt file that is in this format -- > > 12625 > 17000 > 12000 > 14500 > 17000 > 12000 > 17000 > 14500 > 14500 > 12000 > ...and so on... > > i need to create a python script that will open this file and have a > running sum until the end of file. Untested: with

Re: logger module : Question about log message format

2009-09-04 Thread Kev Dwyer
On Fri, 04 Sep 2009 12:34:32 +0100, jorma kala wrote: > Hi, > I've created a logger like this: > > > LOG_FILENAME = 'test.txt' > fh=logging.FileHandler(LOG_FILENAME,'w') logger1 = > logging.getLogger('myLogger1') logger1.addHandler(fh) > logger1.setLevel(logging.INFO) > logger1.info('message fro

Re: recursive decorator

2009-09-04 Thread Ethan Furman
Michele Simionato wrote: On Sep 3, 6:41 pm, Ethan Furman wrote: The original thread by Bearophile: http://mail.python.org/pipermail/python-list/2009-May/711848.html I have read the thread. What Bearophile wants can be implemented with a bytecode hack, no need for the decorator module. Let

Re: Support for Windows 7 ?

2009-09-04 Thread Pascale Mourier
Martin v. Löwis a écrit : If there is a specific problem, we would need a specific test case, to be reported to bugs.python.org. Tks for the name above. I asked my student to prepare the bug demo package, but I didn't know how to send it! Given that the problem is with reading the file syst

Re: Support for Windows 7 ?

2009-09-04 Thread Martin v. Löwis
> On of my students has installed Windows 7 RTM on his cherished computer, > and claims that Python 2.6.2 doesn't support it. > The sample program had a problem with the library function > os.listdir(dirarg) always returning the same result for different values > of dirarg. > > DO YOU KNOW HOW FAR

Re: Running Sum script

2009-09-04 Thread David Smith
Jul wrote: > hello, > > I have a .txt file that is in this format -- > > 12625 > 17000 > 12000 > 14500 > 17000 > 12000 > 17000 > 14500 > 14500 > 12000 > ...and so on... > > i need to create a python script that will open this file and have a > running sum until the end of file. > > it sounds re

Running Sum script

2009-09-04 Thread Jul
hello, I have a .txt file that is in this format -- 12625 17000 12000 14500 17000 12000 17000 14500 14500 12000 ...and so on... i need to create a python script that will open this file and have a running sum until the end of file. it sounds really simple its just for some reason i am having pr

Re: possible attribute-oriented class

2009-09-04 Thread Ken Newton
I like this version very much. I'm ready to put this into practice to see how it works in practice. A minor point: I envision this to be used in a context where all key values are strings (legal attribute identifiers). But constructing an AttrClass from a dict or setting values directly with the

Re: File Handling Problem

2009-09-04 Thread Rami Chowdhury
No: readlines () retains the "\n"s; splitlines () loses them Ah, thank you for the clarification! On Fri, 04 Sep 2009 08:39:37 -0700, Tim Golden wrote: Rami Chowdhury wrote: f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the

Support for Windows 7 ?

2009-09-04 Thread Pascale Mourier
Hello, I don't know how to report presumed "bugs" to the Python development team.. in the past, the very few bugs I found were always fixed by a more recent version. On of my students has installed Windows 7 RTM on his cherished computer, and claims that Python 2.6.2 doesn't support it. The

[ANN] Athens Python User Group - Meeting September 9, 2009, 19:00.

2009-09-04 Thread Orestis Markou
== Announcing the 1st meeting of the Athens Python User Group == If you live near Athens, Greece and are interested in meeting fellow Python programmers, meet us for a friendly chat at the Eleftheroudakis Bookstore café, on Wednesday 9 September, 7:00pm. If you plan to attend, please add a

Re: Why does this group have so much spam?

2009-09-04 Thread Ethan Furman
Steven D'Aprano wrote: On Thu, 03 Sep 2009 16:01:26 -0700, Ethan Furman wrote: Steven D'Aprano wrote: On Thu, 03 Sep 2009 12:19:48 -0700, Ethan Furman wrote: Steven D'Aprano wrote: On Thu, 03 Sep 2009 04:01:54 -0400, Terry Reedy wrote: ISP's price residential service based on ave

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-04 Thread Scott David Daniels
The Music Guy wrote: I have a peculiar problem that involves multiple inheritance and method calling. I have a bunch of classes, one of which is called MyMixin and doesn't inherit from anything. MyMixin expects that it will be inherited along with one of several other classes that each define ce

multiprocessing: Correct usage of pool & queue?

2009-09-04 Thread Allen Fowler
Hello, I have a list of tasks/items that I want handed off to threads/processes to complete. (I would like to stick with process if I could, since there is some CPU work here. ) Each task involves some calculations and a call to a remote server over urllib2/HTTP. The time to complete each ta

retrieving real time quotes from yahoo

2009-09-04 Thread ss
Hello, ive started using python for a few weeks now, and came across a problem that i would appreciate help solving. im trying to create code which can grab real time quotes from yahoo (yes ive created an account for yahoo finance). But im not sure how to generate an authenticated login and how t

Re: Usage of main()

2009-09-04 Thread Scott David Daniels
Carl Banks wrote: On Sep 3, 11:39 pm, Simon Brunning wrote: 2009/9/4 Manuel Graune : How come the main()-idiom is not "the standard way" of writing a python-program (like e.g. in C)? Speaking for myself, it *is* the standard way to structure a script. I find it more readable, since I can put

Re: What python can NOT do?

2009-09-04 Thread MRAB
Mike Coleman wrote: On Aug 28, 5:37 pm, qwe rty wrote: i know that an interpreted language like python can't be used to make an operating system or system drivers. what else can NOT be done in python? what are the limitations of the language? Neither of those is strictly true. It is true, t

Re: File Handling Problem

2009-09-04 Thread Tim Golden
Rami Chowdhury wrote: f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the same thing IIRC? No: readlines () retains the "\n"s; splitlines () loses them TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: How to access ODBC databases ?

2009-09-04 Thread Martin P. Hellwig
Timothy Madden wrote: >>> conn = pyodbc.connect('DRIVER={PostgreSQL Unicode};Servername=127.0.0.1;UID=pikantBlue;Database=pikantBlue') Traceback (most recent call last): File "", line 1, in pyodbc.Error: ('0', '[0] [nxDC (202) (SQLDriverConnectW)') Not sure (i.e. wild guess) but that l

Re: File Handling Problem

2009-09-04 Thread Rami Chowdhury
f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the same thing IIRC? On Fri, 04 Sep 2009 07:46:42 -0700, Stephen Fairchild wrote: joy99 wrote: Dear Group, I have a file. The file has multiple lines. I want to get the line numb

Re: possible attribute-oriented class

2009-09-04 Thread Scott David Daniels
Ken Newton wrote: ... I would appreciate comments on this code. First, is something like this already done? Second, are there reasons for not doing this? ... class AttrClass(object): ... def __repr__(self): return "%s(%s)" % (self.__class__.__name__, self.__dict__.__repr__()

Re: What python can NOT do?

2009-09-04 Thread Mike Coleman
On Aug 28, 5:37 pm, qwe rty wrote: > i know that an interpreted language like python can't be used to make > an operating system or system drivers. > > what else can NOT be done in python? what are the limitations of the > language? Neither of those is strictly true. It is true, though, that Pyt

Re: The future of Python immutability

2009-09-04 Thread Scott David Daniels
John Nagle wrote: ... Suppose, for discussion purposes, we had general "immutable objects". Objects inherited from "immutableobject" instead of "object" would be unchangeable once "__init__" had returned. Where does this take us? Traditionally in Python we make that, "once __new__ had returned

Re: possible attribute-oriented class

2009-09-04 Thread Colin J. Williams
Jan Kaliszewski wrote: [originally from python-list@python.org, crossposted to python-id...@python.org] 04-09-2009 o 00:46:01 Ken Newton wrote: I have created the following class definition with the idea of making a clean syntax for non-programmers to created structured data within a python

Re: File Handling Problem

2009-09-04 Thread Lucas Prado Melo
On Fri, Sep 4, 2009 at 9:50 AM, joy99 wrote: > Dear Group, > > I have a file. The file has multiple lines. I want to get the line > number of any one of the strings. > Once I get that I like to increment the line number and see the string > of the immediate next line or any following line as outp

Re: File Handling Problem

2009-09-04 Thread Stephen Fairchild
joy99 wrote: > Dear Group, > > I have a file. The file has multiple lines. I want to get the line > number of any one of the strings. > Once I get that I like to increment the line number and see the string > of the immediate next line or any following line as output. The > problem as I see is ni

How to access ODBC databases ?

2009-09-04 Thread Timothy Madden
Hello I would like to use a database through ODCB in my python application. I have Slackware Linux, but I would not mind a portable solution, since python runs on both Unixes and Windows. I would like a free/open-source solution and the python module for ODBC access that I have found is *pyo

Re: python daemon - compress data and load data into MySQL by pyodbc

2009-09-04 Thread MacRules
Dennis Lee Bieber wrote: On Thu, 03 Sep 2009 14:43:40 -0400, MacRules declaimed the following in gmane.comp.python.general: Oracle DB in data center 1 (LA, west coast) MSSQL DB in data center 2 (DC, east coast) Note that your thread subject line states MySQL... There is a big differe

Re: The future of Python immutability

2009-09-04 Thread Adam Skutt
On Sep 3, 2:03 pm, John Nagle wrote: >      Suppose, for discussion purposes, we had general "immutable objects". > Objects inherited from "immutableobject" instead of "object" would be > unchangeable once "__init__" had returned.  Where does this take us? You can create this in various ways thro

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-04 Thread Sverker Nilsson
On Fri, 2009-09-04 at 15:25 +0200, Sverker Nilsson wrote: > > However, I am aware of the extra initial overhead to do h=hpy(). I > discussed this in my thesis. "Section 4.7.8 Why not importing Use > directly?" page 36, > > http://guppy-pe.sourceforge.net/heapy-thesis.pdf Actually it is describ

Re: using queue

2009-09-04 Thread MRAB
Tim Arnold wrote: "Jan Kaliszewski" wrote in message news:mailman.895.1251958800.2854.python-l...@python.org... 06:49:13 Scott David Daniels wrote: Tim Arnold wrote: (1) what's wrong with having each chapter in a separate thread? Too much going on for a single processor? Many more threads

Re: cross platform distribution

2009-09-04 Thread Philip Semanchuk
On Sep 4, 2009, at 9:24 AM, vpr wrote: On Sep 4, 3:19 pm, Philip Semanchuk wrote: On Sep 4, 2009, at 4:44 AM, vpr wrote: Hi All After a couple of experiments, searching around and reading Steve Holden's lament about bundling and ship python code, I thought I'd direct this to to the gro

Re: Video?

2009-09-04 Thread David C . Ullrich
On Thu, 3 Sep 2009 16:24:44 -0700 (PDT), Che M wrote: >On Sep 3, 4:11 pm, David C Ullrich wrote: >> Not at all important, just for fun (at least for me): >> >> It seems to me, looking at various docs, that wxWidgets >> includes a "media control" that can play video files, but >> it's not include

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-04 Thread Sverker Nilsson
On Thu, 2009-09-03 at 10:05 +0100, Chris Withers wrote: > Raymond Hettinger wrote: > > In the first case, you would write: > >sets.extend(h.load(f)) > > yes, what I had was: > > for s in iter(h.load(f)): sets.append(s) > > ...which I mistakenly thought was working, but in in fact boils down

  1   2   >