Re: Python is readable

2012-03-21 Thread Steve Howell
On Mar 21, 11:06 am, Nathan Rice wrote: > As for syntax, we have a lot of "real" domain specific languages, such > as English, math and logic. They are vetted, understood and useful > outside the context of programming.  We should approach the discussion > of language syntax from the perspective o

Re: Daemonization / Popen / pipe issue

2012-03-21 Thread Lee Clemens
On 03/18/2012 12:15 AM, Cameron Simpson wrote: > BTW, Lee, there is an external module for daemonising things in the UNIX > sense: > http://pypi.python.org/pypi/python-daemon > I recommend you use it. > > Cheers, I haven't updated the gist yet, but I did try it with the code below - but I get the

Re: Python is readable

2012-03-21 Thread Steve Howell
On Mar 21, 4:34 pm, Steven D'Aprano wrote: > On Wed, 21 Mar 2012 11:22:01 -0500, Evan Driscoll wrote: > > On 01/-10/-28163 01:59 PM, Steve Howell wrote: > >> Code shouldn't necessarily follow the example of English prose, but it > >> seems that English has had some influence: > > >>   1  push(stac

Re: Compiling Python (modules) on 64bit Windows - which compiler suite?

2012-03-21 Thread cjgohlke
On Wednesday, March 21, 2012 8:06:47 AM UTC-7, Ralph Heinkel wrote: > Hi, > > when processing our mass spectrometry data we are running against the > 2GB memory limit on our 32 bit machines. So we are planning to move to > 64bit. Downloading and installing the 64bit version of Python for > Windows

Re: Python is readable

2012-03-21 Thread Steven D'Aprano
On Wed, 21 Mar 2012 11:22:01 -0500, Evan Driscoll wrote: > On 01/-10/-28163 01:59 PM, Steve Howell wrote: >> Code shouldn't necessarily follow the example of English prose, but it >> seems that English has had some influence: >> >> 1 push(stack, item) # Push on the stack the item >> 2 push(

Re: Best way to disconnect from ldap?

2012-03-21 Thread Tim Chase
On 03/21/12 15:54, Chris Kaynor wrote: As Chris Rebert pointed out, there is no guarantee as to when the __del__ method is called. CPython will generally call it immediately, however if there are reference cycles it may never call it And more maddeningly, modules/objects used/called from within

Re: Best way to disconnect from ldap?

2012-03-21 Thread Chris Kaynor
On Wed, Mar 21, 2012 at 1:34 PM, Chris Rebert wrote: > > On Wed, Mar 21, 2012 at 12:30 PM, John Gordon wrote: > > I'm writing an application that interacts with ldap, and I'm looking > > for advice on how to handle the connection.  Specifically, how to > > close the ldap connection when the appli

Re: Best way to disconnect from ldap?

2012-03-21 Thread Chris Rebert
On Wed, Mar 21, 2012 at 12:30 PM, John Gordon wrote: > I'm writing an application that interacts with ldap, and I'm looking > for advice on how to handle the connection.  Specifically, how to > close the ldap connection when the application is done. > > I wrote a class to wrap an LDAP connection,

Re: Best way to disconnect from ldap?

2012-03-21 Thread J. Cliff Dyer
Write a context manager. Then you just do with MyLDAPWrapper() as ldap ldap.this() ldap.that() and when you leave the scope of the with statement, your ldap __exit__ method will get called regardless of how you left. Cheers, Cliff On Wed, 2012-03-21 at 19:30 +, John Gordon wrote:

Best way to disconnect from ldap?

2012-03-21 Thread John Gordon
I'm writing an application that interacts with ldap, and I'm looking for advice on how to handle the connection. Specifically, how to close the ldap connection when the application is done. I wrote a class to wrap an LDAP connection, similar to this: import ldap import ConfigParser

Re: Compiling Python (modules) on 64bit Windows - which compiler suite?

2012-03-21 Thread Thomas Bach
Hi, Ralph Heinkel writes: > Hi, > > when processing our mass spectrometry data we are running against the > 2GB memory limit on our 32 bit machines. So we are planning to move to > 64bit. Downloading and installing the 64bit version of Python for > Windows is trivial, but how do we compile our o

Re: ReportLab alternative for Python3

2012-03-21 Thread Emile van Sebille
On 3/21/2012 8:15 AM Katya said... Out of this GUI on user's request I want to create a report, > prefferebly in DOC or/and ODT or/and PDF or/and HTML formats. ReportLab which seems to be suitable is not ready for Python3. So, any reason why not to just run that part under python2 -- they t

Re: Python is readable

2012-03-21 Thread Nathan Rice
MOAR TROLLING... >> In my opinion, people who make statements such as "#1/2 are imperative, >> #3 is OO" are missing pretty much the entire point of what OO is. >> >> OO is much more about semantics and the way code is structured. The >> difference between #1/2 (especially #1, of course) and #3 is

Re: Compiling Python (modules) on 64bit Windows - which compiler suite?

2012-03-21 Thread Terry Reedy
On 3/21/2012 11:06 AM, Ralph Heinkel wrote: when processing our mass spectrometry data we are running against the 2GB memory limit on our 32 bit machines. So we are planning to move to 64bit. Downloading and installing the 64bit version of Python for Windows is trivial, but how do we compile our

Re: class checking its own module for an attribute

2012-03-21 Thread Rod Person
On Wed, 21 Mar 2012 17:59:56 +0100 Peter Otten <__pete...@web.de> wrote: > Rod Person wrote: > > > We have a module called constants.py, which contains [whatever] > > related to server names, databases, service account users and their > > passwords. > > Passwords? > Yes, not the best thing, bu

Re: class checking its own module for an attribute

2012-03-21 Thread Rod Person
On Wed, 21 Mar 2012 09:56:57 -0700 Chris Rebert wrote: > On Wed, Mar 21, 2012 at 8:25 AM, Rod Person > wrote: > > The question is there a way I can do this with out having to import > > constants when what it's doing is importing itself. It would seem > > to me that there should be a way for a

Re: class checking its own module for an attribute

2012-03-21 Thread Peter Otten
Rod Person wrote: > We have a module called constants.py, which contains [whatever] related to > server names, databases, service account users and their passwords. Passwords? > In order to be able to use constants as command line parameters for > calling from our batch files I created the class

Re: class checking its own module for an attribute

2012-03-21 Thread Chris Rebert
On Wed, Mar 21, 2012 at 8:25 AM, Rod Person wrote: > The question is there a way I can do this with out having to import > constants when what it's doing is importing itself. It would seem to me > that there should be a way for a module to reference itself. In that > thinking I have tried > >  if

Re: Python is readable

2012-03-21 Thread Steve Howell
On Mar 21, 9:22 am, Evan Driscoll wrote: > On 01/-10/-28163 01:59 PM, Steve Howell wrote: > > > > > > > > > > > Code shouldn't necessarily follow the example of English prose, but it > > seems that English has had some influence: > > >   1  push(stack, item) # Push on the stack the item > >   2  p

Re: Fast file data retrieval?

2012-03-21 Thread Stefan Behnel
Jorgen Grahn, 13.03.2012 21:44: > On Mon, 2012-03-12, MRAB wrote: >> Probably the best solution is to put it into a database. Have a look at >> the sqlite3 module. > > Some people like to use databases for everything, others never use > them. I'm in the latter crowd, so to me this sounds as overki

Re: Re: Python is readable

2012-03-21 Thread Evan Driscoll
On 01/-10/-28163 01:59 PM, Steve Howell wrote: Code shouldn't necessarily follow the example of English prose, but it seems that English has had some influence: 1 push(stack, item) # Push on the stack the item 2 push(item, stack) # Push the item on the stack 3 stack.push(item) # On the

Compiling Python (modules) on 64bit Windows - which compiler suite?

2012-03-21 Thread Ralph Heinkel
Hi, when processing our mass spectrometry data we are running against the 2GB memory limit on our 32 bit machines. So we are planning to move to 64bit. Downloading and installing the 64bit version of Python for Windows is trivial, but how do we compile our own C extension? Visual C ++ 2008 express

class checking its own module for an attribute

2012-03-21 Thread Rod Person
We have a module called constants.py, which contains related to server names, databases, service account users and there passwords. In order to be able to use constants as command line parameters for calling from our batch files I created the class below that checks to make sure the parameter valu

ReportLab alternative for Python3

2012-03-21 Thread Katya
I have a Python3 GUI, where user selects certain values to be statistically evaluated and/or plotted (matplotlib hist). Out of this GUI on user's request I want to create a report, prefferebly in DOC or/and ODT or/and PDF or/and HTML formats. The layout of the report is pretty much fixed, what

Re: List comprehension/genexp inconsistency.

2012-03-21 Thread J. Cliff Dyer
Thanks, Ian. That does seem to explain it. The inner loop doesn't have access to the class's name space, and of course you can't fix it by referencing Foo.y explicitly, because the class isn't fully defined yet. Ultimately, we realized that the dict should be created in the __init__ method, so t

Re: configobj validation

2012-03-21 Thread Andrea Crotti
On 03/21/2012 11:40 AM, Diez B. Roggisch wrote: Andrea Crotti writes: It works - so why do you bother? And I'm not sure about the above code - AFAIK, validation is a two-step thing: http://www.voidspace.org.uk/python/articles/configobj.shtml#validation Diez I don't agree, if you write code

Re: pypi and dependencies

2012-03-21 Thread Andrea Crotti
On 03/21/2012 11:38 AM, Diez B. Roggisch wrote: Andrea Crotti writes: When I publish something on Pypi, is there a way to make it fetch the list of dependencies needed by my project automatically? It would be nice to have it in the Pypi page, without having to look at the actual code.. Any ot

Re: urllib.urlretrieve never returns???

2012-03-21 Thread Laszlo Nagy
On 2012-03-20 22:26, Prasad, Ramit wrote: I just looked at your source file on ActiveState and noticed that you do not import traceback. That is why you are getting the AttributeError. Now you should be getting a much better error once you import it:) Nope. That would result in a NameError. After

Re: configobj validation

2012-03-21 Thread Diez B. Roggisch
Andrea Crotti writes: > On 03/19/2012 12:59 PM, Andrea Crotti wrote: >> I seemed to remember that type validation and type conversion worked >> out of the box, but now >> I can't get it working anymore. >> >> Shouldn't this simple example actually fail the parsing (instead it >> parses perfectly

Re: pypi and dependencies

2012-03-21 Thread Diez B. Roggisch
Andrea Crotti writes: > When I publish something on Pypi, is there a way to make it fetch the > list of dependencies needed by my project automatically? > > It would be nice to have it in the Pypi page, without having to look > at the actual code.. > Any other possible solution? I don't understa

Re: Python is readable

2012-03-21 Thread Chris Angelico
On Wed, Mar 21, 2012 at 6:57 PM, Steve Howell wrote: >  verb first: English-imperative ("boil water", "add noodles/salt", > "serve in dish") or math-functional, e.g. sum(a,b,c) >  verb middle: infix, arithmetic-like ("5 plus 4", "10 divided by 2") > or English-descriptive ("Dog bites man") In Eng

Re: Python is readable

2012-03-21 Thread Steve Howell
On Mar 21, 12:16 am, Chris Rebert wrote: > On Tue, Mar 20, 2012 at 11:52 PM, Steve Howell wrote: > > On Mar 20, 10:40 pm, Chris Angelico wrote: > >> On Wed, Mar 21, 2012 at 3:58 PM, Steve Howell wrote: > >> > So saying "push(stack, item)" or "push(item, stack)" seems very > >> > unsophisticated

Re: setup.py for an extension

2012-03-21 Thread Richard Thomas
Assuming you have: lib/__init__.py lib/foo.py lib/foo.c Then: from distutils.core import setup, Extension setup(name="lib", packages=["lib"], ext_modules=[Extension("lib._foo", ["lib/foo.c"])]) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-21 Thread Chris Rebert
On Tue, Mar 20, 2012 at 11:52 PM, Steve Howell wrote: > On Mar 20, 10:40 pm, Chris Angelico wrote: >> On Wed, Mar 21, 2012 at 3:58 PM, Steve Howell wrote: >> > So saying "push(stack, item)" or "push(item, stack)" seems very >> > unsophisticated, almost assembly-like in syntax, albeit at a higher

Re: Python is readable

2012-03-21 Thread Chris Angelico
On Wed, Mar 21, 2012 at 5:52 PM, Steve Howell wrote: > On the one hand, you say that "push(stack, item)" reads quite > differently from "stack.push(item)". > > On the other hand, you say they are "so close to identical as makes no > odds." > > I'm trying to make sense of that.  Are you saying that