Re: logging = logging.getLogger(__name__)

2010-06-15 Thread Paul Rudin
Peter Otten <__pete...@web.de> writes: > genkuro wrote: > >> Newbie here. I may be missing something obvious, in which case, >> please feel free to berate and laugh at me. >> >> Here's a dubious line of code: >> logging = logging.getLogger(__name__) > > Dubious indeed. As a workaround you can im

Re: Why is python not written in C++ ?

2010-08-05 Thread Paul Rudin
Lawrence D'Oliveiro writes: > In message , Roy Smith wrote: > >> C++, for all its flaws, had one powerful feature which made it very >> popular. It is a superset of C. > > Actually, it never was. Wondering off topic a bit - I am reminded of something I once read in some MS blurb... it described

Re: 3.2*2 is 9.6 ... or maybe it isn't?

2009-06-25 Thread Paul Rudin
Bojan Sudarevic writes: > Hi, > > I'm PHP developer and entirely new to Python. I installed it (version > 2.5.2, from Debian repos) today on the persuasion of a friend, who is a > Python addict. > > The first thing I typed into it was 3.2*3 (don't ask why I typed *that*, > I don*t know, I just

Re: timer

2009-06-30 Thread Paul Rudin
superpollo writes: > so why this does not work? > > 1 #!/usr/bin/python > 2 > 3 import threading > 4 > 5 e = threading.Event() > 6 t = threading.Timer(3.0, e.set()) The second arg needs to be a callable - maybe you meant e.set without the brackets? -- http:

Re: Why re.match()?

2009-07-07 Thread Paul Rudin
Bruno Desthuilliers writes: > kj a écrit : >> In <4a4e2227$0$7801$426a7...@news.free.fr> Bruno Desthuilliers >> writes: >> >>> kj a écrit : >>> (snipo To have a special-case re.match() method in addition to a general re.search() method is antithetical to language minimalism, >> >

Re: Compile kinterbasdb with mingw32 and python 2.6 - DLL load failed

2009-09-21 Thread Paul Rudin
Laszlo Nagy writes: >>> The building and installation went find. But I cannot "import kinterbasdb" >>> because I get a "DLL load failed" error. I figured out that has something to >>> do with msvcr90 and "_ftime". Can you please give me some advice how to >>> solve this problem? >>> >> >> Do

Re: Distributing Python-programs to Ubuntu users

2009-09-25 Thread Paul Rudin
Ben Finney writes: > Olof Bjarnason writes: > >> Most tutorials on the web still (I've read mostly Ubuntu-related >> forums) mention apt-get; seems like an error? > > Not quite an error (since ‘apt-get’ continues to work), just habit of > old-timers, and cargo-cult administration by newcomers.

Re: Printing the name of a variable

2010-09-10 Thread Paul Rudin
Stephen Boulet writes: > Does an arbitrary variable carry an attribute describing the text in > its name? I'm looking for something along the lines of: > > x = 10 > print x.name 'x' > > Perhaps the x.__getattribute__ method? Thanks. The first thing is... what is your use case for this? I'd

Re: Scheduling in python

2010-09-23 Thread Paul Rudin
loial writes: > I want to enable my end users to be able to schedule a task(actually > running another python or shell script). Rather than scheduling it > directly in cron, are there any python modules I could use? First hit when googling "python schedule"? -- http://mail.python.org/mailman/li

Re: check path.exists() with a "converted" path

2010-09-27 Thread Paul Rudin
Alessandro writes: > Hi, I'm a python newbie with a problem too hard to tackle. > > I have a string defining a path, were all the spaces have been > converted to underscores. > How can I find if it corresponds to a real path? > > e.g. a string like '/some/path_to/directory_1/and_to/directory_2' >

Re: Help with sets

2010-10-05 Thread Paul Rudin
"B. M. Whealton" writes: > I did get a bit confused in reading about the concept of sets in > python and why you would use them instead of a dictionary for example. Use a set when something is naturally modelled as a set... it's a collection of unordered objects that you can test for membership,

Re: Has Next in Python Iterators

2010-10-21 Thread Paul Rudin
Kelson Zawack writes: > Since an iterator having an end is not actually an exceptional case... There's no requirement on iterators to be finite, so in a sense it is. In general it may be impractical to know whether an iterator has reached the end without calling next(). -- http://mail.python

Re: Has Next in Python Iterators

2010-10-25 Thread Paul Rudin
Kelson Zawack writes: > The example I have in mind is list like [2,2,2,2,2,2,1,3,3,3,3] where > you want to loop until you see not a 2 and then you want to loop until > you see not a 3. "loop until you see not a 2" - you mean yield 2s as long as there are 2s to be consumed? "loop until you see

Re: is list comprehension necessary?

2010-10-26 Thread Paul Rudin
Andre Alexander Bell writes: > I occasionally use LCs, if they seem useful. However, what I don't like > about LCs is that they 'look-like' being a closed scope, while actually > they are in the scope of there call. Example: > i = 5 l = [i**2 for i in range(3)] i > 2 > Although:

Re: embarrassing class question

2010-10-29 Thread Paul Rudin
Gregory Ewing writes: > Brendan wrote: >> I use >> Python sporadically, and frequently use the dir command to learn or >> remind myself of class methods. > > You can clean up dir() by defining __all__ as a list of > names that you want to officially export. Other names will > still be there, but

Re: Python documentation too difficult for beginners

2010-11-02 Thread Paul Rudin
Steven D'Aprano writes: > A fair point -- the built-in open comes up as hit #30, whereas searching > for open in the PHP page brings up fopen as hit #1. But the PHP search > also brings up many, many hits -- ten pages worth. > OTOH googling for "python open" gives you the correct (for 2.7) pag

Re: functions, list, default parameters

2010-11-02 Thread Paul Rudin
Terry Reedy writes: > Suppose I write an nasty C extension that mutates tuples. What then > would be illegal about... Depends on exactly what we mean by legal. If immutability is part of the language spec (rather than an artifact of a particular implementation) then a compiler could assume immut

Re: What people are using to access this mailing list

2010-11-03 Thread Paul Rudin
John Bond writes: > On 3/11/2010 11:17 AM, Steven D'Aprano wrote: >> On Wed, 03 Nov 2010 08:02:29 +, John Bond wrote: >> >>> Hope this isn't too O/T - I was just wondering how people read/send to >>> this mailing list, eg. normal email client, gmane, some other software >>> or online service?

Re: What is the best way to handle a missing newline in the following case

2010-11-05 Thread Paul Rudin
"danmcle...@yahoo.com" writes: >> The problem is when I get to the last line. When the program sees '\n' >> after the 9, everything works fine. However, when there isn't a '\n', >> the program doesn't process the last line. >> >> What would be the best approach to handle the case of the possible

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-10 Thread Paul Rudin
Lawrence D'Oliveiro writes: > In message , Terry Reedy > wrote: > >> To echo John Nagle's point, if you want non-masochist volunteers to read >> your code, write something readable like: >> >> dict1 = {'ab': [[1,2,3,'d3','d4',5], 12], >> 'ac': [[1,3,'78a','79b'], 54], >> 'ad

Re: multiple discontinued ranges

2010-11-10 Thread Paul Rudin
xoff writes: > I was wondering what the best method was in Python programming for 2 > discontinued ranges. e.g. I want to use the range 3 to 7 and 17 to 23. > Am I obliged to use 2 for loops defining the 2 ranges like this: > > for i in range (3,7): > do bla > for i in range (7,17): > do bla >

Re: Is Eval *always* Evil?

2010-11-11 Thread Paul Rudin
Robert Kern writes: > On 2010-11-10 17:14 , Christian Heimes wrote: >> Am 10.11.2010 18:56, schrieb Simon Mullis: >> >> Yes, eval is evil, may lead to security issues and it's unnecessary >> slow, too. Still - it is used in the standard library... -- http://mail.python.org/mailman/listinfo/pyth

<    1   2   3