Return name of caller function?

2008-01-14 Thread Moshe Ben-Eliezer
Hello there, Did someone help you with this problem? I would like to know the solution as well. Do you know how to do in on C (CPP) environment ? Thanks anyway. BR. Moshe. This email and any files transmitted with it are confidential material. They are intende

Re: __init__ explanation please

2008-01-14 Thread A.T.Hofkamp
On 2008-01-13, Erik Lind <[EMAIL PROTECTED]> wrote: > I'm new to Python, and OOP. I've read most of Mark Lutz's book and more > online and can write simple modules, but I still don't get when __init__ > needs to be used as opposed to creating a class instance by assignment. For > some strange re

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-14 Thread Donn
> Can you please type > paf = ['/home/donn/.fontypython/M\xc3\x96gul.pog'] > f = open(paf, "r") I think I was getting a ghost error from another try somewhere higher up. You are correct, this does open the file - no matter what the locale is. I have decided to keep the test for a decode error be

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-14 Thread Martin v. Löwis
> I have decided to keep the test for a decode error because files created > under > different locales should not be written-to under the current one. I don't > know if one can mix encodings in a single text file, but I don't have time to > find out. Of course it's *possible*. However, you nee

Rapid desktop application development

2008-01-14 Thread Monica Francis
I am looking for Stephan Eilert who was an exchange student from Germany to the U.S. (Northern California) in the 1980's. Could you possibly be one in the same? Monica Erwin-Francis -- http://mail.python.org/mailman/listinfo/python-list

Re: NotImplimentedError

2008-01-14 Thread Gary Herron
hakim ouaras wrote: > Hi, > > I am begining with python, I want to know what is the utility and how > to use the expression "NotImplementedError". > > Thak you for your answers > Hakim > > > Never miss a thing. Make Yahoo your

Re: Elementary string-formatting

2008-01-14 Thread Odysseus
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: > > div operator? The integer division operator is // Yes, sorry, that's what I meant. -- Odysseus -- http://mail.python.org/mailman/listinfo/python-list

NotImplimentedError

2008-01-14 Thread hakim ouaras
Hi, I am begining with python, I want to know what is the utility and how to use the expression "NotImplementedError". Thak you for your answers Hakim Never miss a thing. Make Yahoo your home page.

Re: encrypting python modules

2008-01-14 Thread Paul Sijben
> How often do these things *actually* happen? > > Of those that actually do it, how many are clueless enough that when they > run into problems they blame you for it? (And remember that you won't > even find out about the non-clueless ones.) > > This is a rethorical question, right? -- http

Re: encrypting python modules

2008-01-14 Thread Robert Latest
Paul Sijben wrote: > The problem: I have a client-server app written in python. I want to > make sure that the client is not: > 1) destabilized by users accidentally or on purpose dropping python > files in the path (after which calling the helpdesk will not be useful) > 2) extended with "new feat

Re: encrypting python modules

2008-01-14 Thread Paul Sijben
Mike, thanks for the constructive feedback.Indeed i probably need to patch import in some way. Looks like there is no standard way to get this done. So I guess I have do it myself... In the famous last words department: how hard can that be? ;-) Paul Mike Meyer wrote: > On Sat, 12 Jan 2008 09

Pygtk Image Load Problem

2008-01-14 Thread Bowen
Hey I have a simple image load written in Python. Here is a link to the pastebin http://pastebin.com/m490093b3 I am having a problem when loading the full screen images, it is displaying a gray line at the bottom of the image as can be seen in this screen shot http://www.xiano.co.uk/image_load.pn

Re: NotImplimentedError

2008-01-14 Thread Duncan Booth
Gary Herron <[EMAIL PROTECTED]> wrote: > hakim ouaras wrote: >> Hi, >> >> I am begining with python, I want to know what is the utility and how >> to use the expression "NotImplementedError". >> >> Thak you for your answers >> Hakim >> > > It's meant to be used to mark a procedure that you intend

Re: encrypting python modules

2008-01-14 Thread Paul Sijben
Robert Latest wrote: > Paul Sijben wrote: > >> The problem: I have a client-server app written in python. I want to >> make sure that the client is not: >> 1) destabilized by users accidentally or on purpose dropping python >> files in the path (after which calling the helpdesk will not be useful)

Re: encrypting python modules

2008-01-14 Thread Steven D'Aprano
On Mon, 14 Jan 2008 09:49:49 +0100, Paul Sijben wrote: >> How often do these things *actually* happen? >> >> Of those that actually do it, how many are clueless enough that when >> they run into problems they blame you for it? (And remember that you >> won't even find out about the non-clueless o

Re: (bit)torrent source code help

2008-01-14 Thread cybergrind
Hi, Try to use ABC. it based on bittornado Thnx -- http://mail.python.org/mailman/listinfo/python-list

Re: __init__ explanation please

2008-01-14 Thread Jeroen Ruigrok van der Werven
-On [20080113 13:36], Fredrik Lundh ([EMAIL PROTECTED]) wrote: >given that they do different things, I'm not sure it's that helpful to >describe them *both* as constructors. I am still behind in my learning. ;) To restate it more correctly: __init__ is akin to a constructor. I am not entirely s

Re: __init__ explanation please

2008-01-14 Thread Ben Finney
"A.T.Hofkamp" <[EMAIL PROTECTED]> writes: > while you think you are doing "Person('me', 'here', 31)", you are in > reality executing "Person.__init__(self, 'me', 'here', 31)", where > 'self' is refers to a shiny new, empty object created for you. This is misleading, and founders on many discrepan

Re: __init__ explanation please

2008-01-14 Thread Jeroen Ruigrok van der Werven
-On [20080113 14:03], Ben Finney ([EMAIL PROTECTED]) wrote: >That's getting the two of them confused. __new__ is a constructor, >__init__ is not. And there I just sent an email stating the wrong thing. I'll dig into it again, because I am really confusing something here (and jumping between 4 lan

Re: where do my python files go in linux?

2008-01-14 Thread Nick Craig-Wood
Jeroen Ruigrok van der Werven <[EMAIL PROTECTED]> wrote: > -On [20080112 12:03], Jorgen Bodde ([EMAIL PROTECTED]) wrote: > >app.py calls a lot of modules in {dir}/app. Horst says the python file > >goes in /usr/bin/app.py which is ok with me, but I have multiple > >python files, and I decided to u

Re: Threaded server

2008-01-14 Thread Nick Craig-Wood
Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: > I'm trying to run an asynchronous FTP server I wrote into a thread for > being able to run a test suite against it. > The code below is the threaded FTP server code I'm using: > > class FTPd(threading.Thread): > > def __init__(self): >

Re: encrypting python modules

2008-01-14 Thread Robert Latest
Paul Sijben wrote: >> >> You could check the MD5 hashes of your files. > > indeed but I still need to hook into import to do that reliably, right? Depends. In a job I once had I just supplied a shell script that spat out the MD5 sums of my sources. When I got a support request I had the customer

Re: *** AMERICAN BASTARDS DESERVE TO BE RAPED ***

2008-01-14 Thread Gerardo Herzig
James Matthews wrote: >When did this list become a politics dialog? Please keep on topic "Python"! > >Thanks >James > >On Jan 12, 2008 8:07 PM, Joe Riopel <[EMAIL PROTECTED]> wrote: > > >>On Jan 12, 2008 2:00 PM, radiosrfun <[EMAIL PROTECTED]> wrote: >> >> >>>Whether we agree on "tactics" or

Re: __init__ explanation please

2008-01-14 Thread Hrvoje Niksic
Ben Finney <[EMAIL PROTECTED]> writes: > What one is "in reality" calling is the '__new__' method of the Person > class. That function, in turn, is creating a new Person instance, and > calling the '__init__' method of the newly-created instance. Finally, > the '__new__' method returns that insta

who can give me a good list.i am a new learner.

2008-01-14 Thread bill.wu
in this list: mail.python.org Mailing Lists. which one suits for learner. thanks very much. -- http://mail.python.org/mailman/listinfo/python-list

Re: encrypting python modules

2008-01-14 Thread Robert Latest
Steven D'Aprano wrote: > No, it's a serious question. You distribute Python code, and you're > worried that your users will modify the source code and then neglect to > mention it when they report bugs which they introduced. > > Before you build an elephant-proof fence around your house, it is q

Re: super, decorators and gettattribute

2008-01-14 Thread Michele Simionato
On Jan 14, 1:41 pm, Richard Szopa <[EMAIL PROTECTED]> wrote: > However, there's one piece that doesn't completely fit to the puzzle: > why does getattr work? The help says: > > getattr(...) > getattr(object, name[, default]) -> value > > Get a named attribute from an object; getattr(x, 'y')

Re: super, decorators and gettattribute

2008-01-14 Thread Richard Szopa
On Jan 13, 3:31 pm, thebjorn <[EMAIL PROTECTED]> wrote: > They do, except for when it comes to what super(..) returns. It isn't > really an object in the sense that they're presented in the tutorial, > but rather a sort of proxy to the methods in the ancestor classes of > the concrete object (self

Re: where do my python files go in linux?

2008-01-14 Thread Paul Boddie
On 14 Jan, 08:47, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > > Rather than re-inventing the wheel, please have a look at distutils: > http://docs.python.org/lib/module-distutils.html > > It does most if not all of the things you want to do. > If you want something more advanced, read about eggs. A

jpype with JFreeChart, anyone interested to help?

2008-01-14 Thread oyster
As you may know, there is no beautiful and free chart(not plot, you can find the examples at http://www.jfree.org/jfreechart, http://www.rmchart.com) module for python than runs on windows/linux/mac osx. On the other hand, there is a living package(http://www.jfree.org/jfreechart) for java, and it

ucs2 or ucs4?

2008-01-14 Thread Neal Becker
How do I tell if my python-2.5 is build with ucs2 or ucs4? -- http://mail.python.org/mailman/listinfo/python-list

Re: Threaded server

2008-01-14 Thread Giampaolo Rodola'
On 14 Gen, 12:30, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: > >  I'm trying to run an asynchronous FTP server I wrote into a thread for > >  being able to run a test suite against it. > >  The code below is the threaded FTP server code I'm using: > >

Re: ucs2 or ucs4?

2008-01-14 Thread Paul Hankin
On Jan 14, 12:56 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > How do I tell if my python-2.5 is build with ucs2 or ucs4? See if unichr(0x1) raises ValueError: if it does, you're ucs2. -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list

DBUS and exceptions

2008-01-14 Thread Frank Aune
Hi, Im using DBUS in my application to detect HW hotplugging and removal, which works great except for one thing: The code executed when a hotplugging is detected does not raise exceptions, even if my code contains errors. The event will just stop silently at the point where the exception occur

Re: Threaded server

2008-01-14 Thread Diez B. Roggisch
Giampaolo Rodola' wrote: > On 14 Gen, 12:30, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >> Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: >> > I'm trying to run an asynchronous FTP server I wrote into a thread for >> > being able to run a test suite against it. >> > The code below is the threaded FT

Re: ucs2 or ucs4?

2008-01-14 Thread Matt Nordhoff
Neal Becker wrote: > How do I tell if my python-2.5 is build with ucs2 or ucs4? You can also check sys.maxunicode. >>> import sys >>> sys.maxunicode If it's 1114111, you're UCS-4. If it's something much lower, you're UCS-2. -- -- http://mail.python.org/mailman/listinfo/python-list

Re: NotImplimentedError

2008-01-14 Thread George Sakkis
By the way, why do we need both NotImplementedError and the NotImplemented singleton object ? Couldn't we have just one of them ? -- http://mail.python.org/mailman/listinfo/python-list

[ANN] pylint 0.14 / logilab-astng 0.17.2

2008-01-14 Thread Sylvain Thénault
Hi there! I'm pleased to announce a new release of pylint [1] and logilab-astng [2]. I haven't personally found a lot of time to work on those projects since the latest releases but others contributors have and so I decided to publish releases including various contributions and other minor bug or

Re: NotImplimentedError

2008-01-14 Thread Neil Cerutti
On Jan 14, 2008 9:01 AM, George Sakkis <[EMAIL PROTECTED]> wrote: > By the way, why do we need both NotImplementedError and the > NotImplemented singleton object ? Couldn't we have just one of them ? I think we need both because an unimplemented method is an error, while an unimplemented rich com

Re: who can give me a good list.i am a new learner.

2008-01-14 Thread Bruno Desthuilliers
bill.wu a écrit : > in this list: mail.python.org Mailing Lists. > > which one suits for learner. Depends on your definition of "learner" !-) python.list (http://mail.python.org/mailman/listinfo/python-list) is mostly the same thing as this newsgroup (there's a bridge between the list and the

Re: __init__ explanation please

2008-01-14 Thread Wildemar Wildenburger
Jeroen Ruigrok van der Werven wrote: > To restate it more correctly: __init__ is akin to a constructor. > No. See Hrvoje Niksic's reply (and Ben Finney's to which it was a reply). __init__() /initializes/ an instance (automatically after creation). It is called, /after/ the instance has been con

csv add lines

2008-01-14 Thread Alexandru Dumitrescu
Hi, I'm new to this list and to python. I am wondering, am I able to make my program read the *.txt files from a directory and to add, at the top of the file, three new lines which are stored in a *.csv file? For each *.txt file I have a line in the *.csv file which has in the first column the

Re: csv add lines

2008-01-14 Thread Francesco Guerrieri
On Jan 14, 2008 3:52 PM, Alexandru Dumitrescu <[EMAIL PROTECTED]> wrote: > > > Hi, > I'm new to this list and to python. > > I am wondering, am I able to make my program read the *.txt files from a > directory and > > to add, at the top of the file, three new lines which are stored in a *.csv >

RE: encrypting python modules

2008-01-14 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Paul Sijben > Sent: Friday, January 11, 2008 4:45 AM > To: python-list@python.org > Subject: encrypting python modules > > > The problem: I have a client-server app written in python. I want to

Pydev 1.3.11 Released

2008-01-14 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.3.11 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: --

Re: where do my python files go in linux?

2008-01-14 Thread Nick Craig-Wood
Paul Boddie <[EMAIL PROTECTED]> wrote: > On 14 Jan, 08:47, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > > > > Rather than re-inventing the wheel, please have a look at distutils: > > http://docs.python.org/lib/module-distutils.html > > > > It does most if not all of the things you want to do. > > If

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-14 Thread Donn
Given that getlocale() is not to be used, what's the best way to get the locale later in the app? I need that two-letter code that's hidden in a typical locale like en_ZA.utf8 -- I want that 'en' part. BTW - things are hanging-together much better now, thanks to your info. I have it running in

Re: __init__ explanation please

2008-01-14 Thread Hrvoje Niksic
Wildemar Wildenburger <[EMAIL PROTECTED]> writes: > Jeroen Ruigrok van der Werven wrote: >> To restate it more correctly: __init__ is akin to a constructor. >> > No. See Hrvoje Niksic's reply (and Ben Finney's to which it was a > reply). > > __init__() /initializes/ an instance (automatically afte

Re: __init__ explanation please

2008-01-14 Thread Mel
Hrvoje Niksic wrote: > Wildemar Wildenburger <[EMAIL PROTECTED]> writes: > >> Jeroen Ruigrok van der Werven wrote: >>> To restate it more correctly: __init__ is akin to a constructor. >>> >> No. See Hrvoje Niksic's reply (and Ben Finney's to which it was a >> reply). >> >> __init__() /initializes/

Re: jpype with JFreeChart, anyone interested to help?

2008-01-14 Thread Peter Wang
On Jan 14, 6:51 am, oyster <[EMAIL PROTECTED]> wrote: > As you may know, there is no beautiful and free chart(notplot, you > can find the examples > athttp://www.jfree.org/jfreechart,http://www.rmchart.com) module for python > than runs on > windows/linux/mac osx. Actually, may I humbly suggest

Re: __init__ explanation please

2008-01-14 Thread Hrvoje Niksic
Mel <[EMAIL PROTECTED]> writes: >> I don't understand the purpose of this "correction". After all, >> __init__ *is* the closest equivalent to what other languages would >> call a constructor. > > Nevertheless, __init__ doesn't construct anything. Only if by "construct" you mean "allocate". __

module naming conventions

2008-01-14 Thread grackle
Obviously Java-style naming is a mistake in Python, since top-level names have to be unique. Is there a standard naming convention to facilitate mixing code from different sources, such as mygroupname_modulename? Is there a best practices guide for module naming? Thanks, David -- http://mail.py

Re: [Kamaelia] TCPClient: How to sense connection failure?

2008-01-14 Thread Michael Sparks
Bjoern Schliessmann wrote: > Whoops, the TCP client does in fact quit if the server closes > connection :) Great - so it wasn't a problem with the TCPClient after all :-) > For some reason, my Listener doesn't quit. I thought > it's sufficient to exit the main method in some way to quit a > co

RE: __init__ explanation please

2008-01-14 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Hrvoje Niksic > Sent: Monday, January 14, 2008 11:29 AM > To: python-list@python.org > Subject: Re: __init__ explanation please > > Mel <[EMAIL PROTECTED]> writes: > > >> I don't understand the

Re: IDLE won't start in Python 2.5 for Windows

2008-01-14 Thread mikez302
I was able to start IDLE from the command line, and reset my keyboard shortcuts. It works fine now. In case this happens again, where would I find the config file? -- http://mail.python.org/mailman/listinfo/python-list

Re: super, decorators and gettattribute

2008-01-14 Thread George Sakkis
On Jan 12, 6:56 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 12 Jan 2008 15:47:05 -0500, Mike Meyer wrote: > > There's an apparently common bug here: you don't want to pass super > > self.__class__, but the class that the method is bound to. > > Given an instance met

bags? 2.5.x?

2008-01-14 Thread Dan Stromberg
Is there a particular reason why bags didn't go into 2.5.x or 3000? I keep wanting something like them - especially bags with something akin to set union, intersection and difference. -- http://mail.python.org/mailman/listinfo/python-list

problem with logging exceptions with non-ASCII __str__ result

2008-01-14 Thread Karsten Hilbert
Dear all, I have a problem with logging an exception. environment: Python 2.4, Debian testing ${LANGUAGE} not set ${LC_ALL} not set ${LC_CTYPE} not set ${LANG}=de_DE.UTF-8 activating user-default locale with returns: [de_DE.UTF-8] local

Re: time.time or time.clock

2008-01-14 Thread dwblas
""" time.clock() isn't high enough resolution for Ubuntu, and time.time() isn't high enough resolution on windows. Take a look at datetime. It is good to the micro-second on Linux and milli-second on Windows. """ import datetime begin_time=datetime.datetime.now() for j in range(10): x =

Parsing links within a html file.

2008-01-14 Thread Shriphani
Hello, I have a html file over here by the name guide_ind.html and it contains links to other html files like guides.html#outline . How do I point BeautifulSoup (I want to use this module) to guides.html#outline ? Thanks Shriphani P. -- http://mail.python.org/mailman/listinfo/python-list

Re: Basic inheritance question

2008-01-14 Thread Lie
On Jan 7, 2:46 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Lie a écrit : > > > On Jan 5, 5:40 pm, [EMAIL PROTECTED] wrote: > > >>Jeroen Ruigrok van der Werven wrote: > > >>>Shouldn't this be: > > >>>self.startLoc = start > >>>self.stopLoc = stop > > >>Thanks! Of course it should. Old Java

Re: wxpython-wx.CheckListBox: changing item bacgkground color

2008-01-14 Thread Mike
On Jan 13, 9:22 am, Massi <[EMAIL PROTECTED]> wrote: > Hi everyone! In my application (under windows) I'm using a > wx.checklistbox. I would like the background color of an item to > become red whenever an EVT_LISTBOX_DCLICK occurs. Is there any simple > way to achieve it? > Thanks in advance. Did

short path evaluation, why is f() called here: dict(a=1).get('a', f())

2008-01-14 Thread aspineux
This append in both case dict(a=1).get('a', f()) dict(a=1).setdefault('a', f()) This should be nice if f() was called only if required. Regards. -- http://mail.python.org/mailman/listinfo/python-list

Re: Exceptions - How do you make it work like built-in exceptions?

2008-01-14 Thread Lie
On Jan 14, 1:51 am, "Mark Tolonen" <[EMAIL PROTECTED]> wrote: > "Lie" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > > >A built-in exceptions, when raised, would print traceback that points > > out the offending code, like this: > > > Traceback (most recent call last): > >  F

Re: short path evaluation, why is f() called here: dict(a=1).get('a', f())

2008-01-14 Thread Neil Cerutti
On Jan 14, 2008 1:39 PM, aspineux <[EMAIL PROTECTED]> wrote: > > This append in both case > > dict(a=1).get('a', f()) > dict(a=1).setdefault('a', f()) > > This should be nice if f() was called only if required. Shortcomings of those methods is probably why collections.defaultdict is so popular. >

Re: __init__ explanation please

2008-01-14 Thread Neil Cerutti
On Jan 14, 2008 12:08 PM, Reedick, Andrew <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:python- > > [EMAIL PROTECTED] On Behalf Of Hrvoje Niksic > > Sent: Monday, January 14, 2008 11:29 AM > > Only if by "construct" you mean "allocate". __init__ star

Re: short path evaluation, why is f() called here: dict(a=1).get('a', f())

2008-01-14 Thread Chris Mellon
On Jan 14, 2008 12:39 PM, aspineux <[EMAIL PROTECTED]> wrote: > > This append in both case > > dict(a=1).get('a', f()) > dict(a=1).setdefault('a', f()) > > This should be nice if f() was called only if required. > Think about the change to Python semantics that would be required for this to be tru

Re: Magic function

2008-01-14 Thread dg . google . groups
Hi Rüdiger, Thanks for your message. I liked your approach and I've been trying something along exactly these sorts of lines, but I have a few problems and queries. The first problem is that the id of the frame object can be re-used, so for example this code (where I haven't defined InstanceTrac

Re: short path evaluation, why is f() called here: dict(a=1).get('a', f())

2008-01-14 Thread aspineux
On Jan 14, 7:49 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Jan 14, 2008 12:39 PM, aspineux <[EMAIL PROTECTED]> wrote: > > > > > This append in both case > > > dict(a=1).get('a', f()) > > dict(a=1).setdefault('a', f()) > > > This should be nice if f() was called only if required. > > Think a

Re: __init__ explanation please

2008-01-14 Thread Hrvoje Niksic
"Reedick, Andrew" <[EMAIL PROTECTED]> writes: >> Only if by "construct" you mean "allocate". __init__ starts out >> with an empty object and brings it to a valid state, therefore >> "constructing" the object you end up with. That operation is >> exactly what other languages call a constructor. >

help with slicing/replacing matrix sections.

2008-01-14 Thread Erik Lind
I see a more complicated thread on a similar sounding question, but my question is simpler, I hope. I have a large numpy matrix, initially created as: Mat = zeros((a,b), int) and a smaller array with other data Sub = [1,2,3,4,5],[6,7,8,9,0] I want to replace a section of Mat matrix with Sub m

Re: time.time or time.clock

2008-01-14 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > """ > > time.clock() isn't high enough resolution for Ubuntu, and time.time() > isn't > high enough resolution on windows. > > Take a look at datetime. It is good to the micro-second on Linux and > milli-second on Windows. datetime.datetime.now() does the same thing

Re: How to get user home directory on Windows

2008-01-14 Thread Lie
On Jan 14, 8:21 am, "Martin P. Hellwig" <[EMAIL PROTECTED]> wrote: > Giampaolo Rodola' wrote: > > Hi all, > > I'm trying to use the pywin32 extension to find out the user's home > > directory but currently I didn't find a solution yet. > > What I'd need to do is not getting the home directory of th

Re: bags? 2.5.x?

2008-01-14 Thread Wildemar Wildenburger
Dan Stromberg wrote: > Is there a particular reason why bags didn't go into 2.5.x or 3000? > > I keep wanting something like them - especially bags with something akin > to set union, intersection and difference. > How about this recepie http://www.ubookcase.com/book/Oreilly/Python.Cookbook.2nd

SyntaxError: 'import *' not allowed with 'from .'

2008-01-14 Thread George Sakkis
Unless I missed it, PEP 328 doesn't mention anything about this. What's the reason for not allowing "from .relative.module import *' ? George -- http://mail.python.org/mailman/listinfo/python-list

Re: help with slicing/replacing matrix sections.

2008-01-14 Thread Robert Kern
Erik Lind wrote: > I see a more complicated thread on a similar sounding question, but my > question is simpler, I hope. numpy questions are usually answered better on the numpy mailing list. http://www.scipy.org/Mailing_Lists > I have a large numpy matrix, initially created as: > > Mat = z

Re: [Kamaelia] TCPClient: How to sense connection failure?

2008-01-14 Thread Bjoern Schliessmann
Michael Sparks wrote: > It is sufficient, and running with Kamaelia from /trunk, your > listener does indeed shutdown correctly Great, thanks for validating. :) > My suggestion for the moment would be to use the code on /trunk > since this is stable at present (development happens on branches >

Re: short path evaluation, why is f() called here: dict(a=1).get('a', f())

2008-01-14 Thread Paul Rubin
aspineux <[EMAIL PROTECTED]> writes: > Yes, I missed 'get' and 'setdefault' are functions :-) > Then why not some new semantic > > d.get('a', f()) --> d['a', f()] > d.setdefault('a', f()) --> d['a'=f()] > > Is is a good idea enough to change the python semantic ? > Or simply is it a good idea

Re: How to get user home directory on Windows

2008-01-14 Thread Giampaolo Rodola'
Thanks to Tim Golden suggestions I solved my problem. ...In case it would help someone: import _winreg import win32security username = 'Administrator' sid = win32security.ConvertSidToStringSid( win32security.LookupAccountName(None, username)[0] ) key = _winreg.OpenKey( _win

Dynamical scoping

2008-01-14 Thread George Sakkis
What's the best way to simulate dynamically scoped variables ala Lisp ? The use case is an open-ended set of objects that need to access the same piece of information (e.g. a dict, a ConfigParser object, a logger etc.). I know that the "proper" OO and functional way is to pass the information expl

Re: paging in python shell

2008-01-14 Thread Alex K
Hi Tim, Yes I mean piping the output into "more" for example. Alex On 14/01/2008, Tim Roberts <[EMAIL PROTECTED]> wrote: > "Alex K" <[EMAIL PROTECTED]> wrote: > > > >Does anyone know if the python shell supports paging or if I should > >look into iPython? Thank you so much. > > "Paging" is an ov

Re: time.time or time.clock

2008-01-14 Thread John Machin
On Jan 15, 4:50 am, [EMAIL PROTECTED] wrote: > """ > > time.clock() isn't high enough resolution for Ubuntu, and time.time() > isn't > high enough resolution on windows. > > Take a look at datetime. It is good to the micro-second on Linux and > milli-second on Windows. > """ On Windows, time.clo

Re: paging in python shell

2008-01-14 Thread John Machin
On Jan 15, 7:35 am, "Alex K" <[EMAIL PROTECTED]> wrote: > Hi Tim, > > Yes I mean piping the output into "more" for example. > Why don't you "suck it and see"??? E.g. C:\junk>copy con demomore.py for i in range(100): print 'line', i ^Z 1 file(s) copied. C:\junk>python demomore.py | m

Re: __init__ explanation please

2008-01-14 Thread Steven D'Aprano
On Mon, 14 Jan 2008 22:18:44 +1100, Ben Finney wrote: > What one is "in reality" calling is the '__new__' method of the Person > class. That function, in turn, is creating a new Person instance, and > calling the '__init__' method of the newly-created instance. Finally, > the '__new__' method retu

hide object property from dir() function?

2008-01-14 Thread jerryji
Hi, Sorry for this newbie question, I was puzzled why the existing property of an object is not shown in the dir() function output. "v" is an lxml Element object variable -- In [44]: v Out[44]: In [45]: dir(v) Out[45]: ['__copy__', '__deepcopy__', '__reduce__', 'append', 'clear', 'find',

Re: Simple List division problem

2008-01-14 Thread Pierre Quentel
On 12 jan, 19:37, marcstuart <[EMAIL PROTECTED]> wrote: > How do I divide a list into a set group of sublist's- if the list is > not evenly dividable ? > consider this example: > > x = [1,2,3,4,5,6,7,8,9,10] > y = 3 # number of lists I want to break x into > z = y/x > > what I would like to ge

Re: paging in python shell

2008-01-14 Thread Alex K
Thanks John, but would it be possible to remain in the python interpreter? On 14/01/2008, John Machin <[EMAIL PROTECTED]> wrote: > On Jan 15, 7:35 am, "Alex K" <[EMAIL PROTECTED]> wrote: > > Hi Tim, > > > > Yes I mean piping the output into "more" for example. > > > > Why don't you "suck it and se

Re: problem with logging exceptions with non-ASCII __str__ result

2008-01-14 Thread Vinay Sajip
On Jan 14, 5:46 pm, Karsten Hilbert <[EMAIL PROTECTED]> wrote: > Dear all, > > I have a problem withloggingan exception. > > environment: > > Python 2.4, Debian testing > > ${LANGUAGE} not set > ${LC_ALL} not set > ${LC_CTYPE} not set > ${LANG}=de_DE.UTF-8 >

Re: X/Linux mouse_event (like in win32api)

2008-01-14 Thread Atila Olah
Thank you Jorgen. Your answer helped me a lot. -- http://mail.python.org/mailman/listinfo/python-list

Re: hide object property from dir() function?

2008-01-14 Thread Matimus
On Jan 14, 1:20 pm, jerryji <[EMAIL PROTECTED]> wrote: > Hi, > > Sorry for this newbie question, I was puzzled why the existing > property of an object is not shown in the dir() function output. > > "v" is an lxml Element object variable -- > > In [44]: v > Out[44]: > > In [45]: dir(v) > Out[45]:

Re: short path evaluation, why is f() called here: dict(a=1).get('a', f())

2008-01-14 Thread Steven D'Aprano
On Mon, 14 Jan 2008 12:08:52 -0800, Paul Rubin wrote: > aspineux <[EMAIL PROTECTED]> writes: >> Yes, I missed 'get' and 'setdefault' are functions :-) Then why not >> some new semantic >> >> d.get('a', f()) --> d['a', f()] >> d.setdefault('a', f()) --> d['a'=f()] >> >> Is is a good idea enou

Re: encrypting python modules

2008-01-14 Thread Steven D'Aprano
On Mon, 14 Jan 2008 12:46:48 +, Robert Latest wrote: > And, contrary to the advice I gave elsethread, unfortunately it's > impossible to just drop uncooperative customers when you develop GPL > software ;-) Just because you are writing GPLed code doesn't mean you are permanently linked to an

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-14 Thread Martin v. Löwis
> Given that getlocale() is not to be used, what's the best way to get the > locale later in the app? You get the full locale name with locale.setlocale(category) (i.e. without the second argument) > I need that two-letter code that's hidden in a > typical locale like en_ZA.utf8 -- I want that

import from question

2008-01-14 Thread iu2
Hi all I've got three files: file a1.py: the_number = None file a2.py: import a1 def init(): a1.the_number = 100 file a3.py: from a1 import the_number import a2 a2.init() print the_number, type(the_number) Runninr a3.py I get: None Changing a3.py to: import a

Re: short path evaluation, why is f() called here: dict(a=1).get('a', f())

2008-01-14 Thread Tim Chase
> But how can Python determine when you want the result to be *the > callable* and when you want it to be *the result of calling the > callable*? > > Functions and other callables are first-class objects, and it is quite > reasonable to have something like this: > > map = {'a': Aclass, 'b': B

Re: super, decorators and gettattribute

2008-01-14 Thread thebjorn
On Jan 14, 1:41 pm, Richard Szopa <[EMAIL PROTECTED]> wrote: > On Jan 13, 3:31 pm, thebjorn <[EMAIL PROTECTED]> > wrote: > > > They do, except for when it comes to what super(..) returns. It isn't > > really an object in the sense that they're presented in the tutorial, > > but rather a sort of pro

Append zip files together, just get the binary data (in memory)

2008-01-14 Thread BerlinBrown
Is it possible to just build the binary content of a zip file. I want to create the content in memory (e.g. return binary data) and then get those byte strings representing the zip file? Is that possible? Or could I possibly override functions in the zip class. 1. Create a zip file object (e.g.

Re: __init__ explanation please

2008-01-14 Thread Ben Finney
Hrvoje Niksic <[EMAIL PROTECTED]> writes: > Wildemar Wildenburger <[EMAIL PROTECTED]> writes: > > __init__() /initializes/ an instance (automatically after > > creation). It is called, /after/ the instance has been constructed > > I don't understand the purpose of this "correction". After all, >

Re: encrypting python modules

2008-01-14 Thread Ben Finney
Robert Latest <[EMAIL PROTECTED]> writes: > And, contrary to the advice I gave elsethread, unfortunately it's > impossible to just drop uncooperative customers when you develop GPL > software ;-) On the contrary. The GPL includes a big fat "NO WARRANTY" clause. If you're not selling warranties to

Re: split parameter line with quotes

2008-01-14 Thread Ricardo Aráoz
teddyber wrote: > here's the solution i have for the moment : > > t = shlex.shlex(data) > t.wordchars = t.wordchars + "/+.-" > r='' > while 1: > token = t.get_token() > if not token: > break > if not token==',': r = r+token >

  1   2   >