Re: Windows PE and Python 2.6 (Side-by-Side error)

2008-12-17 Thread Werner Merkl
Martin v. Löwis schrieb: Has anyone an idea? You should not install "for all users" before copying it, but "just for me". Regards, Martin This works! Thank you very much! (Sorry for the delay. I had been on a conference, than I was ill and than, there were more urgent things...) But now PyS

Re: eval() and global variables

2008-12-17 Thread Peter Otten
Juan Pablo Romero Méndez wrote: > Suppose this function is given: > > def f(x,y): > return x+y+k > > > Is it possible to somehow assign a value to k without resorting to > making k global? You can replace the function's global dictionary: >>> def f(x, y): ... return x+y+k ... >>> functi

Re: mod_python resources

2008-12-17 Thread Graham Dumpleton
On Dec 17, 11:10 am, Дамјан Георгиевски wrote: > > I'm trying again because I'm stubborn. Maybe the fourth time will be > > the charm... > > > Are there any good tutorials out there for setting up Apache with > > mod_python? > > mod_python is depreceated, nobody uses it. usemod_wsgihttp://www.modw

Re: help I'm getting delimited

2008-12-17 Thread John Machin
On Dec 17, 9:39 pm, aka wrote: > Due to being in a hurry I didn't paste correctly (sorry). > > The intention is to put values of column 1 ("id") in the roles list, > therefore appending within the loop, to fill a session var. > > The complete code is: It's *not* complete. It's missing "import csv

Re: Python, XML and XPath

2008-12-17 Thread Diez B. Roggisch
Hole wrote: > Hi all, > > I hope this is not an "overasked" question but I find myself quite > confused about python xml management (I have to use python for a > project and I come from java world, you know...where frameworks, > libraries and tools to use are standard de iure or standard de facto

Re: Selecting a different superclass

2008-12-17 Thread Marco Mariani
psaff...@googlemail.com wrote: The problem is that IDPointSet and MicroArrayPointSet will need to inherit from PointSet or TraceablePointSet based on whether I'm handling traceable points or not. Can I select a superclass conditionally like this in Python? Am I trying to do something really evil

Re: Selecting a different superclass

2008-12-17 Thread Marco Mariani
Marco Mariani wrote: I think you should investigate something different than subclassing, like a "Strategy" domain pattern or something similar. s/domain/design/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread r
I think there is a simpler answer to all this(not to take away from the other ones here though which are all great). When writing procedural code how would you like it if vars inside functions were automatically global. Your code with be blowing chunks in no time. Thats the reason for global declar

Re: Transferring a file over sockets

2008-12-17 Thread Tim Golden
Ferdinand Sousa wrote: I am using sockets to transfer a file over LAN. There are 2 scripts, the server opens a listens for connection and the client is run on another machine. I always make sure the server is run first. The strange thing is that if the the server script is double-clicked and exec

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Richard Brodie
"walterbyrd" wrote in message news:518b9dd9-69c5-4d5b-bd5f-ad567be62...@b38g2000prf.googlegroups.com... > However in the methods are within a class, the scoping seems to work > differently. Not really, self is a formal parameter to the function. It would be a strange language where a function'

Re: getting object instead of string from dir()

2008-12-17 Thread Andrew Nelis
On Dec 17, 5:16 pm, Rominsky wrote: > I am trying to use dir to generate a list of methods, variables, etc. > I would like to be able to go through the list and seperate the > objects by type using the type() command, but the dir command returns > a list of strings.  When I ask for the type of an

Re: getting object instead of string from dir()

2008-12-17 Thread david wright
--- On Wed, 12/17/08, Rominsky wrote: From: Rominsky Subject: getting object instead of string from dir() To: python-list@python.org Date: Wednesday, December 17, 2008, 12:16 PM I am trying to use dir to generate a list of methods, variables, etc. I would like to be able to go through the lis

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread John Machin
On Dec 18, 2:19 am, walterbyrd wrote: > For a language as well structured as Python, this seems somewhat > sloppy, and inconsistant.  Or is there some good reason for this? > > Here is what I mean: > > def a(): >     x = 99 >     print x > > def b(): >     print x > > a() > b() # raises an excepti

Re: getting object instead of string from dir()

2008-12-17 Thread Christian Heimes
Rominsky schrieb: > I am trying to use dir to generate a list of methods, variables, etc. > I would like to be able to go through the list and seperate the > objects by type using the type() command, but the dir command returns > a list of strings. When I ask for the type of an element, the answer

Re: Python, XML and XPath

2008-12-17 Thread Hole
> > I need to use XML parsing with xpath: a simple xml reader. > > You can try lxml, have a look herehttp://codespeak.net/lxml/xpathxslt.html Thanks a lot to everyone! -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread walterbyrd
On Dec 17, 10:00 am, r wrote: > When writing > procedural code how would you like it if vars inside functions were > automatically global. Your code with be blowing chunks in no time. That was my point - I consider python's ordinary use of lexical scoping to be a good thing, and I was wondering w

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread walterbyrd
On Dec 17, 9:04 am, rdmur...@bitdance.com wrote: > Yes.  It's called Object Oriented Programming. I think you mean it's *Python* Object Oriented Programming. I am not sure that every other OO language works like that. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread walterbyrd
On Dec 17, 10:17 am, "Richard Brodie" wrote: > Not really, self is a formal parameter to the function. It would be > a strange language where a function's own arguments weren't in scope. Thank you, that makes sense to me. -- http://mail.python.org/mailman/listinfo/python-list

Re: Relative imports in Python 3.0

2008-12-17 Thread Benjamin
On Dec 17, 4:01 am, Nicholas wrote: > Imagine a module that looks like > > ModuleDir >      __init__.py >      a.py >      b.py > > In python 2.x I used to have tests at the end of each of my modules, > so that module b.py might look something like > > import a >  .. >  .. > > if _

Re: help I'm getting delimited

2008-12-17 Thread aka
Hi John, thanks. You're right, I didn't past the method header because I thought it didn't matter when the input filename is hardcoded. The try/except isn't very helpful indeed so I commented it out. You're right I wrongly referred to the UnicodeReader class in my first post because that's ultimate

Re: help I'm getting delimited

2008-12-17 Thread aka
Hi John, thanks. You're right, I didn't past the method header because I thought it didn't matter when the input filename is hardcoded. The try/except isn't very helpful indeed so I commented it out. You're right I wrongly referred to the UnicodeReader class in my first post because that's ultimate

Re: OT: Binary tree logarithms properties

2008-12-17 Thread Terry Reedy
Mr.SpOOn wrote: Hi, I'm searching for a clear explanation of binary tree properties, expecially the ones related to logarithms. For example, I know that in a tree with 2n-1 nodes, we have log(n) levels, from 0 to log(n). A *complete* binary tree with n levels has 2**n - 1 nodes. This is easi

Re: The rule of literal string

2008-12-17 Thread Li Han
Thank you, Chris! You have made me learn more about Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: help I'm getting delimited

2008-12-17 Thread aka
Due to being in a hurry I didn't paste correctly (sorry). The intention is to parse a csv file and (ultimately) put values of column 1 ("id") in a list (so I need to append in the loop) that will be used to fill a session var. The complete code is: roles = [] inp = 'C:/temp/test.csv' try: fp =

Re: help I'm getting delimited

2008-12-17 Thread aka
Due to being in a hurry I didn't paste correctly (sorry). The intention is to put values of column 1 ("id") in the roles list, therefore appending within the loop, to fill a session var. The complete code is: roles = [] inp = 'C:/temp/test.csv' try: fp = open(inp, 'rb') reader = csv.read

Re: Relative imports in Python 3.0

2008-12-17 Thread Brian Allen Vanderburg II
nicholas.c...@gmail.com wrote: Imagine a module that looks like ModuleDir __init__.py a.py b.py In python 2.x I used to have tests at the end of each of my modules, so that module b.py might look something like import a .. .. if __name__ == '__main__': run

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread r
On Dec 17, 12:20 pm, walterbyrd wrote: > On Dec 17, 10:00 am, r wrote: > > > When writing > > procedural code how would you like it if vars inside functions were > > automatically global. Your code with be blowing chunks in no time. > > That was my point - I consider python's ordinary use of lexi

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread walterbyrd
On Dec 17, 8:41 am, prueba...@latinmail.com wrote: > If scoping worked as you want, how, pray tell, would you define object > attributes?- Hide quoted text - I suppose you could do this: class className(): varname = "whatever" def fname(self, varname): . . . . Instead of having v

Relative imports in Python 3.0

2008-12-17 Thread Nicholas
Imagine a module that looks like ModuleDir __init__.py a.py b.py In python 2.x I used to have tests at the end of each of my modules, so that module b.py might look something like import a .. .. if __name__ == '__main__': runtests() But under Python 3.0 thi

Re: Python, XML and XPath

2008-12-17 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > Hole wrote: > >> Hi all, >> >> I hope this is not an "overasked" question but I find myself quite >> confused about python xml management (I have to use python for a >> project and I come from java world, you know...where frameworks, >> libraries and tools to use are st

Re: Managing timing in Python calls

2008-12-17 Thread Ross
Interesting stuff - I hadn't come across the 'with' syntax before, so I've learned something already. I was briefly excited to learn about the callLater command which is just a convenience class for the wxTimer class. It seems to be pretty much a parallel of the var t = window.setTimeout( f

Re: Python is slow

2008-12-17 Thread RadicalEd
On Dec 10, 1:42 pm, cm_gui wrote: > http://blog.kowalczyk.info/blog/2008/07/05/why-google-should-sponsor-... > > I fully agree with Krzysztof Kowalczyk . > Can't they build a faster VM for Python since they love the language > so much? > > Python is SLOW.    And I am not comparing it with compiled

Re: Python 3.0 crashes displaying Unicode at interactive prompt

2008-12-17 Thread jhermann
Assuming those survived the switch to 3.0, you can use site.py und sys.displayhook to customize to the old behaviour (i.e. change it to a version using ascii instead of repr). Since this only affects interactive use, it's also no problem for portability of code, unlike "solutions" like forcing the

Re: help I'm getting delimited

2008-12-17 Thread aka
John, this is the actual code I ran in TurboGears which is a Python framework. I should have left away the import statements. Trust me, the problem isn't in there because the UnicodeWriter is functioning perfectly. I did allready sanitate the csv file to these four lines in Notepad so there isn't a

Re: getting object instead of string from dir()

2008-12-17 Thread Rominsky
On Dec 17, 10:59 am, Christian Heimes wrote: > Rominsky schrieb: > > > I am trying to use dir to generate a list of methods, variables, etc. > > I would like to be able to go through the list and seperate the > > objects by type using the type() command, but the dir command returns > > a list of s

Re: Transferring a file over sockets

2008-12-17 Thread Hendrik van Rooyen
Ferdinand Sousa wrote: >== .# file receiver ># work in progress > >import socket > >s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >HOST = '192.168.1.17' >PORT = 31400 > >s.bind((HOST, PORT)) >s.listen(3) >conn, addr = s.accept() >pr

Re: Transferring a file over sockets

2008-12-17 Thread MRAB
Hendrik van Rooyen wrote: Ferdinand Sousa wrote: == .# file receiver # work in progress import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) HOST = '192.168.1.17' PORT = 31400 s.bind((HOST, PORT)) s.listen(3) conn, add

[Help] The pywinauto Can't select the MDI's menu using the MenuItems() which return [].

2008-12-17 Thread 为爱而生
I can't use the MenuItems() in my MDI application. Any example is very nice Thanks a lot! -- "OpenBookProject"-开放图书计划邮件列表 详情: http://groups.google.com/group/OpenBookProject 维基: http://wiki.woodpecker.org.cn/ -- http://mail.python.org/mailman/listinfo/python-list

Re: getting object instead of string from dir()

2008-12-17 Thread Jean-Paul Calderone
On Wed, 17 Dec 2008 11:52:17 -0800 (PST), Rominsky wrote: On Dec 17, 10:59 am, Christian Heimes wrote: Rominsky schrieb: > I am trying to use dir to generate a list of methods, variables, etc. > I would like to be able to go through the list and seperate the > objects by type using the type(

[ANN] EuroPython 2009 – Call for Partic ipation!

2008-12-17 Thread Martin P. Hellwig
On behalf of the EuroPython 2009 organisation it is my privilege and honour to announce the 'Call for Participation' for EuroPython 2009! EuroPython is the conference for the communities around Python, including the Django, Zope and Plone communities. This year's conference will be held in Birmin

Re: mysql hash generator in python

2008-12-17 Thread News123
Hi Matias. Could you show us the 'class implementation'? Whether class or not the result should be the same. If it isn't, then there should be a small error. If we have both code versions to look at it's easier to help you. bye N Matías Hernández wrote: > (sorry for my english, but i'm sp

Re: Need help improving number guessing game

2008-12-17 Thread Arnaud Delobelle
"D'Arcy J.M. Cain" writes: > On Tue, 16 Dec 2008 13:59:24 -0800 > Scott David Daniels wrote: >>> > def yesno(s): >> >s = s.strip().lower() >> >if not s in ("y", "n"): There was a thread about "is not" recently. Python also allows "not in". if s not in ("y", "n"): > You could

Why no lexical scoping for a method within a class?

2008-12-17 Thread rdmurray
Quoth walterbyrd : > For a language as well structured as Python, this seems somewhat > sloppy, and inconsistant. Or is there some good reason for this? Yes. It's called Object Oriented Programming. > Here is what I mean: > > def a(): > x = 99 > print x > > def b(): > print x > >

Why no lexical scoping for a method within a class?

2008-12-17 Thread walterbyrd
For a language as well structured as Python, this seems somewhat sloppy, and inconsistant. Or is there some good reason for this? Here is what I mean: def a(): x = 99 print x def b(): print x a() b() # raises an exception because x is not defined. However in the methods are within

Re: Python, XML and XPath

2008-12-17 Thread Enrico
"Hole" ha scritto nel messaggio news:daf5cd00-36dc-4ab4-976e-a6d859b52...@w24g2000prd.googlegroups.com... > Hi all, > > I hope this is not an "overasked" question but I find myself quite > confused about python xml management (I have to use python for a > project and I come from java world, you kn

Re: Selecting a different superclass

2008-12-17 Thread Chris Rebert
On Wed, Dec 17, 2008 at 6:41 AM, psaff...@googlemail.com wrote: > This might be a pure OO question, but I'm doing it in Python so I'll > ask here. > > > The problem is that IDPointSet and MicroArrayPointSet will need to > inherit from PointSet or TraceablePointSet based on whether I'm > handling

Re: regex problem ..

2008-12-17 Thread Steve Holden
Analog Kid wrote: > Hi guys: > Thanks for your responses. Points taken. Basically, I am looking for a > combination of the following ... > [^\w] and %(?!20) ... How do I do this in a single RE? > > Thanks for all you help. > Regards, > AK > > On Mon, Dec 15, 2008 at 10:54 PM, Steve Holden

Re: Free place to host python files?

2008-12-17 Thread Matt Nordhoff
James Mills wrote: > On Wed, Dec 17, 2008 at 10:25 AM, Chris Rebert wrote: >> I'll plug Bitbucket (http://bitbucket.org/). It gives you 150MB of >> Mercurial hosting for free, along with a bug tracker and wiki. And I >> hear it's implemented using Django. > > FreeHG (http://freehg.org) is pretty

Re: Transferring a file over sockets

2008-12-17 Thread Jean-Paul Calderone
On Wed, 17 Dec 2008 17:41:46 +0530, Ferdinand Sousa wrote: I am using sockets to transfer a file over LAN. There are 2 scripts, the server opens a listens for connection and the client is run on another machine. I always make sure the server is run first. The strange thing is that if the the se

Re: help I'm getting delimited

2008-12-17 Thread rdmurray
Quoth John Machin : > On Dec 18, 1:28 am, aka wrote: > > @expose(allow_json=True) > > Means what? Does what? > Does the problem still happen without that? Means what he's posting is not a standalone script :) He says it's part of his turbogears ap. @expose says that this method is callabl

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread pruebauno
On Dec 17, 10:19 am, walterbyrd wrote: > For a language as well structured as Python, this seems somewhat > sloppy, and inconsistant.  Or is there some good reason for this? > > Here is what I mean: > > def a(): >     x = 99 >     print x > > def b(): >     print x > > a() > b() # raises an except

Re: help I'm getting delimited

2008-12-17 Thread John Machin
On Dec 18, 1:28 am, aka wrote: > Hi John, thanks. > You're right, I didn't past the method header because I thought it > didn't matter when the input filename is hardcoded. > The try/except isn't very helpful indeed so I commented it out. > You're right I wrongly referred to the UnicodeReader > cl

something else instead of PIL?

2008-12-17 Thread Reimar Bauer
Hi what has happened to PIL? No updates since two years. Or does one know an alternative lib for resizing images? cheers Reimar -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Diez B. Roggisch
walterbyrd wrote: > For a language as well structured as Python, this seems somewhat > sloppy, and inconsistant. Or is there some good reason for this? > > Here is what I mean: > > def a(): > x = 99 > print x > > def b(): > print x > > a() > b() # raises an exception because x is

Python, XML and XPath

2008-12-17 Thread Hole
Hi all, I hope this is not an "overasked" question but I find myself quite confused about python xml management (I have to use python for a project and I come from java world, you know...where frameworks, libraries and tools to use are standard de iure or standard de facto). I need to use XML par

Re: something else instead of PIL?

2008-12-17 Thread skip
Reimar> Hi what has happened to PIL? No updates since two years. It's well-written, stable code. As far as I know it does what people want (at least it's done everything I've needed when I've used it). Why should it matter that there hasn't been an official release in two years? -- Skip M

Re: subprocess.Popen inheriting

2008-12-17 Thread Jeremy Sanders
Aaron Brady wrote: > I thought so too. The web seems to say that on Linux they are, and on > Windows, you need to call DuplicateHandle for it. I hit this problem - it looks like pipes aren't very versatile on Windows. There's also the complicating factor that the handles in windows aren't the sa

Transferring a file over sockets

2008-12-17 Thread Ferdinand Sousa
I am using sockets to transfer a file over LAN. There are 2 scripts, the server opens a listens for connection and the client is run on another machine. I always make sure the server is run first. The strange thing is that if the the server script is double-clicked and executed (run in a console wi

Re: something else instead of PIL?

2008-12-17 Thread Chris Rebert
On Wed, Dec 17, 2008 at 12:48 PM, Reimar Bauer wrote: > Hi > > what has happened to PIL? No updates since two years. The Python Imaging Library is still current; I guess they just haven't found any new bugs or seen fit to add new functionality in a while, though I presume they'll start working on

Re: regex problem ..

2008-12-17 Thread Analog Kid
Hi guys: Thanks for your responses. Points taken. Basically, I am looking for a combination of the following ... [^\w] and %(?!20) ... How do I do this in a single RE? Thanks for all you help. Regards, AK On Mon, Dec 15, 2008 at 10:54 PM, Steve Holden wrote: > Analog Kid wrote: > > Hi All: > >

Re: something else instead of PIL?

2008-12-17 Thread Daniel Fetchinson
>> what has happened to PIL? No updates since two years. > > The Python Imaging Library is still current; I guess they just haven't > found any new bugs or seen fit to add new functionality in a while, > though I presume they'll start working on a Python 3.0 port > eventually. That's actually an i

Selecting a different superclass

2008-12-17 Thread psaff...@googlemail.com
This might be a pure OO question, but I'm doing it in Python so I'll ask here. I'm writing a number crunching bioinformatics application. Read lots of numbers from files; merge, median and munge; draw plots. I've found that the most critical part of this work is validation and traceability - "wher

getting object instead of string from dir()

2008-12-17 Thread Rominsky
I am trying to use dir to generate a list of methods, variables, etc. I would like to be able to go through the list and seperate the objects by type using the type() command, but the dir command returns a list of strings. When I ask for the type of an element, the answer is always string. How do

Re: weird dict problem, how can this even happen?

2008-12-17 Thread Joel Hedlund
Steven D'Aprano wrote: On Tue, 16 Dec 2008 14:32:39 +0100, Joel Hedlund wrote: Duncan Booth wrote: Alternatively give up on defining hash and __eq__ for FragmentInfo and rely on object identity instead. Object identity wouldn't work so well for caching. Objects would always be drawn as they ap

Re: help I'm getting delimited

2008-12-17 Thread aka
Due to being in a hurry I didn't paste correctly so I lost the try clause (sorry). The intention is to parse a csv file and (ultimately) put values of column 1 ("id") in a list (so I need to append in the loop) that will be used to fill a session var. The complete code is: roles = [] inp = 'C:/tem

OT: Binary tree logarithms properties

2008-12-17 Thread Mr . SpOOn
Hi, I'm searching for a clear explanation of binary tree properties, expecially the ones related to logarithms. For example, I know that in a tree with 2n-1 nodes, we have log(n) levels, from 0 to log(n). So, if k is the level, the nodes on a level have indexes between 2^k and 2^(k+1)-1. For k=0

Re: WinMerge--B/W Shading of Printed Copy to Show Differences?

2008-12-17 Thread W. eWatson
W. eWatson wrote: Jason Scheirer wrote: On Dec 16, 3:56 pm, "W. eWatson" wrote: Is there a way to highlight differences between the two files when printing in b/w? Help suggests there may be some texturing, but all I see is color choices. -- W. eWatson

Re: getting object instead of string from dir()

2008-12-17 Thread Kurt Smith
On Wed, Dec 17, 2008 at 1:52 PM, Rominsky wrote: > On Dec 17, 10:59 am, Christian Heimes wrote: > > Rominsky schrieb: > > > > > I am trying to use dir to generate a list of methods, variables, etc. > > > I would like to be able to go through the list and seperate the > > > objects by type using

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Bruno Desthuilliers
walterbyrd a écrit : On Dec 17, 8:41 am, prueba...@latinmail.com wrote: If scoping worked as you want, how, pray tell, would you define object attributes?- Hide quoted text - I suppose you could do this: class className(): varname = "whatever" This defines a class attribute - that is,

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Bruno Desthuilliers
walterbyrd a écrit : On Dec 17, 9:04 am, rdmur...@bitdance.com wrote: Yes. It's called Object Oriented Programming. I think you mean it's *Python* Object Oriented Programming. I am not sure that every other OO language works like that. Every OO languages having such a thing as a global va

Location HTTP Header

2008-12-17 Thread ptn
Hi all. I tried this stupid script on my server: #! /usr/bin/env python print 'Location: http://www.google.com\n' and it didn't work, I get a blank page. I first tried the Location header in another script, and when execution got to that point, it would just sort of ignore it,

Re: subprocess.Popen inheriting

2008-12-17 Thread Gabriel Genellina
En Wed, 17 Dec 2008 12:21:38 -0200, Jeremy Sanders escribió: Aaron Brady wrote: I thought so too. The web seems to say that on Linux they are, and on Windows, you need to call DuplicateHandle for it. Or set bInheritHandle=True when creating the pipe initially. os.pipe() doesn't do that

Re: The rule of literal string

2008-12-17 Thread Li Han
But what repr() do remain a black hole! Han -- http://mail.python.org/mailman/listinfo/python-list

C API and memory allocation

2008-12-17 Thread Floris Bruynooghe
Hi I'm slightly confused about some memory allocations in the C API. Take the first example in the documentation: static PyObject * spam_system(PyObject *self, PyObject *args) { const char *command; int sts; if (!PyArg_ParseTuple(args, "s", &command)) return NULL; sts = s

Re: help I'm getting delimited

2008-12-17 Thread John Machin
On Dec 18, 3:15 am, aka wrote: > John, this is the actual code I ran in TurboGears which is a Python > framework. It's not complete -- the change in indentation would have caused a SyntaxError. If (as you appear to assert) the problem is in the csv module, then create a small stand-alone no-Turb

Re: The rule of literal string

2008-12-17 Thread Scott David Daniels
Li Han wrote: But what repr() do remain a black hole! Han Try: print repr(repr("'")) that might enlighten you. -- http://mail.python.org/mailman/listinfo/python-list

Re: The rule of literal string

2008-12-17 Thread Li Han
On 12月18日, 上午7时12分, Scott David Daniels wrote: Scott wrote: > Try: print repr(repr("'")) > that might enlighten you. I found that print( repr( repr( arbitarystring ) ) ) == repr ( arbitarystring ) -- http://mail.python.org/mailman/listinfo/python-list

Re: The rule of literal string

2008-12-17 Thread Chris Rebert
2008/12/17 Li Han : > On 12月18日, 上午7时12分, Scott David Daniels wrote: > Scott wrote: >> Try: print repr(repr("'")) >> that might enlighten you. > > I found that print( repr( repr( arbitarystring ) ) ) == repr > ( arbitarystring ) As I stated previously, the key rule is: eval(repr(something)) ==

Re: The rule of literal string

2008-12-17 Thread James Mills
On Thu, Dec 18, 2008 at 9:25 AM, Chris Rebert wrote: > As I stated previously, the key rule is: > > eval(repr(something)) == something This rule is only true for basic data types; For example: >>> eval(repr(1)) == 1 True >>> eval(repr([1, 2, 3])) == [1, 2, 3] True >>> eval(repr({"a": 1, "b": 2,

Re: C API and memory allocation

2008-12-17 Thread Floris Bruynooghe
Hello again On Dec 17, 11:06 pm, Floris Bruynooghe wrote: > So I'm assuming PyArg_ParseTuple() > must allocate new memory for the returned string.  However there is > nothing in the API that provides for freeing that allocated memory > again. I've dug a little deeper into this and found that PyA

Re: The rule of literal string

2008-12-17 Thread Chris Rebert
On Wed, Dec 17, 2008 at 3:34 PM, James Mills wrote: > On Thu, Dec 18, 2008 at 9:25 AM, Chris Rebert wrote: >> As I stated previously, the key rule is: >> >> eval(repr(something)) == something > > This rule is only true for basic data types; > > For example: > eval(repr(1)) == 1 > True e

Re: Location HTTP Header

2008-12-17 Thread Gabriel Genellina
En Wed, 17 Dec 2008 20:52:42 -0200, ptn escribió: I tried this stupid script on my server: #! /usr/bin/env python print 'Location: http://www.google.com\n' and it didn't work, I get a blank page. I first tried the Location header in another script, and when execution got to

Re: The rule of literal string

2008-12-17 Thread Li Han
Chris worte: [snip] > And repr("''") ==> "\"''\"" > Which when print()-ed is: "''" > And eval("''") is the same as entering two apostrophes ('') at the > REPL, both of which give an empty string object. On my machine: >>> repr("''") '"\'\'"' Han -- http://mail.python.org/mailman/listinfo/python-li

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Rhodri James
On Wed, 17 Dec 2008 15:19:32 -, walterbyrd wrote: However in the methods are within a class, the scoping seems to work differently. Not really. Hopefully this commentary will show you why. class ab(): def a(self): self.x = 99 print self.x def b(self):

Re: The rule of literal string

2008-12-17 Thread Chris Rebert
On Wed, Dec 17, 2008 at 3:52 PM, Li Han wrote: > Chris worte: > [snip] >> And repr("''") ==> "\"''\"" >> Which when print()-ed is: "''" >> And eval("''") is the same as entering two apostrophes ('') at the >> REPL, both of which give an empty string object. > > On my machine: repr("''") > '"\

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Chris Rebert
On Wed, Dec 17, 2008 at 4:03 PM, Rhodri James wrote: > On Wed, 17 Dec 2008 15:19:32 -, walterbyrd wrote: > >> However in the methods are within a class, the scoping seems to work >> differently. > > Not really. Hopefully this commentary will show you why. > >> class ab(): >>def a(self):

[ANN] EuroPython 2009 – Call for Partic ipation!

2008-12-17 Thread Martin P. Hellwig
On behalf of the EuroPython 2009 organisation it is my privilege and honour to announce the 'Call for Participation' for EuroPython 2009! EuroPython is the conference for the communities around Python, including the Django, Zope and Plone communities. This years conference will be held in Birming

Re: getting object instead of string from dir()

2008-12-17 Thread Rominsky
On Dec 17, 1:21 pm, Jean-Paul Calderone wrote: > On Wed, 17 Dec 2008 11:52:17 -0800 (PST), Rominsky > wrote: > >On Dec 17, 10:59 am, Christian Heimes wrote: > >> Rominsky schrieb: > > >> > I am trying to use dir to generate a list of methods, variables, etc. > >> > I would like to be able to go

Re: C API and memory allocation

2008-12-17 Thread Gabriel Genellina
En Wed, 17 Dec 2008 21:35:04 -0200, Floris Bruynooghe escribió: On Dec 17, 11:06 pm, Floris Bruynooghe wrote: So I'm assuming PyArg_ParseTuple() must allocate new memory for the returned string.  However there is nothing in the API that provides for freeing that allocated memory again. I'

Re: subprocess.Popen inheriting

2008-12-17 Thread Aaron Brady
On Dec 17, 5:05 pm, "Gabriel Genellina" wrote: > En Wed, 17 Dec 2008 12:21:38 -0200, Jeremy Sanders   > escribió: > > > Aaron Brady wrote: > > >> I thought so too.  The web seems to say that on Linux they are, and on > >> Windows, you need to call DuplicateHandle for it. > > Or set bInheritHandle

Re: C API and memory allocation

2008-12-17 Thread Aaron Brady
On Dec 17, 6:42 pm, "Gabriel Genellina" wrote: > En Wed, 17 Dec 2008 21:35:04 -0200, Floris Bruynooghe   > escribió: > Yes; but you don't have to dig into the implementation; from   > http://docs.python.org/c-api/arg.html: > > s (string or Unicode object) [const char *] > Convert a Python string

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Steven D'Aprano
On Wed, 17 Dec 2008 22:19:43 +0100, Bruno Desthuilliers wrote: > Your > problem is that you are confusing variables and attributes. In Python, > 'anything.anyname' (note the dot) is the attribute 'anyname' of object > 'anything'. An easy mistake to make, given that scopes are just namespaces, and

Re: subprocess.Popen inheriting

2008-12-17 Thread Gabriel Genellina
En Wed, 17 Dec 2008 22:46:32 -0200, Aaron Brady escribió: On Dec 17, 5:05 pm, "Gabriel Genellina" wrote: En Wed, 17 Dec 2008 12:21:38 -0200, Jeremy Sanders   escribió: > It would be nice if Python created pipes that are properly inheritable by > default by child processes, as they're mos

Re: Why no lexical scoping for a method within a class?

2008-12-17 Thread Steven D'Aprano
On Wed, 17 Dec 2008 10:20:21 -0800, walterbyrd wrote: > On Dec 17, 10:00 am, r wrote: >> When writing >> procedural code how would you like it if vars inside functions were >> automatically global. Your code with be blowing chunks in no time. > > That was my point - I consider python's ordinary

Re: C API and memory allocation

2008-12-17 Thread Gabriel Genellina
En Wed, 17 Dec 2008 22:51:03 -0200, Aaron Brady escribió: On Dec 17, 6:42 pm, "Gabriel Genellina" wrote: En Wed, 17 Dec 2008 21:35:04 -0200, Floris Bruynooghe   escribió: > But how can python now know how long to keep that buffer object in > memory for? It doesn't - *you* have to ensure

Re: The rule of literal string

2008-12-17 Thread Steven D'Aprano
On Wed, 17 Dec 2008 15:25:41 -0800, Chris Rebert wrote: > 2008/12/17 Li Han : >> On 12月18日, 上午7时12分, Scott David Daniels wrote: >> Scott wrote: >>> Try: print repr(repr("'")) >>> that might enlighten you. >> >> I found that print( repr( repr( arbitarystring ) ) ) == repr ( >> arbitarystring ) >

Re: The rule of literal string

2008-12-17 Thread Steven D'Aprano
On Thu, 18 Dec 2008 09:34:12 +1000, James Mills wrote: > On Thu, Dec 18, 2008 at 9:25 AM, Chris Rebert wrote: >> As I stated previously, the key rule is: >> >> eval(repr(something)) == something > > This rule is only true for basic data types; Oops, missed this, and the follow ups. Note to se

Re: getting object instead of string from dir()

2008-12-17 Thread Steven D'Aprano
On Wed, 17 Dec 2008 11:52:17 -0800, Rominsky wrote: > I do have some understanding of the pythonic methodology of programming, > though by far I still don't consider myself an expert. The problem at > hand is that I am coming from a matlab world and trying to drag my > coworkers with me. I have g

Re: getting object instead of string from dir()

2008-12-17 Thread rdmurray
Quoth Rominsky : > vars seems to give an identical response as locals and globals, at > least in my test name space. All three are new commands for me. I Without arguments vars() returns the same thing as locals(). > like the idea of adopting either vars or locals instead of dir as it > sets up

Re: getting object instead of string from dir()

2008-12-17 Thread Steve Holden
Steven D'Aprano wrote: > On Wed, 17 Dec 2008 11:52:17 -0800, Rominsky wrote: > >> I do have some understanding of the pythonic methodology of programming, >> though by far I still don't consider myself an expert. The problem at >> hand is that I am coming from a matlab world and trying to drag my

  1   2   >