Re: Annoying octal notation

2009-08-25 Thread Mensanator
On Aug 24, 10:20�pm, Erik Max Francis m...@alcyone.com wrote: Steven D'Aprano wrote: On Mon, 24 Aug 2009 09:14:25 -0500, Derek Martin wrote: Assuming I'm right about that, then the use of a leading 0 to represent octal actually predates the prevalence of using 0 in dates by almost two

Re: your favorite debugging tool?

2009-08-25 Thread Robert Marshall
On 24 Aug 2009, Paul Rubin wrote: Esmail ebo...@hotmail.com writes: What is your favorite tool to help you debug your code? I've been getting along with 'print' statements but that is getting old and somewhat cumbersome. Beyond print statements, I use pdb a lot. Winpdb (www.winpdb.org) is

Re: Python 2.6 still not giving memory back to the OS...

2009-08-25 Thread John Machin
On Aug 25, 2:08 am, Chris Withers ch...@simplistix.co.uk wrote: Martin v. Löwis wrote: Today, there are two cases when malloc returns memory on a typical Unix system (in particular, in Linux malloc): a) if the malloc block block is small (below page size), it is allocated    from the brk

Re: best way to display photos

2009-08-25 Thread Thomas Guettler
Some years ago I had the same problem. I wrote a simple app with pygtk. You get get it from here: http://guettli.sourceforge.net/gthumpy/src/README.html The next pictures get loaded in background. Switching from one image to the next is faster then in some other apps. But somehow it is not

Re: elementtree

2009-08-25 Thread Nadia Johnson
On Aug 24, 7:29 pm, Dave Angel da...@ieee.org wrote: Stefan Behnel wrote: Hi, elsa wrote: I know how to turn HTML into an ElementTree object I don't. ;) ElementTree doesn't have an HTML parser, so what do you use for parsing? but I don't know how to then view the structure of

Re: Python memory management - virtualized server environments

2009-08-25 Thread gravityzoo-dmo
On 24 aug, 20:35, Martin P. Hellwig martin.hell...@dcuktec.org wrote: gravityzoo-dmo wrote: Hello everyone, I was wondering if anyone here has had any experience in running Python in a virtualized server environment? The reason I'm asking is the recent thing I noticed when running my

Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread Peter Otten
Matjaz Bezovnik wrote: This is something which is done often in FEM methods, and the alike. I have matrix A of 3x3 elements, and B, of the same number of elements, 3x3. What would be the most obvious way to assemble a matrix which: a11 a12 a13 a21 a22 a23 a31 a32 a33+b11 b12 b13

Re: Python memory management - virtualized server environments

2009-08-25 Thread Martin P. Hellwig
gravityzoo-dmo wrote: On 24 aug, 20:35, Martin P. Hellwig martin.hell...@dcuktec.org wrote: gravityzoo-dmo wrote: Hello everyone, I was wondering if anyone here has had any experience in running Python in a virtualized server environment? The reason I'm asking is the recent thing I noticed

matplotlib / backend

2009-08-25 Thread Pierre
Hello, I'm to plot some results but it doesn't work. I got this error : /usr/local/libre_rep/python-2.6.1/RHEL_5__x86_64/lib/python2.6/site- packages/matplotlib/backends/__init__.py:41: UserWarning: Your currently selected backend, 'agg' does not support show(). Please select a GUI backend in

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-25 Thread James Harris
On 25 Aug, 01:25, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 24 Aug 2009 16:23:06 -0700, James Harris wrote: Sure but while I wouldn't normally want to type something as obscure as 32rst into a file of data I might want to type 0xff00 or similar. That is far

Re: Protecting against callbacks queuing up?

2009-08-25 Thread Hendrik van Rooyen
On Monday 24 August 2009 17:32:23 Esben von Buchwald wrote: Hendrik van Rooyen wrote: 8 -- some stuff about an after call -- I'm new to python, what is an after function and an after call? Couldn't find excact answer on google...? Do you have a link to some

os.popen output different from native shell output

2009-08-25 Thread nickname
Hi all, I am a relative newbie to python, I am using os.popen to run an ls command. The output that I get using the read() function is different in look and feel from when I run the ls command natively from the shell (not via python). I display the ouput via python by using the print

Re: os.popen output different from native shell output

2009-08-25 Thread Chris Rebert
On Tue, Aug 25, 2009 at 1:36 AM, nicknamethebiggestbangthe...@gmail.com wrote: Hi all,       I am a relative newbie to python, I am using os.popen to run an ls command. The output that I get using the read() function is different in look and feel from when I run the ls command natively from

Re: Questions on XML

2009-08-25 Thread SUBHABRATA BANERJEE
I was trying this. Looks perfectly fine. There must be something really wrong. If you can reinstall Python 2.5. a1=raw_input(String) Stringআম On Mon, Aug 24, 2009 at 12:18 AM, Rami Chowdhury rami.chowdh...@gmail.comwrote: My problem is with IDLE on Windows. When I try to type Bangla directly

Re: matplotlib / backend

2009-08-25 Thread baloan
On Aug 25, 10:12 am, Pierre pierre.gaill...@gmail.com wrote: Hello, I'm to plot some results but it doesn't work. I got this error : /usr/local/libre_rep/python-2.6.1/RHEL_5__x86_64/lib/python2.6/site- packages/matplotlib/backends/__init__.py:41: UserWarning: Your currently selected

Re: os.popen output different from native shell output

2009-08-25 Thread Thomas Guettler
hi, you get the popen output like this: u...@unixhost ls | cat nickname schrieb: Hi all, I am a relative newbie to python, I am using os.popen to run an ls command. The output that I get using the read() function is different in look and feel from when I run the ls command natively

Re: your favorite debugging tool?

2009-08-25 Thread Michele Simionato
On Aug 22, 4:25 pm, Esmail ebo...@hotmail.com wrote: Hi all, What is your favorite tool to help you debug your code? The times when I would just use 'print' are long past. Nowadays I spend lots of my time with code written by others than myself. I use pdb all the time, and now also ipdb (ipdb

Re: print() and unicode strings (python 3.1)

2009-08-25 Thread 7stud
On Aug 24, 10:09 pm, Ned Deily n...@acm.org wrote: In article e5e2ec2e-2b4a-4ca8-8c0f-109e5f4eb...@v23g2000pro.googlegroups.com, 7stud bbxx789_0...@yahoo.com wrote: On Aug 24, 2:41 pm, Martin v. Löwis mar...@v.loewis.de wrote: I can't figure out a way to programatically set the

unexpected token `;'

2009-08-25 Thread bbarbero
Hello to all! I am struggling with a script in python for a while now, and decided to look for some help. I am running a code that takes commands from Marsyas(open source for Music analysis). #!/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 #!/bin/bashimport math import re

Re: unexpected token `;'

2009-08-25 Thread mmelchert
bbarb...@inescporto.pt wrote: Hello to all! I am struggling with a script in python for a while now, and decided to look for some help. I am running a code that takes commands from Marsyas(open source for Music analysis). #!/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6

PyCon 2010 - Call for Tutorials

2009-08-25 Thread Greg Lindstrom
The period to submit proposals for PyCon 2010 in Atlanta, Georgia (USA) is now open and will close on October 18. Tutorials are 3-hour long classes on a specific Python technique, package or technology and are taught by members of the Python community. If you have knowledge in a particular topic

Re: unexpected token `;'

2009-08-25 Thread Diez B. Roggisch
bbarb...@inescporto.pt wrote: Hello to all! I am struggling with a script in python for a while now, and decided to look for some help. I am running a code that takes commands from Marsyas(open source for Music analysis). #!/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6

Re: Python for professsional Windows GUI apps?

2009-08-25 Thread Wolfgang Keller
I need controls for business apps like access to databases, good data grid, printing reports (with or without barcodes), etc. The area of _desktop_ database application development indeed looks like a vast and very hostile desert in the Python landscape. The only framework that seems to be

Re: can python make web applications?

2009-08-25 Thread Mark
On Sun, 23 Aug 2009 21:45:17 +0100, Goke Aruna wrote: A lot check this fantastic open source application, http://www.openerp.com, all done is python. That does look impressive. Is that Django or Turbogears? -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: problem to write a THREAD enabled python extension

2009-08-25 Thread Andreas Otto
Stefan Behnel wrote: You forgot to create a thread state for the new thread. See the PyThreadState_New() function. this does not really solve the problem even if the original error does no happen anymore ... but a bucket of other error happen sometimes and this mean that time and (I

Re: basic thread question

2009-08-25 Thread Piet van Oostrum
sturlamolden sturlamol...@yahoo.no (s) wrote: s On 25 Aug, 01:26, Piet van Oostrum p...@cs.uu.nl wrote: That's because it doesn't use copy-on-write. Thereby losing most of its advantages. I don't know SUA, but I have vaguely heard about it. s SUA is a version of UNIX hidden inside Windows

Re: web frameworks that support Python 3

2009-08-25 Thread Nobody
On Sun, 23 Aug 2009 16:32:09 -0400, Albert Hopkins wrote: What's different about Python 3 is that there is only unicode strings, whereas Python 2 has a string type and a unicode type. Python 2 has str (char) and unicode (wchar) types. Python 3 has bytes (char) and str (wchar) types. The main

Re: unexpected token `;'

2009-08-25 Thread Benjamin Kaplan
On Tue, Aug 25, 2009 at 7:25 AM, Diez B. Roggisch de...@nospam.web.dewrote: Hello to all! I am struggling with a script in python for a while now, and decided to look for some help. I am running a code that takes commands from Marsyas(open source for Music analysis).

Re: sgmllib.py

2009-08-25 Thread Nobody
On Mon, 24 Aug 2009 09:08:07 +0200, Stefan Behnel wrote: But note that sgmllib is a particularly cumbersome way to deal with HTML. Mostly because it only provides a tokeniser, not a parser. Whoever wrote it doesn't appear to understand the difference. --

Re: unexpected token `;'

2009-08-25 Thread Peter Otten
bbarb...@inescporto.pt wrote: I am struggling with a script in python for a while now, and decided to look for some help. I am running a code that takes commands from Marsyas(open source for Music analysis). cmd = sfplay + colist[2] print cmd fileout = commands.getoutput(cmd) You have to

Re: your favorite debugging tool?

2009-08-25 Thread Esmail
Paul Rubin wrote: Esmail ebo...@hotmail.com writes: What is your favorite tool to help you debug your code? I've been getting along with 'print' statements but that is getting old and somewhat cumbersome. Beyond print statements, I use pdb a lot. Winpdb (www.winpdb.org) is even better, but

Re: your favorite debugging tool?

2009-08-25 Thread Esmail
Michele Simionato wrote: On Aug 22, 4:25 pm, Esmail ebo...@hotmail.com wrote: Hi all, What is your favorite tool to help you debug your code? The times when I would just use 'print' are long past. Nowadays I spend lots of my time with code written by others than myself. I use pdb all the

Re: your favorite debugging tool?

2009-08-25 Thread Esmail
Robert Marshall wrote: On 24 Aug 2009, Paul Rubin wrote: Esmail ebo...@hotmail.com writes: What is your favorite tool to help you debug your code? I've been getting along with 'print' statements but that is getting old and somewhat cumbersome. Beyond print statements, I use pdb a lot.

Re: [ANN] pyxser-1.2r --- Python-Object to XML serialization module

2009-08-25 Thread Daniel Molina Wegener
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Stefan Behnel stefan...@behnel.de on Tuesday 25 August 2009 01:23 wrote in comp.lang.python: Stefan Behnel wrote: for all byte strings, regardless of their encoding (since you can't even know if they represent encoded text at all). Hmm,

Would there be work for a sysadmin who specializes in python?

2009-08-25 Thread walterbyrd
If I took the time to really learn to use python for sysadmin work, would I be able to find jobs, or even contract jobs? From what I am seeing on the job boards etc., I would have to say no. It looks to me as though I could possibly do that with perl, but not python. Of course, I could be

Re: Temat:, Re: IOError: [Errno 22] invalid mode ('wb') or filename: in windows xp while making tarfile

2009-08-25 Thread ryniek
On 25 Sie, 07:33, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Mon, 24 Aug 2009 14:23:41 -0700 (PDT), ryniek rynie...@gmail.com declaimed the following in gmane.comp.python.general: C:\Users\Ryniek's WinSe7en\Documents\My Dropbox\Aplikacje

Re: print() and unicode strings (python 3.1)

2009-08-25 Thread Nobody
On Tue, 25 Aug 2009 03:41:54 -0700, 7stud wrote: Why does echoing $LC_ALL or $LC_CTYPE just give me a blank string? Because the variables aren't set. The default locale for a particular category (e.g. LC_CTYPE) is taken from $LC_ALL if that is set, otherwise $LC_CTYPE, otherwise $LANG,

Re: Would there be work for a sysadmin who specializes in python?

2009-08-25 Thread Esmail
walterbyrd wrote: If I took the time to really learn to use python for sysadmin work, would I be able to find jobs, or even contract jobs? FWIW, I think one of the qualities of a good system admin would be the ability to work with a variety of tools and languages and not focus on one

Re: your favorite debugging tool?

2009-08-25 Thread Ben Finney
Esmail ebo...@hotmail.com writes: While I do believe in a minimalist approach (part of the reason I find Python so appealing), using print statements sometimes only goes so far (for me). Right, which is where the Python interactive interpreter (which I failed to mention in my initial

Re: your favorite debugging tool?

2009-08-25 Thread Esmail
Hi Ben, Ben Finney wrote: Whenever a simple output statement is too cumbersome for debugging, I take it as a sign that the program is too cumbersome to follow. I'll have to think about this .. though my gut says this is true :-) re your other point about the interactive shell, I agree it's

Re: proposal: add setresuid() system call to python

2009-08-25 Thread Hrvoje Niksic
travis+ml-pyt...@subspacefield.org writes: On Mon, Jul 20, 2009 at 04:10:35PM +0200, Hrvoje Niksic wrote: To emulate the os-module-type calls, it's better to raise exceptions than return negative values: def setresuid(ruid, euid, suid): return _setresuid(__uid_t(ruid), __uid_t(euid),

Re: os.popen output different from native shell output

2009-08-25 Thread Nobody
On Tue, 25 Aug 2009 01:36:08 -0700, nickname wrote: I am a relative newbie to python, I am using os.popen to run an ls command. The output that I get using the read() function is different in look and feel from when I run the ls command natively from the shell (not via python). As

Re: Protecting against callbacks queuing up?

2009-08-25 Thread Esben von Buchwald
Dennis Lee Bieber wrote: On Mon, 24 Aug 2009 17:32:23 +0200, Esben von Buchwald find@paa.google declaimed the following in gmane.comp.python.general: I'm new to python, what is an after function and an after call? Couldn't find excact answer on google...? Do you have a link to some docs?

Re: Items inheriting attributes from its container?

2009-08-25 Thread Kreso
Jan Kaliszewski z...@chopin.edu.pl wrote: [...] Great! Thanks to all of you for advices and code. K. -- http://mail.python.org/mailman/listinfo/python-list

Re: Would there be work for a sysadmin who specializes in python?

2009-08-25 Thread Brent Bloxam
walterbyrd wrote: If I took the time to really learn to use python for sysadmin work, would I be able to find jobs, or even contract jobs? From what I am seeing on the job boards etc., I would have to say no. It looks to me as though I could possibly do that with perl, but not python. Of

Re: csv module and None values

2009-08-25 Thread JKPeck
On Aug 24, 10:43 pm, John Yeung gallium.arsen...@gmail.com wrote: On Aug 24, 5:00 pm, Peter Otten __pete...@web.de wrote: If I understand you correctly the csv.writer already does what you want: w.writerow([1,None,2]) 1,,2 just sequential commas, but that is the special treatment.

multiprocessing managers and socket connection.

2009-08-25 Thread Chris
I've been using multiprocessing managers and I really like the functionality. I have a question about reconnecting to a manager. I have a situation where I start on one machine (A) a manager that is listening and then on another machine (B) connects to that manager and uses its proxy object to

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-25 Thread Steven D'Aprano
On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: If you want your data file to have values entered in hex, or oct, or even unary (1=one, 11=two, 111=three, =four...) you can. Unary? I think you'll find that Standard Positional Number Systems are not defined for radix 1. Of course

Re: your favorite debugging tool?

2009-08-25 Thread Jean-Michel Pichavant
Esmail wrote: Hi Ben, Ben Finney wrote: Whenever a simple output statement is too cumbersome for debugging, I take it as a sign that the program is too cumbersome to follow. I'll have to think about this .. though my gut says this is true :-) That is not always true. When it comes to

TypeError: _getfullpathname() argument 1 must be (buffer overflow), not str in windows xp, while making tarfile

2009-08-25 Thread Ryniek90
Referring to my earlier posts: http://groups.google.pl/group/comp.lang.python/browse_thread/thread/4e34f995800f5352?hl=pl and http://groups.google.pl/group/comp.lang.python/browse_thread/thread/abf5573b8fceb37e?hl=pl# I've dealt with those errors. but now have another. When my backup scripts

inconsistent sitecustomize.py importing...

2009-08-25 Thread Chris Withers
Hi All, Give this sitecustomize.py: print ping ...and this script: #!/usr/local/bin/python2.5 print pong! ...both in ~/folder, I would expect the output from: ~$./folder/script ...to be: ping pong ...but sitecustomize.py is not imported :-( If I do: ~$/usr/local/bin/python2.5

Re: csv module and None values

2009-08-25 Thread Peter Otten
JKPeck wrote: On Aug 24, 10:43 pm, John Yeung gallium.arsen...@gmail.com wrote: On Aug 24, 5:00 pm, Peter Otten __pete...@web.de wrote: If I understand you correctly the csv.writer already does what you want: w.writerow([1,None,2]) 1,,2 just sequential commas, but that is the

Re: your favorite debugging tool?

2009-08-25 Thread Ben Finney
Esmail ebo...@hotmail.com writes: Hi Ben, Ben Finney wrote: Whenever a simple output statement is too cumbersome for debugging, I take it as a sign that the program is too cumbersome to follow. I'll have to think about this .. though my gut says this is true :-) Note that it's only a

Even more inconsistent sitecustomize.py importing with PYTHONPATH rolled in...

2009-08-25 Thread Chris Withers
Chris Withers wrote: However, if I do: ~/folder$/usr/local/bin/python2.5 script ...sitecustomize.py IS imported! However, the following doesn't import sitecustomize.py: ~/folder$ ./script While the following DOES import sitecustomize.py: ~/folder$ export PYTHONPATH= ~/folder$ ./script

Re: Even more inconsistent sitecustomize.py importing with PYTHONPATH rolled in...

2009-08-25 Thread Chris Withers
Chris Withers wrote: Bizarrely, none of the following import sitecustomize.py: ~$ export PYTHONPATH=~/folder ~$ ./script ~$ export PYTHONPATH=~/folder/ ~$ ./script ~$ export PYTHONPATH=~/folder ~/folder$ ./script ~$ export PYTHONPATH=~/folder/ ~/folder$ ./script Okay, brain fail on my

Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread Scott David Daniels
Matjaz Bezovnik wrote: If you are using numpy (which it sounds like you are): IDLE 2.6.2 import numpy as np v = np.array([[0,1,2],[3,4,5],[6,7,8]], dtype=float) v array([[ 0., 1., 2.], [ 3., 4., 5.], [ 6., 7., 8.]]) w = np.array([[10,11,12],[13,14,15],[16,17,18]],

Re: inconsistent sitecustomize.py importing...

2009-08-25 Thread Steven D'Aprano
On Tue, 25 Aug 2009 15:45:53 +0100, Chris Withers wrote: Hi All, Give this sitecustomize.py: [...] What gives?! Perhaps this? http://bugs.python.org/issue1734860 -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Need help with Python scoping rules

2009-08-25 Thread kj
I have many years of programming experience, and a few languages, under my belt, but still Python scoping rules remain mysterious to me. (In fact, Python's scoping behavior is the main reason I gave up several earlier attempts to learn Python.) Here's a toy example illustrating what I mean.

Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread Matjaz Bezovnik
On Tue, 25 Aug 2009 08:26:44 -0700, Scott David Daniels scott.dani...@acm.org wrote: Matjaz Bezovnik wrote: If you are using numpy (which it sounds like you are): IDLE 2.6.2 import numpy as np v = np.array([[0,1,2],[3,4,5],[6,7,8]], dtype=float) v array([[ 0., 1., 2.], [ 3.,

Re: Graph library recommendations for large graphs

2009-08-25 Thread Neal Becker
VanL wrote: I am working on a project that will require building and querying large graph objects (initially 8M nodes, 30-40M edges; eventually 40M nodes, 100M edges). NetworkX seems to be the most popular, but I am concerned that a dict representation for nodes would use too much memory --

Re: TypeError: _getfullpathname() argument 1 must be (buffer overflow), not str in windows xp, while making tarfile

2009-08-25 Thread MRAB
Ryniek90 wrote: Referring to my earlier posts: http://groups.google.pl/group/comp.lang.python/browse_thread/thread/4e34f995800f5352?hl=pl and http://groups.google.pl/group/comp.lang.python/browse_thread/thread/abf5573b8fceb37e?hl=pl# I've dealt with those errors. but now have another.

Re: Protecting against callbacks queuing up?

2009-08-25 Thread Hendrik van Rooyen
On Tuesday 25 August 2009 15:21:16 Esben von Buchwald wrote: Dennis Lee Bieber wrote: On Mon, 24 Aug 2009 17:32:23 +0200, Esben von Buchwald find@paa.google declaimed the following in gmane.comp.python.general: I'm new to python, what is an after function and an after call? Couldn't

Re: Code formatting question: conditional expression

2009-08-25 Thread Nicola Larosa (tekNico)
John Posner wrote: Is there any consensus on how to format a conditional expression that is too long for one line? Here's my take: excessblk = Block(total - P.BASE, srccol, carry_button_suppress=True ) if total P.BASE else None -- Nicola Larosa - http://www.tekNico.net/ Nobody

Re: Need help with Python scoping rules

2009-08-25 Thread Martin P. Hellwig
kj wrote: cut Here's a toy example illustrating what I mean. It's a simplification of a real-life coding situation, in which I need to initialize a private class variable by using a recursive helper function. eh? class Demo(object): def fact(n): if n 2: return 1

Re: your favorite debugging tool?

2009-08-25 Thread Falcolas
On Aug 23, 1:21 am, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Saturday 22 August 2009 16:49:22 Aahz wrote: In article mailman.227.1250951162.2854.python-l...@python.org, Esmail  ebo...@hotmail.com wrote: What is your favorite tool to help you debug your code? I've been

Re: Need help with Python scoping rules

2009-08-25 Thread Diez B. Roggisch
kj wrote: I have many years of programming experience, and a few languages, under my belt, but still Python scoping rules remain mysterious to me. (In fact, Python's scoping behavior is the main reason I gave up several earlier attempts to learn Python.) Here's a toy example

Re: Web Services examples using raw xml?

2009-08-25 Thread John Gordon
In 4a936e84$0$31337$9b4e6...@newsspool4.arcor-online.net Stefan Behnel stefan...@behnel.de writes: I tried WSDL.Proxy() from the SOAPpy package and eventually end up with this error: xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 6 Is that while

Re: Need help with Python scoping rules

2009-08-25 Thread Jean-Michel Pichavant
kj wrote: I have many years of programming experience, and a few languages, under my belt, but still Python scoping rules remain mysterious to me. (In fact, Python's scoping behavior is the main reason I gave up several earlier attempts to learn Python.) Here's a toy example illustrating what

Re: Need help with Python scoping rules

2009-08-25 Thread Jean-Michel Pichavant
Diez B. Roggisch wrote Classes are not scopes. Too bad, could have been handy. JM -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with Python scoping rules

2009-08-25 Thread Xavier Ho
I'm not really quite sure what voodoo I did here, but my code seems to work in Python 3.1.1 in the following way: class Demo(object): def func(self, n): return n * 5 _f = func(None, 5) d = Demo() print(d._f) print(d.func(5)) # OUTPUT 25 25 So, hmm? Regards, Ching-Yun Xavier

Re: Need help with Python scoping rules

2009-08-25 Thread Xavier Ho
On Wed, Aug 26, 2009 at 2:14 AM, Diez B. Roggisch de...@nospam.web.dewrote: Classes are not scopes. So the above doesn't work because name resolution inside functions/methods looks for local variables first, then for the *global* scope. There is no class-scope-lookup. Sorry, I'm coming

Re: Need help with Python scoping rules

2009-08-25 Thread Diez B. Roggisch
Jean-Michel Pichavant wrote: Diez B. Roggisch wrote Classes are not scopes. Too bad, could have been handy. Nope. Because then a lot of people would write something like this: class Foo(object): def bar(self): bar() # note the missing self. And this would lead to errors

Re: conditional for-statement

2009-08-25 Thread seb
On Aug 23, 11:02 pm, Chris Rebert c...@rebertia.com wrote: On Sun, Aug 23, 2009 at 1:36 PM, sebsdemen...@gmail.com wrote: On Aug 23, 6:18 pm, John Posner jjpos...@optimum.net wrote: Hi, i was wondering if there is a syntax alike: for i in range(10) if i 5:     print i You can

Re: conditional for-statement

2009-08-25 Thread seb
On Aug 24, 12:05 am, Mel mwil...@the-wire.com wrote: seb wrote: On Aug 23, 6:18 pm, John Posner jjpos...@optimum.net wrote: [ ... ] How about using a generator expression instead of a list? for i in (x for x in range(10) if x 5): print i -John Indeed, but we could have the same

Re: Web Services examples using raw xml?

2009-08-25 Thread Stefan Behnel
John Gordon wrote: Any suggestions? Well, yes, see the link I posted. http://effbot.org/zone/element-soap.htm That might actually be the easiest way to get your stuff done, and it avoids external dependencies (well, except for ElementTree, if you continue to use Python = 2.4). Stefan --

Re: Need help with Python scoping rules

2009-08-25 Thread John Posner
Diez said: Classes are not scopes. So the above doesn't work because name resolution inside functions/methods looks for local variables first, then for the *global* scope. There is no class-scope-lookup. But http://docs.python.org/tutorial/classes.html says, in Section 9.3 A First Look at

Re: conditional for-statement

2009-08-25 Thread Rami Chowdhury
We could as consistenly explain that the syntax for n in range(10) if n%3==0: body means for n in range(10): if n%3==0: body This syntax has also the benefit of avoiding an extra level of indentation (the one for the if) that bears no real meaning on a structural level. I'm sorry,

Re: basic thread question

2009-08-25 Thread sturlamolden
On 25 Aug, 13:33, Piet van Oostrum p...@cs.uu.nl wrote: I have heard about that also, but is there a Python implementation that uses this? (Just curious, I am not using Windows.) On Windows we have three different versions of Python 2.6: * Python 2.6 for Win32/64 (from python.org) does not

Re: Python for professsional Windows GUI apps?

2009-08-25 Thread Gilles Ganault
On Tue, 25 Aug 2009 13:24:39 +0200, Wolfgang Keller felip...@gmx.net wrote: The area of _desktop_ database application development indeed looks like a vast and very hostile desert in the Python landscape. The only framework that seems to be worth trying is Dabo. Unfortunately there's little

Re: Need help with Python scoping rules

2009-08-25 Thread 7stud
On Aug 25, 12:11 pm, John Posner jjpos...@optimum.net wrote: Diez said: Classes are not scopes. So the above doesn't work because name resolution inside functions/methods looks for local variables first, then for the *global* scope. There is no class-scope-lookup.

Re: Python for professsional Windows GUI apps?

2009-08-25 Thread David Boddie
On Tuesday 25 August 2009 13:24, Wolfgang Keller wrote: The area of _desktop_ database application development indeed looks like a vast and very hostile desert in the Python landscape. The only framework that seems to be worth trying is Dabo. Unfortunately there's little documentation, and

Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread sturlamolden
On 25 Aug, 17:37, Matjaz Bezovnik mbezov...@freenet.si wrote: Scott, thank you very much for the snippet. It is exactly what I looked for; simple to read and obvious as to what it does even a month later to a non-pythonist! Since you were talking about matrices, observe that numpy has a

Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread Robert Kern
On 2009-08-24 21:30 PM, Matjaz Bezovnik wrote: Dear all, I'm but a layman so do not take offence at this maybe over simple question. This is something which is done often in FEM methods, and the alike. I have matrix A of 3x3 elements, and B, of the same number of elements, 3x3. What would be

Re: os.popen output different from native shell output

2009-08-25 Thread nickname
On Aug 25, 6:16 am, Nobody nob...@nowhere.com wrote: On Tue, 25 Aug 2009 01:36:08 -0700, nickname wrote:        I am a relative newbie to python, I am using os.popen to run an ls command. The output that I get using the read() function is different in look and feel from when I run the ls

Re: Python for professsional Windows GUI apps?

2009-08-25 Thread sturlamolden
On 25 Aug, 20:30, Gilles Ganault nos...@nospam.com wrote: Combined with the comment above about issues with printing, it looks like Python for GUI apps isn't a very good idea :-/ With pywin32, printing is the same as for any other Windows app (you get MFC for Python). --

Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-25 Thread Mensanator
On Aug 25, 9:14 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 24 Aug 2009 18:01:38 -0700, Mensanator wrote: If you want your data file to have values entered in hex, or oct, or even unary (1=one, 11=two, 111=three, =four...) you can. Unary? I think you'll

Re: your favorite debugging tool?

2009-08-25 Thread Robert Kern
On 2009-08-25 09:49 AM, Ben Finney wrote: Esmailebo...@hotmail.com writes: Hi Ben, Ben Finney wrote: Whenever a simple output statement is too cumbersome for debugging, I take it as a sign that the program is too cumbersome to follow. I'll have to think about this .. though my gut says

Re: Python for professsional Windows GUI apps?

2009-08-25 Thread sturlamolden
On 25 Aug, 13:24, Wolfgang Keller felip...@gmx.net wrote: The area of _desktop_ database application development indeed looks like a vast and very hostile desert in the Python landscape. Yes, you don't have drag-and-drop database tools like MS Access or FoxPro. You actually have to use a

Re: proposal: add setresuid() system call to python

2009-08-25 Thread travis
On Tue, Aug 25, 2009 at 03:03:12PM +0200, Hrvoje Niksic wrote: You should use ctypes.get_errno() instead of os.errno; sorry about that. Also, when raising OSError, you should set the 'errno' attribute to the appropriate code. How does that compare to: raise

Re: Waiting for a subprocess to exit

2009-08-25 Thread Aahz
In article mailman.161.1250835519.2854.python-l...@python.org, Miles Kaufmann mile...@umich.edu wrote: debacle[1]). Leaving shell=3DFalse makes scripts more secure and =20 robust; besides, when I'm putting together a command and its =20 arguments, it's as convenient to build a list (['mycmd',

Re: Simple IRC library

2009-08-25 Thread jason
On 2009-08-24 01:39:21 -0600, devaru ajoys...@gmail.com said: Hi all, I am new to Python language. I want to capture(either in database or a file) the conversation in IRC. Fed. Please suggest me some simple IRC library or code snippet for this. I have used the oyoyo library with success.

Re: Need help with Python scoping rules

2009-08-25 Thread John Posner
7stud said: python ignores the names inside a function when it creates the function. This program will not produce an error: def f(): print x python parses the file and creates the function object and assigns the function object to the variable f. It's not until you execute the function

Re: Object Reference question

2009-08-25 Thread Aahz
In article mailman.164.1250837108.2854.python-l...@python.org, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Friday 21 August 2009 08:07:18 josef wrote: My main focus of this post is: How do I find and use object reference memory locations? a = [1,2,3,4] id(a) 8347088 Of course,

Context manager to temporarily change the variable of a register [aka write swap(a,b)]

2009-08-25 Thread Evan Driscoll
(If you don't want to read the following, note that you can answer my question by writing a swap function.) I want to make a context manager that will temporarily change the value of a variable within the scope of a 'with' that uses it. This is inspired by a C++ RAII object I've used in a few

Re: your favorite debugging tool?

2009-08-25 Thread Robert Kern
On 2009-08-25 06:57 AM, Esmail wrote: Michele Simionato wrote: On Aug 22, 4:25 pm, Esmail ebo...@hotmail.com wrote: Hi all, What is your favorite tool to help you debug your code? The times when I would just use 'print' are long past. Nowadays I spend lots of my time with code written by

Re: os.popen output different from native shell output

2009-08-25 Thread Thomas Guettler
In one of the first chapters of Advanced programming in the unix environment (second edition) there is explained how a unix shell works. You could write you own shell using python. This way the python interpreter gets stared only once, and not for every call to ls. Have fun, Thomas nickname

Re: conditional for-statement

2009-08-25 Thread Falcolas
On Aug 25, 11:25 am, seb sdemen...@gmail.com wrote: We could as consistenly explain that the syntax for n in range(10) if n%3==0:   body means for n in range(10):   if n%3==0:     body This syntax has also the benefit of avoiding an extra level of indentation (the one for the if) that

Python, qt, and lgpl

2009-08-25 Thread Terry Reedy
New LGPL Python bindings for Qt slither into the light A new set of LGPL-licensed Python bindings for Qt has been announced. The project, which is backed by Nokia, will make it easier for commercial software developers to adopt Python and Qt for rapid application development.

Re: Context manager to temporarily change the variable of a register [aka write swap(a,b)]

2009-08-25 Thread Emile van Sebille
On 8/25/2009 12:33 PM Evan Driscoll said... snip So my question is: is what I want possible to do in Python? Probably not with immutables (as in your example) -- maybe otherwise. Emile -- http://mail.python.org/mailman/listinfo/python-list

break unichr instead of fix ord?

2009-08-25 Thread rurpy
In Python 2.5 on Windows I could do [*1]: # Create a unicode character outside of the BMP. a = u'\U00010040' # On Windows it is represented as a surogate pair. len(a) 2 a[0],a[1] (u'\ud800', u'\udc40') # Create the same character with the unichr() function. a = unichr

  1   2   >