Re: Difference between type and class

2008-08-04 Thread Gabriel Genellina
En Thu, 31 Jul 2008 09:30:19 -0300, Nikolaus Rath <[EMAIL PROTECTED]> escribi�: oj <[EMAIL PROTECTED]> writes: On Jul 31, 11:37 am, Nikolaus Rath <[EMAIL PROTECTED]> wrote: So why does Python distinguish between e.g. the type 'int' and the class 'myclass'? Why can't I say that 'int' is a cla

string to type object (C)

2008-08-04 Thread castironpi
Hello, I'm looking for a one-to-one function from strings to the built-in data types in C. I will be keeping the string in a file. I need the PyTypeObject* back from it. If nothing else I'll just do a bunch of strcmp( "tuple" ) { return &PyTuple_Type; } commands, provided &PyTuple_Type; will be

Re: Decimals not equalling themselves (e.g. 0.2 = 0.2000000001)

2008-08-04 Thread Gabriel Genellina
En Sun, 03 Aug 2008 19:57:10 -0300, Grant Edwards <[EMAIL PROTECTED]> escribi�: On 2008-08-03, Larry Bates <[EMAIL PROTECTED]> wrote: What are they teaching in computer science classes these days? When I was an undergrad the only courses that dealt with FP issues were classes on numerica

Re: Class definition attribute order

2008-08-04 Thread Gabriel Genellina
En Tue, 05 Aug 2008 00:05:58 -0300, Michele Simionato <[EMAIL PROTECTED]> escribió: On Aug 5, 4:38 am, "Gabriel Genellina": So the namespace that the metaclass receives when the class is created, will be some kind of ordered dictionary? Metaclasses are available for a long time ago, but th

Re: looking for IDE advice or workflow tips

2008-08-04 Thread William Pursell
On 4 Aug, 19:08, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm a novice developer at best and often work with the R statistical > programming language. I use an editor called TINN-R which allows me to > write a script, then highlight a few lines and send them to the > interpreter. I am using

Re: Class definition attribute order

2008-08-04 Thread Michele Simionato
On Aug 5, 7:47 am, Terry Reedy <[EMAIL PROTECTED]> wrote: > > Bfiefly, as I understood the discussion some months ago: In 2.x, the > class body is executed in a local namespace implemented as a normal dict > and *then* passed to the metaclass.  In 3.0, the metaclass gets brief > control *before* ex

Re: Class definition attribute order

2008-08-04 Thread Terry Reedy
Michele Simionato wrote: On Aug 5, 4:38 am, "Gabriel Genellina": So the namespace that the metaclass receives when the class is created, will be some kind of ordered dictionary? Metaclasses are available for a long time ago, but the definition order is lost right at the start, when the clas

ANN: decorator 2.3

2008-08-04 Thread Michele Simionato
The decorator module is a library written with the purpose of simplifying your life with decorators. It is now more than three years old and it is used in many Python frameworks (more than I know of). Release 2.3 adds support for writing decorator factories with a minimal effort (the feature was re

Re: looking for IDE advice or workflow tips

2008-08-04 Thread Ralf Schönian
[EMAIL PROTECTED] schrieb: I'm a novice developer at best and often work with the R statistical programming language. I use an editor called TINN-R which allows me to write a script, then highlight a few lines and send them to the interpreter. I am using pythonwin and it lacks this funtionality (

Re: SMTP via GMAIL

2008-08-04 Thread Tim Roberts
mmm <[EMAIL PROTECTED]> wrote: > >After reading about and using the smtplib module, I thought code such >as below would ignore the 'Cc: ' body line below when sending messages >and instead simply use the RECEIVERS list Correct. It is required by the SMTP spec to behave that way. >But when using

Re: looking for IDE advice or workflow tips

2008-08-04 Thread Terry Reedy
[EMAIL PROTECTED] wrote: I'm a novice developer at best and often work with the R statistical How does one check small blocks of code without typing them each time, running an entire script (with other code) or creating a small script for every code block? For example say lines 1-100 work f

Re: Keg - A python web framework

2008-08-04 Thread Kay Schluehr
> You can expect exactly 0 users and no appreciation for your > efforts which will/can lead to frustration and bad health. Is it really so bad to have no users and not becoming a "rock star programmer" but rather being a "poor poet programmer" (PPP) instead? -- http://mail.python.org/mailman/lis

Python packages on the Mac

2008-08-04 Thread arunasunil
Hi, I would like to copy the contents of the PythonFramework.pkg folder and run python without having to run the installer on the Mac. On windows it's simple to copy the contents of the python folder and the python dll's. How can this be done on the Mac? Thanks Sunil -- http://mail.python.org/mai

Re: Garbage collection of recursive inner function

2008-08-04 Thread Terry Reedy
[EMAIL PROTECTED] wrote: I encountered garbage collection behaviour that I didn't expect when using a recursive function inside another function: To understand this, it helps to realize that Python functions are not, in themselves, recursive. Recursiveness at any time is a property of a fu

Re: Class definition attribute order

2008-08-04 Thread Michele Simionato
On Aug 5, 4:38 am, "Gabriel Genellina": > > So the namespace that the metaclass receives when the class is created,   > will be some kind of ordered dictionary? > Metaclasses are available for a long time ago, but the definition order is   > lost right at the start, when the class body is executed.

Re: when does the GIL really block?

2008-08-04 Thread Craig Allen
On Aug 1, 2:28 pm, John Krukoff <[EMAIL PROTECTED]> wrote: > On Thu, 2008-07-31 at 18:27 -0700, Craig Allen wrote: > > I have followed the GIL debate in python for some time. I don't want > > to get into the regular debate about if it should be gotten rid of > > (though I am curious about the stat

Re: Class definition attribute order

2008-08-04 Thread Gabriel Genellina
En Fri, 01 Aug 2008 23:47:42 -0300, Benjamin <[EMAIL PROTECTED]> escribió: On Aug 1, 6:23 pm, Andrew Lentvorski <[EMAIL PROTECTED]> wrote: How do I determine the order of definition of class attributes? For example, if I have a class class Test(object):      y = 11      x = 22 How do I tell

Re: URLs and ampersands

2008-08-04 Thread Gabriel Genellina
En Mon, 04 Aug 2008 20:43:45 -0300, Steven D'Aprano <[EMAIL PROTECTED]> escribi�: I'm using urllib.urlretrieve() to download HTML pages, and I've hit a snag with URLs containing ampersands: http://www.example.com/parrot.php?x=1&y=2 Somewhere in the process, urls like the above are escaped to

Re: Teething troubles with Python on a Mac

2008-08-04 Thread Greg Ewing
Avinash Vora wrote: (Greg: You only sent the email to me: you probably wanted to add the mailing list to the recipients.) I replied to the newsgroup as well, so it should turn up in the list. Right, but I meant if there is an Apple-sanctioned way. I guess not? Not that I'm aware of. I g

Re: Wrapping C with Python

2008-08-04 Thread Terry Reedy
brad wrote: RPM1 wrote: ... Basically you just compile your C code as a regular C code dll. ctypes then allows you to access the functions in the dll very easily. Does that work with C++ code too or just C? On Windows, You can apparently works either with stdcall or cdecl functions. "cty

Re: Boolean tests [was Re: Attack a sacred Python Cow]

2008-08-04 Thread Terry Reedy
Erik Max Francis wrote: Antoon Pardon wrote: [responding to me] Maybe I'm going to be pedantic here, but I fear that your code won't work with matrices. The problem is that multiplication is not commutative with matrices. This means that matrices have two divisions a right and a left divisi

Re: Module re, extract on string match

2008-08-04 Thread Timothy Grant
On Mon, Aug 4, 2008 at 4:54 PM, Sriram Rajan <[EMAIL PROTECTED]> wrote: > I am wondering if I can use re.search to extract from a particular > location in a string. > Example: > string1='/Users/sriram/folder1/folder2/folder3/folder4/folder5/file' > re.search ('folder3,string1) > > > > Thanks, >

Re: PIL (etc etc etc) on OS X

2008-08-04 Thread Irmen de Jong
David C. Ullrich wrote: Just as well that the message sent earlier today seems to have been lost... Ok. Read your instructions on libjpeg. Read some of the install.doc. ./configure, fine. make, fine. "make test", fine. So I said "sudo make install" and this happened: 0-1d-4f-fc-28-d:jpeg-6b du

Module re, extract on string match

2008-08-04 Thread Sriram Rajan
I am wondering if I can use re.search to extract from a particular location in a string. Example: string1='/Users/sriram/folder1/folder2/folder3/folder4/folder5/file' re.search ('folder3,string1) Thanks, Sriram -- http://mail.python.org/mailman/listinfo/python-list

URLs and ampersands

2008-08-04 Thread Steven D'Aprano
I'm using urllib.urlretrieve() to download HTML pages, and I've hit a snag with URLs containing ampersands: http://www.example.com/parrot.php?x=1&y=2 Somewhere in the process, urls like the above are escaped to: http://www.example.com/parrot.php?x=1&y=2 which naturally fails to exist. I could

Re: What Python looks like

2008-08-04 Thread Mel
Ben Finney wrote: > iu2 <[EMAIL PROTECTED]> writes: >> Or Lisp for the first time looked like many words, no operators, how >> could that make a program???) > > I had no referent with which to compare Lisp when I first saw it. I > did wonder "if the program is so nicely indented anyway, why are al

Re: Why doesn't import work?

2008-08-04 Thread Benjamin Kaplan
On Mon, Aug 4, 2008 at 6:40 PM, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > On Aug 4, 3:34 pm, ssecorp <[EMAIL PROTECTED]> wrote: > > I have in Lib/site-packages a module named pdfminer. when I do import > > pdfminer it complains: > > > > >>> import pdfminer > > > > Traceback (most recent call last)

Re: Check if module is installed

2008-08-04 Thread Steven D'Aprano
On Mon, 04 Aug 2008 05:25:08 -0700, Kless wrote: > How to check is a library/module is installed on the system? I use the > next code but it's possivle that there is a best way. > > --- > try: > import foo > foo_loaded = True > except ImportError: > foo_loaded = False

Re: very large dictionary

2008-08-04 Thread Steven D'Aprano
On Mon, 04 Aug 2008 07:02:16 -0700, Simon Strobl wrote: > I created a python file that contained the dictionary. The size of this > file was 6.8GB. Ah, that's what I thought you had done. That's not a dictionary. That's a text file containing the Python code to create a dictionary. My guess is

Re: xlrd

2008-08-04 Thread John Machin
On Aug 4, 11:08 pm, [EMAIL PROTECTED] wrote: > here is working code that will read & display contents of all rows & columns > in all the sheets, you need xlrd 0.6.1 > > import xlrd, os, sys > > book = xlrd.open_workbook(sys.argv[1]) > print "The number of worksheets is", book.nsheets > for shx in

Re: Wrapping C with Python

2008-08-04 Thread RPM1
Anish Chapagain wrote: On 4 Aug, 14:14, brad <[EMAIL PROTECTED]> wrote: RPM1 wrote: ... Basically you just compile your C code as a regular C code dll. ctypes then allows you to access the functions in the dll very easily. Does that work with C++ code too or just C? Hi.. I havenot tried..

Re: Why doesn't import work?

2008-08-04 Thread Timothy Grant
On Mon, Aug 4, 2008 at 3:34 PM, ssecorp <[EMAIL PROTECTED]> wrote: > I have in Lib/site-packages a module named pdfminer. when I do import > pdfminer it complains: > import pdfminer > > Traceback (most recent call last): > File "", line 1, in >import pdfminer > ImportError: No module nam

Re: Why doesn't import work?

2008-08-04 Thread Sean DiZazzo
On Aug 4, 3:34 pm, ssecorp <[EMAIL PROTECTED]> wrote: > I have in Lib/site-packages a module named pdfminer. when I do import > pdfminer it complains: > > >>> import pdfminer > > Traceback (most recent call last): >   File "", line 1, in >     import pdfminer > ImportError: No module named pdfmine

Re: Wrapping C with Python

2008-08-04 Thread RPM1
brad wrote: RPM1 wrote: ... Basically you just compile your C code as a regular C code dll. ctypes then allows you to access the functions in the dll very easily. Does that work with C++ code too or just C? I believe it does work with C++ although I have not done that. Here's a simple ex

Why doesn't import work?

2008-08-04 Thread ssecorp
I have in Lib/site-packages a module named pdfminer. when I do import pdfminer it complains: >>> import pdfminer Traceback (most recent call last): File "", line 1, in import pdfminer ImportError: No module named pdfminer I created a file pdfminer.py and put it in site-packages and that

Re: What Python looks like

2008-08-04 Thread Ben Finney
iu2 <[EMAIL PROTECTED]> writes: > I'm curious, what did Python code look like to those of you who have > seen a bunch of Python code for the first time before knowing Python? To me it looked like the pseudo-code used for describing algorithms, allowing clear understanding and redesign of the algo

Re: Keg - A python web framework

2008-08-04 Thread bukzor
On Aug 4, 1:13 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > > I've been working on a python web framework which I think might be of > > interest to you. > > Details may be found athttp://code.google.com/p/keg/wiki/Concept. > > > All suggestions or comments will be greatly appreciated. > > I

os.path.normpath() for URLs?

2008-08-04 Thread Robert Dailey
Hi, I'm currently trying to parse relative URLs, but I want to make them absolute. In other words, I want to normalize the URLs. However, I don't want to have to write this logic myself if it is already provided. I was thinking of somehow tricking os.path.normpath() as a last resort. This is for s

Re: Check if module is installed

2008-08-04 Thread Wojtek Walczak
Dnia Mon, 4 Aug 2008 05:25:08 -0700 (PDT), Kless napisa�(a): > How to check is a library/module is installed on the system? I use the > next code but it's possivle that there is a best way. You may also be interested in techniques to keep your software compatible with older versions of python. Tak

Re: Newbie Python questions

2008-08-04 Thread Timothy Grant
On Mon, Aug 4, 2008 at 1:27 PM, LessPaul <[EMAIL PROTECTED]> wrote: > On Aug 2, 3:07 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: >> binaryjesus <[EMAIL PROTECTED]> wrote: >> >> >One great open source GUI package that you left out is GTK ie. pygtk. >> >i cant compare it with wx as i have never used i

Re: __new__

2008-08-04 Thread Rhamphoryncus
On Aug 4, 11:46 am, Ethan Furman <[EMAIL PROTECTED]> wrote: > Mel wrote: > > Ethan Furman wrote: > > >>Emile van Sebille wrote: > > >>>Ethan Furman wrote: > >    --> d25._int = (1, 5) > > >>>Python considers names that start with a leading underscore as internal > >>>or private, and that abuse

Re: Using two pythons in an application

2008-08-04 Thread Rhamphoryncus
On Aug 3, 5:43 pm, Allen <[EMAIL PROTECTED]> wrote: > Larry Bates wrote: > > Allen wrote: > >> I'm in the process of developing an application that will use Python > >> for a scripting support.  In light of the upcoming changes to Python, > >> I was wondering if it is possible to link to and use tw

Re: Trying to fix Invalid CSV File

2008-08-04 Thread Larry Bates
Ryan Rosario wrote: On Aug 4, 8:30 am, Emile van Sebille <[EMAIL PROTECTED]> wrote: John Machin wrote: On Aug 4, 6:15 pm, Ryan Rosario <[EMAIL PROTECTED]> wrote: On Aug 4, 1:01 am, John Machin <[EMAIL PROTECTED]> wrote: On Aug 4, 5:49 pm, Ryan Rosario <[EMAIL PROTECTED]> wrote: Thanks Emile!

Re: PIL (etc etc etc) on OS X

2008-08-04 Thread Kevin Walzer
David C. Ullrich wrote: Just as well that the message sent earlier today seems to have been lost... Ok. Read your instructions on libjpeg. Read some of the install.doc. ./configure, fine. make, fine. "make test", fine. So I said "sudo make install" and this happened: 0-1d-4f-fc-28-d:jpeg-6b dul

Re: PIL (etc etc etc) on OS X

2008-08-04 Thread David C. Ullrich
Just as well that the message sent earlier today seems to have been lost... Ok. Read your instructions on libjpeg. Read some of the install.doc. ./configure, fine. make, fine. "make test", fine. So I said "sudo make install" and this happened: 0-1d-4f-fc-28-d:jpeg-6b dullric$ sudo make install Pa

Re: Newbie Python questions

2008-08-04 Thread LessPaul
On Aug 2, 3:07 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > binaryjesus <[EMAIL PROTECTED]> wrote: > > >One great open source GUI package that you left out is GTK ie. pygtk. > >i cant compare it with wx as i have never used it but isay its much > >better than QT. > > >Anyway for ur q if u want to c

Re: Limits of Metaprogramming

2008-08-04 Thread castironpi
On Aug 4, 1:57 pm, Wilson <[EMAIL PROTECTED]> wrote: > On Aug 4, 6:49 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > Two, if all your methods will have uniform signatures and closures, > > you can store class methods as only their co_code objects: > > > >>> C.g.im_func.func_code.co_code > > > 'd\x

Re: What Python looks like

2008-08-04 Thread Mensanator
On Aug 4, 2:06 pm, iu2 <[EMAIL PROTECTED]> wrote: > Hi, > > This is a little bit strange post, but I'm curious... > > I learned Python from its tutorial step by step, and practicing > writing small scripts. > I haven't seen a Python program before knowing Python. > > I'm curious, what did Python co

Re: Keg - A python web framework

2008-08-04 Thread Daniel Fetchinson
> I've been working on a python web framework which I think might be of > interest to you. > Details may be found at http://code.google.com/p/keg/wiki/Concept. > > > All suggestions or comments will be greatly appreciated. I fail to see what the advantages of your framework are over django or turb

Re: What Python looks like

2008-08-04 Thread Gary Herron
iu2 wrote: Hi, This is a little bit strange post, but I'm curious... I learned Python from its tutorial step by step, and practicing writing small scripts. I haven't seen a Python program before knowing Python. I'm curious, what did Python code look like to those of you who have seen a bunch o

Re: What Python looks like

2008-08-04 Thread Larry Bates
iu2 wrote: Hi, This is a little bit strange post, but I'm curious... I learned Python from its tutorial step by step, and practicing writing small scripts. I haven't seen a Python program before knowing Python. I'm curious, what did Python code look like to those of you who have seen a bunch o

custom allocation and custom type

2008-08-04 Thread castironpi
Hi all, I am trying to create a custom tuple type. I want it to live in a custom memory region, which will be a memory-mapped file. Its contents cannot be PyObject*. They have to be offsets into mapped memory. GetItem( i ) would return: (PyObject *)( t->ob_item[ i ]+ mmap_base_addr ); In

What Python looks like

2008-08-04 Thread iu2
Hi, This is a little bit strange post, but I'm curious... I learned Python from its tutorial step by step, and practicing writing small scripts. I haven't seen a Python program before knowing Python. I'm curious, what did Python code look like to those of you who have seen a bunch of Python code

Re: Limits of Metaprogramming

2008-08-04 Thread Wilson
On Aug 4, 6:49 pm, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 4, 4:48 am, Wilson <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > My problem is that I don't know if it's possible to edit these states > > and then write them back to .py. Firstly, if my editing tool was to > > create a new state, I

Re: import * and py2exe

2008-08-04 Thread Larry Bates
Paul Sijben wrote: I am trying to turn my application into a WinXP exe. Py2exe has packaged all my files up into one humongous executable. When trying to run the app, it complains that it can not find modules I just saw it include. These invariably are modules that have been imported using

Re: UnicodeDecodeError, how to elegantly deal with this?

2008-08-04 Thread Edwin . Madari
if you can print out values of 'filemask', and 'thefile' variables, when it crashes, I can help. thx. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jorgen Bodde Sent: Monday, August 04, 2008 2:24 PM To: python-list@python.org Subject: UnicodeDec

Re: __new__

2008-08-04 Thread Ethan Furman
Mel wrote: Ethan Furman wrote: Emile van Sebille wrote: Ethan Furman wrote: --> d25._int = (1, 5) Python considers names that start with a leading underscore as internal or private, and that abuse is the burden of the abuser... Is bytecodehacks still around? That was serious abuse :

UnicodeDecodeError, how to elegantly deal with this?

2008-08-04 Thread Jorgen Bodde
Hi All, I am relatively new to python unicode pains and I would like to have some advice. I have this snippet of code: def playFile(cmd, args): argstr = list() for arg in appcfg.options[appcfg.CFG_PLAYER_ARGS].split(): thefile = args["file"] filemask = u"%file%" th

Re: Bidirectional Generators

2008-08-04 Thread william tanksley
Jeff <[EMAIL PROTECTED]> wrote: > william tanksley <[EMAIL PROTECTED]> wrote: > > I'm still curious, though, whether anyone's written any code that > > actually uses yield _and_ send() to do anything that isn't in the > > original PEP. > I have.  An iterator that could backtrack itself without the

Re: looking for IDE advice or workflow tips

2008-08-04 Thread Olexandr Melnyk
If you split your code into functions (what you should really do), you can use a simple unit-testing like setup: make a caller script for every function, so you can test them separately. On 8/4/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I'm a novice developer at best and often work with

Re: looking for IDE advice or workflow tips

2008-08-04 Thread Jeff
On Aug 4, 2:08 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm a novice developer at best and often work with the R statistical > programming language. I use an editor called TINN-R which allows me to > write a script, then highlight a few lines and send them to the > interpreter. I am usi

looking for IDE advice or workflow tips

2008-08-04 Thread [EMAIL PROTECTED]
I'm a novice developer at best and often work with the R statistical programming language. I use an editor called TINN-R which allows me to write a script, then highlight a few lines and send them to the interpreter. I am using pythonwin and it lacks this funtionality (that I can tell) and when I c

Re: Garbage collection of recursive inner function

2008-08-04 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Hi, I encountered garbage collection behaviour that I didn't expect when using a recursive function inside another function: the definition of the inner function seems to contain a circular reference, which means it is only collected by the mark-and-sweep collector, no

Re: Wrapping C with Python

2008-08-04 Thread Stefan Behnel
Anish Chapagain wrote: > I tried wrapping a simple C code suing SWIG to Python, but am having > problem, Try Cython. It's a Python-like language between Python and C that compiles to C code. It makes it very easy to call into C functions and to hide them behind a nice Python module. http://cython

Re: Object Manipulation and Frames

2008-08-04 Thread Mike Driscoll
> Thanks alot Mr.Driscoll, that snippet of code helped me alot..but i > was of the idea that the application should be cyclic in nature, that > it hould not exit even on failure to authenticate the user.My idea is > that once logged in i should be able to bring back the ligin screen on > full scr

Re: Limits of Metaprogramming

2008-08-04 Thread castironpi
On Aug 4, 4:48 am, Wilson <[EMAIL PROTECTED]> wrote: > Hi all, > > My problem is that I don't know if it's possible to edit these states > and then write them back to .py. Firstly, if my editing tool was to > create a new state, I would want to create the class (using type) and > attach it to the i

Re: Function editing with Vim throws IndentError

2008-08-04 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message <[EMAIL PROTECTED]>, Matimus wrote: On Jul 24, 9:32 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: In message <[EMAIL PROTECTED]>, Matimus wrote: On Jul 24, 2:54 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_z

Re: Function editing with Vim throws IndentError

2008-08-04 Thread Ethan Furman
Matimus wrote: On Jul 24, 9:32 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: In message <[EMAIL PROTECTED]>, Matimus wrote: On Jul 24, 2:54 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: In message <[EMAIL PROTECTED]>, Matimus wro

Garbage collection of recursive inner function

2008-08-04 Thread from . future . import
Hi, I encountered garbage collection behaviour that I didn't expect when using a recursive function inside another function: the definition of the inner function seems to contain a circular reference, which means it is only collected by the mark-and-sweep collector, not by reference counting. Here

Re: Bidirectional Generators

2008-08-04 Thread Jeff
On Aug 4, 12:39 pm, william tanksley <[EMAIL PROTECTED]> wrote: > Paddy <[EMAIL PROTECTED]> wrote: > > What's one of them then? > > I'm sorry, I don't know what you mean. > > Meanwhile, more pertinently: I did get my generator working, and then > I replaced it with a class that did the same thing i

Re: Bidirectional Generators

2008-08-04 Thread william tanksley
Paddy <[EMAIL PROTECTED]> wrote: > What's one of them then? I'm sorry, I don't know what you mean. Meanwhile, more pertinently: I did get my generator working, and then I replaced it with a class that did the same thing in less than a quarter of the number of lines. So... I'm not going to worry a

Re: Limits of Metaprogramming

2008-08-04 Thread Wilson
On 4 Aug, 16:50, John Nagle <[EMAIL PROTECTED]> wrote: > Wilson wrote: > > Hi all, > > > I have an interesting problem that I'm hoping can be solved with > > metaprogramming, but I don't know how far Python supports code > > generation (and I don't know if I'm taking the correct approach > > either

Re: Limits of Metaprogramming

2008-08-04 Thread Tomasz Rola
On Mon, 4 Aug 2008, Wilson wrote: > " Every sufficiently large application has a poor/incomplete > implementation of LISP embedded within it ". Yep, this is either exact or very close copy of what I have read. > I've looked at LISP > before and do appreciate its elegance, but Python has a beauty

Re: [unittest] Run setUp only once

2008-08-04 Thread Timothy Grant
On Sun, Aug 3, 2008 at 1:56 PM, Jorgen Grahn <[EMAIL PROTECTED]> wrote: > On Tue, 29 Jul 2008 20:12:14 +0200, Nikolaus Rath <[EMAIL PROTECTED]> wrote: >> Jean-Paul Calderone <[EMAIL PROTECTED]> writes: >>> On Tue, 29 Jul 2008 19:26:09 +0200, Nikolaus Rath <[EMAIL PROTECTED]> wrote: Jean-Paul Ca

Re: Trying to fix Invalid CSV File

2008-08-04 Thread Ryan Rosario
On Aug 4, 8:30 am, Emile van Sebille <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > On Aug 4, 6:15 pm, Ryan Rosario <[EMAIL PROTECTED]> wrote: > >> On Aug 4, 1:01 am, John Machin <[EMAIL PROTECTED]> wrote: > > >>> On Aug 4, 5:49 pm, Ryan Rosario <[EMAIL PROTECTED]> wrote: > Thanks Emile!

Re: Agnostic fetching

2008-08-04 Thread Diez B. Roggisch
Ivan Ven Osdel wrote: >>- Original Message - >>From: "Diez B. Roggisch" <[EMAIL PROTECTED]> >>To: python-list@python.org >>Sent: Saturday, August 2, 2008 11:05:07 AM GMT -06:00 US/Canada Central >>Subject: Re: Agnostic fetching > >>Bruce Frederiksen schrieb: >> On Fri, 01 Aug 2008 17:05:0

Re: Agnostic fetching

2008-08-04 Thread Ivan Ven Osdel
>- Original Message - >From: "Diez B. Roggisch" <[EMAIL PROTECTED]> >To: python-list@python.org >Sent: Saturday, August 2, 2008 11:05:07 AM GMT -06:00 US/Canada Central >Subject: Re: Agnostic fetching >Bruce Frederiksen schrieb: > On Fri, 01 Aug 2008 17:05:00 -0700, jorpheus wrote: > >> O

Re: PIL (etc etc etc) on OS X

2008-08-04 Thread David C. Ullrich
Thanks for the hand-holding. DU. In article <[EMAIL PROTECTED]>, Kevin Walzer <[EMAIL PROTECTED]> wrote: > > [more about installing libjpeg...] -- David C. Ullrich -- http://mail.python.org/mailman/listinfo/python-list

Re: Limits of Metaprogramming

2008-08-04 Thread John Nagle
Wilson wrote: Hi all, I have an interesting problem that I'm hoping can be solved with metaprogramming, but I don't know how far Python supports code generation (and I don't know if I'm taking the correct approach either... hence why I'm asking on this group): I'd like to write a program that w

Re: Trying to fix Invalid CSV File

2008-08-04 Thread Emile van Sebille
John Machin wrote: On Aug 4, 6:15 pm, Ryan Rosario <[EMAIL PROTECTED]> wrote: On Aug 4, 1:01 am, John Machin <[EMAIL PROTECTED]> wrote: On Aug 4, 5:49 pm, Ryan Rosario <[EMAIL PROTECTED]> wrote: Thanks Emile! Works almost perfectly, but is there some way I can adapt this to quote fields that

Re: Limits of Metaprogramming

2008-08-04 Thread Wilson
On 4 Aug, 14:47, Tomasz Rola <[EMAIL PROTECTED]> wrote: > On Mon, 4 Aug 2008, Wilson wrote: > > Hi all, > > Howdy, > > I am not sure if my remarks will be of any use for you, but here it goes. > > > I have an interesting problem that I'm hoping can be solved with > > metaprogramming, but I don't kn

import * and py2exe

2008-08-04 Thread Paul Sijben
I am trying to turn my application into a WinXP exe. Py2exe has packaged all my files up into one humongous executable. When trying to run the app, it complains that it can not find modules I just saw it include. These invariably are modules that have been imported using from import * Appa

Re: __new__

2008-08-04 Thread Mel
Ethan Furman wrote: > Emile van Sebille wrote: >> Ethan Furman wrote: >>> --> d25._int = (1, 5) >> >> Python considers names that start with a leading underscore as internal >> or private, and that abuse is the burden of the abuser... >> Is bytecodehacks still around? That was serious abuse

Re: Limits of Metaprogramming

2008-08-04 Thread Tomasz Rola
On Mon, 4 Aug 2008, Wilson wrote: > Hi all, > Howdy, I am not sure if my remarks will be of any use for you, but here it goes. > I have an interesting problem that I'm hoping can be solved with > metaprogramming, but I don't know how far Python supports code > generation (and I don't know if I

Re: sip.so: undefined symbol: PyUnicodeUCS4_AsWideChar

2008-08-04 Thread Alan Franzoni
Andreas Hinzmann was kind enough to say: > I have also tried to configure python with --enable-unicode=ucs4, but it > didn't help. But it should. try printing sys.maxunicode from your interpreter; if it's 2^16, then the interpreter is ucs2. If it's something more than 10 ^ 6, it's ucs4. -- Ala

Re: Strong/weak typing

2008-08-04 Thread Mel
Jorgen Grahn wrote: > I reuse names though, mostly because I don't want to invent additional > names which would feel "overburdened". I like this example better: > >months = range(1, 13) ># do something with the months-as-numbers list, ># and then: >months = [ monthname(x) for x

Re: very large dictionary

2008-08-04 Thread Simon Strobl
On 4 Aug., 00:51, Avinash Vora <[EMAIL PROTECTED]> wrote: > On Aug 4, 2008, at 4:12 AM, Jörgen Grahn wrote: > > > (You might want to post this to comp.lang.python rather than to me -- > > I am just another c.l.p reader. If you already have done to, please > > disregard this.) > > Yeah, I hit "repl

Locking around

2008-08-04 Thread Nikolaus Rath
Hello, I need to synchronize the access to a couple of hundred-thousand files[1]. It seems to me that creating one lock object for each of the files is a waste of resources, but I cannot use a global lock for all of them either (since the locked operations go over the network, this would make the

Re: Nlp, Python and period

2008-08-04 Thread Paul Boddie
On 4 Aug, 12:34, Fred Mangusta <[EMAIL PROTECTED]> wrote: > > thanks for replying. I'm interested in knowing more about your regex > approach, but as you point out in your comment, seems like access to the > sourceforge mail archive is restricted. Is there any way I can read > about it? Would you b

Re: Wrapping C API

2008-08-04 Thread Anish Chapagain
On 4 Aug, 14:20, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote: > Anish Chapagain wrote: > > I'm new to python and have a task for Wrapping up an old program > > written in C(20.c files), to provide GUI and chart,graph feature in > > Python. I've tried using SWIG but am not getting well in windows > >

Re: Wrapping C with Python

2008-08-04 Thread Anish Chapagain
On 4 Aug, 14:14, brad <[EMAIL PROTECTED]> wrote: > RPM1 wrote: > > ... > > > Basically you just compile your C code as a regular C code dll.  ctypes > > then allows you to access the functions in the dll very easily. > > Does that work with C++ code too or just C? Hi.. I havenot tried..before with

Re: Wrapping C API

2008-08-04 Thread Ulrich Eckhardt
Anish Chapagain wrote: > I'm new to python and have a task for Wrapping up an old program > written in C(20.c files), to provide GUI and chart,graph feature in > Python. I've tried using SWIG but am not getting well in windows > system, wish to receive guidelines for initiating the task... Two way

Re: __new__

2008-08-04 Thread Ethan Furman
Calvin Spealman wrote: [snip] ask if you really feel the need to know. I am. ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Wrapping C with Python

2008-08-04 Thread brad
RPM1 wrote: ... Basically you just compile your C code as a regular C code dll. ctypes then allows you to access the functions in the dll very easily. Does that work with C++ code too or just C? -- http://mail.python.org/mailman/listinfo/python-list

Re: xlrd

2008-08-04 Thread Edwin . Madari
here is working code that will read & display contents of all rows & columns in all the sheets, you need xlrd 0.6.1 import xlrd, os, sys book = xlrd.open_workbook(sys.argv[1]) print "The number of worksheets is", book.nsheets for shx in range(book.nsheets): sh = book.sheet_by_index(shx) p

Wrapping C API

2008-08-04 Thread Anish Chapagain
Hi!! I'm new to python and have a task for Wrapping up an old program written in C(20.c files), to provide GUI and chart,graph feature in Python. I've tried using SWIG but am not getting well in windows system, wish to receive guidelines for initiating the task... -- http://mail.python.org/mailman

Re: Check if module is installed

2008-08-04 Thread Chris Ortner
On Aug 4, 2:25 pm, Kless <[EMAIL PROTECTED]> wrote: > try: >     import foo >     foo_loaded = True > except ImportError: >     foo_loaded = False Many projects use this as the standard procedure to check a module's presence. I assume, this is the best way. Chris -- http://mail.python.org/mailman

Re: Limits of Metaprogramming

2008-08-04 Thread Wilson
On 4 Aug, 12:55, Jeff <[EMAIL PROTECTED]> wrote: > You could write a class composed of states and then use the pickle > module to serialize it to disk. Thanks Jeff. I guess this is my intermediary format! -- http://mail.python.org/mailman/listinfo/python-list

sip.so: undefined symbol: PyUnicodeUCS4_AsWideChar

2008-08-04 Thread Andreas Hinzmann
Hello! I am trying to install PyQt3 and I have the following problem: from qt import * gives the the following error: /.../python2.5/site-packages/sip.so: undefined symbol: PyUnicodeUCS4_AsWideChar I have installed the following software: qt-x11-free-3.3.6 Python2.5 sip-4.7.6 PyQt-x11-gpl-3

Re: Using two pythons in an application

2008-08-04 Thread Larry Bates
Allen wrote: Larry Bates wrote: Allen wrote: I'm in the process of developing an application that will use Python for a scripting support. In light of the upcoming changes to Python, I was wondering if it is possible to link to and use two different versions of Python so that in the future,

  1   2   >