Re: importing csv file into sqlite

2008-12-17 Thread klia
klia wrote: > > hey guys, i have a hug .csv file which i need to insert it into sqlite > database using python. > my csv data looks like this > Birthday2,12/5/2008,HTC,this is my birthday > Sea,12/3/2008,kodak,sea > birthday4,14/3/2009,samsung,birthday > love,17/4/2009,SONY,view of island > >

Re: sys.maxint in Python 2.6.1 (amd64) on Windows XP x64

2008-12-17 Thread Tim Roberts
Lin wrote: > >Ah, this makes sense. Thanks.. The main reason I'm trying 64-bit >Python is that I want to write files bigger than 4GB. This should work >on Windows x64, right? (i.e., are the pointers bona fide 64 bit?) Those two questions are not related. Win32 (NTFS) has always been able to

Re: C API and memory allocation

2008-12-17 Thread Stefan Behnel
Floris Bruynooghe wrote: > I'm slightly confused about some memory allocations in the C API. If you want to reduce the number of things you have to get your head around, learn Cython instead of the raw C-API. It's basically Python, does all the reference counting for you and also reduces the amoun

Re: importing csv file into sqlite

2008-12-17 Thread James Mills
On Thu, Dec 18, 2008 at 3:58 PM, klia wrote: > hey guys, i have a hug .csv file which i need to insert it into sqlite > database using python. > my csv data looks like this > Birthday2,12/5/2008,HTC,this is my birthday > Sea,12/3/2008,kodak,sea > birthday4,14/3/2009,samsung,birthday > love,17/4/20

Re: Relative imports in Python 3.0

2008-12-17 Thread Kay Schluehr
On 17 Dez., 11:01, Nicholas wrote: > I am sure I am not the first to run into this issue, but what is the > solution? When you use 2to3 just uncomment or delete the file fix_import.py in lib2to3/fixes/ . -- http://mail.python.org/mailman/listinfo/python-list

Re: importing csv file into sqlite

2008-12-17 Thread Chris Rebert
On Wed, Dec 17, 2008 at 9:58 PM, klia wrote: > > hey guys, i have a hug .csv file which i need to insert it into sqlite > database using python. > my csv data looks like this > Birthday2,12/5/2008,HTC,this is my birthday > Sea,12/3/2008,kodak,sea > birthday4,14/3/2009,samsung,birthday > love,17/4/

importing csv file into sqlite

2008-12-17 Thread klia
hey guys, i have a hug .csv file which i need to insert it into sqlite database using python. my csv data looks like this Birthday2,12/5/2008,HTC,this is my birthday Sea,12/3/2008,kodak,sea birthday4,14/3/2009,samsung,birthday love,17/4/2009,SONY,view of island can any one give me a head start c

Re: getting object instead of string from dir()

2008-12-17 Thread André
On Dec 17, 3:52 pm, 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 gotten a lot o

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[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

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

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

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

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

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

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

  1   2   >