Re: import issue with classes

2012-01-03 Thread Terry Reedy
On 1/3/2012 11:13 PM, Terry Reedy wrote: On 1/3/2012 10:06 PM, Andrew Berg wrote: On 1/3/2012 8:50 PM, Rodrick Brown wrote: Import FooA doesn't work and I need to use from FooA import FooA instead? This puzzles me. Thanks. If you have a module called FooA with a class called FooA, then import

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Terry Reedy
On 1/3/2012 8:04 PM, Devin Jeanpierre wrote: Can you give an actual example of such a definition of 'strongly typed object' that excludes Python objects? I'd love to, but I neglected to above because I don't really know where we share ideas, and I wouldn't want to jump ahead and say something

RE: python2.7 kill thread and find thread id

2012-01-03 Thread Yang Chun-Kai
Sorry for the misarrangement of my code in list, it happens everytime. I apologized. From: waitmefore...@hotmail.com To: python-list@python.org Subject: python2.7 kill thread and find thread id Date: Wed, 4 Jan 2012 14:10:46 +0800 Hello,guys!! I am using python2.7 to write a simple thread

Re: import issue with classes

2012-01-03 Thread Benjamin Kaplan
On Tue, Jan 3, 2012 at 9:50 PM, Rodrick Brown wrote: > I have a class FooB that derives from FooA > > i.e. > class FooB(FooA): >   FooA.__init__(self,...) > > Can someone explain why > > Import FooA doesn't work and I need to use from FooA import FooA instead? > This puzzles me. > Thanks. > > > >

python2.7 kill thread and find thread id

2012-01-03 Thread Yang Chun-Kai
Hello,guys!! I am using python2.7 to write a simple thread program which print the current running thread id and kill it with this id. But I have some questions with this. My code: -from threading import Threadclass t(Thread): def __init__(

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Ethan Furman
Ben Finney wrote: I have no idea what it would take to persuade you in particular. I do know that the combined privileges of being white, male, not-poor, and English-fluent (and many more privileges, I'm sure) grant both of us the luxury of barely even perceiving the harm done by a pervasive atmo

Re: import issue with classes

2012-01-03 Thread Terry Reedy
On 1/3/2012 10:06 PM, Andrew Berg wrote: On 1/3/2012 8:50 PM, Rodrick Brown wrote: Import FooA doesn't work and I need to use from FooA import FooA instead? This puzzles me. Thanks. If you have a module called FooA with a class called FooA, then import FooA imports the /module/. The class would

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Chris Angelico
On Wed, Jan 4, 2012 at 2:06 PM, Dan Sommers wrote: > On Wed, 04 Jan 2012 13:37:24 +1100, Chris Angelico wrote: > >> And "import pickle" objectifies pickles ... > > Not quite:  "import pickle" merely readies the machinery that objectifies > pickles.  In order to objectify a pickle, you have to call

Re: import issue with classes

2012-01-03 Thread Andrew Berg
On 1/3/2012 8:50 PM, Rodrick Brown wrote: > Import FooA doesn't work and I need to use from FooA import FooA > instead? This puzzles me. > Thanks. If you have a module called FooA with a class called FooA, then import FooA imports the /module/. The class would be FooA.FooA, just as the variable x

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Dan Sommers
On Wed, 04 Jan 2012 13:37:24 +1100, Chris Angelico wrote: > And "import pickle" objectifies pickles ... Not quite: "import pickle" merely readies the machinery that objectifies pickles. In order to objectify a pickle, you have to call pickle.loads: >>> import pickle # get ready to objectify

import issue with classes

2012-01-03 Thread Rodrick Brown
I have a class FooB that derives from FooA i.e. class FooB(FooA): FooA.__init__(self,...) Can someone explain why Import FooA doesn't work and I need to use from FooA import FooA instead? This puzzles me. Thanks. -- [ Rodrick R. Brown ] http://www.linkedin.com/in/rodrickbrown -- http://ma

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Ben Finney
Steven D'Aprano writes: > On Wed, 04 Jan 2012 12:54:09 +1100, Ben Finney wrote: > > It objectifies women. > > So you claim. I'm sure you have a hundred ready rationalisations for why a joke that has “girlfriend” as a fungible object, together with “car” and “house” as things to mechanically impo

Re: .format vs. %

2012-01-03 Thread alex23
8 Dihedral wrote: > This is a good evolution in Python. It is 2012 now and the text I/O part > is not as important as 10 years ago. The next move of Python could > be easy integration of C++ libraries. You mean like with Py++? http://pypi.python.org/pypi/pyplusplus/ > The auto code generatio

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Chris Angelico
On Wed, Jan 4, 2012 at 12:54 PM, Ben Finney wrote: > It objectifies women. If you can't see how that's harmful to women, I > haven't the stamina to educate you. And "import pickle" objectifies pickles. It's deplorable how few gherkins become programmers, and I think it's because of these immature

Re: Is there anyway to selectively inherit/import a class/module?

2012-01-03 Thread Peter
On Jan 4, 12:06 pm, Steven D'Aprano wrote: > On Tue, 03 Jan 2012 14:21:36 -0800, Peter wrote: > > I have a program that talks to a device via a serial interface. > > Structurally it looks like this: > > > Program A -> module B -> Serial > > I don't understand what this means. Program A points to m

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread alex23
On Jan 4, 6:38 am, Terry Reedy wrote: > Shredskin compiles a subset of > Python, or a subset of usages, to C, with similar benefits. That is, of course, 'Shedskin' and 'C++' :) +1 for either Cython or Shedskin as your next step for more performant Python. -- http://mail.python.org/mailman/listi

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Steven D'Aprano
On Wed, 04 Jan 2012 12:54:09 +1100, Ben Finney wrote: > Steven D'Aprano writes: [...] >> You're making an assumption there that I don't accept. There is no >> evidence that it is harmful to *anyone*, men or women. > > It objectifies women. So you claim. > If you can't see how that's harmful to

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Ben Finney
Steven D'Aprano writes: > On Wed, 04 Jan 2012 08:57:59 +1100, Ben Finney wrote: > > > Steven D'Aprano writes: > > > >> The joke cuts both ways. > > > > The fallacy is to ignore the fact that the playing field is not > > level. > > I'm not ignoring the fact of an unequal playing field. (The pla

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Steven D'Aprano
On Wed, 04 Jan 2012 08:57:59 +1100, Ben Finney wrote: > Steven D'Aprano writes: > >> The joke cuts both ways. > > This is the Just World fallacy: you're implying that, because the same > joke can be applied equally well to women or men, that therefore it is > equally harmful. The fallacy is to

Re: Python education survey

2012-01-03 Thread Steven D'Aprano
On Tue, 03 Jan 2012 04:33:45 -0800, Eelco wrote: >> Why do people use pretty when we already have words that carry more >> specific meaning? Because they are lazy! And laziness begets stupidity. > > No, that would be because they are not autistic. Most people like having > a repertoire of words w

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Steven D'Aprano
On Tue, 03 Jan 2012 05:08:47 -0800, Ethan Furman wrote: [...] >> "maybe policing uploads is worse than cluttering PyPI's disk space and >> RSS feed with dumb 1 KB packages." (Matt Chaput) >> >> I'd drop the "maybe". > > It's hard enough finding what one wants without having to wade through > cra

Re: Is there anyway to selectively inherit/import a class/module?

2012-01-03 Thread Steven D'Aprano
On Tue, 03 Jan 2012 14:21:36 -0800, Peter wrote: > I have a program that talks to a device via a serial interface. > Structurally it looks like this: > > Program A -> module B -> Serial I don't understand what this means. Program A points to module B, which points to ... what is Serial? Where i

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Devin Jeanpierre
> This strikes me as petty hair-splitting. Maybe it is! I don't know what "petty" means. > 1. By tacking on the qualification, I was acknowledging that someone, > somewhere, might controvert it. If you allow for arbitrary redefinitions of > words, you could claim that any statement is an opinion.

Re: Newbie Help

2012-01-03 Thread Steven D'Aprano
On Tue, 03 Jan 2012 17:13:17 -0600, mixolydian wrote: > I would like some advice on: > 1. IDEs Avoid them. Everything you need can be used with two applications: - a programmer's text editor; - a decent terminal (console) application. A decent text editor will allow you to have multiple files

Re: Newbie Help

2012-01-03 Thread Ben Finney
mixolydian writes: > I want to get into Python progamming for both local database > applications and dynamic web pages. Maybe some Q&D scripts. Welcome to the Python community. You have found a good general-purpose programming language, and I hope you find the right help for what you're trying t

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread gene heskett
On Tuesday, January 03, 2012 07:27:32 PM D'Arcy Cain did opine: > On 12-01-03 01:24 PM, gene heskett wrote: > > The solution is to chop the link between google.groups and this list. > > But that subject has been declared verboten. Too much inconvenience > > to ask the googlers to subscribe to the

Re: Python3 on MacOsX Lion?

2012-01-03 Thread Irmen de Jong
On 2-1-2012 20:32, K Richard Pixley wrote: > Where would I look to find the current expected status of python3 on MacOsX > Lion? > > The distributed binaries aren't capable of allowing extensions that use gcc. > > I can build the source naked, but then it lacks some libraries, notably, > readli

Re: Book authoring

2012-01-03 Thread Peter
On Jan 4, 9:34 am, wesley chun wrote: > fwiw, i've given a related talk a couple of times on this subject, the > most recent of which was at EuroPython this > summer:http://ep2011.europython.eu/conference/talks/writing-books-using-pyth... > > the content includes a couple of the tools mentioned i

Newbie Help

2012-01-03 Thread mixolydian
I want to get into Python progamming for both local database applications and dynamic web pages. Maybe some Q&D scripts. There is a ton of excellent language books. I have downloaded and installed 2.7.2 and got it working by pasting samples into IDLE, and uploading to my web server and doing tri

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Ben Finney
Terry Reedy writes: > On 1/3/2012 1:13 PM, Sean Wolfe wrote: > > > I have a theoretical / philosophical question regarding strong vs > > duck typing in Python. Let's say we wanted to type strongly in > > Python > > Python objects are strongly typed, in any sensible meaning of the > term. What you

Re: Large list in memory slows Python

2012-01-03 Thread Peter Otten
Benoit Thiell wrote: > I am experiencing a puzzling problem with both Python 2.4 and Python > 2.6 on CentOS 5. I'm looking for an explanation of the problem and > possible solutions. Here is what I did: > > Python 2.4.3 (#1, Sep 21 2011, 19:55:41) > IPython 0.8.4 -- An enhanced Interactive Python

Large list in memory slows Python

2012-01-03 Thread Benoit Thiell
Hi. I am experiencing a puzzling problem with both Python 2.4 and Python 2.6 on CentOS 5. I'm looking for an explanation of the problem and possible solutions. Here is what I did: Python 2.4.3 (#1, Sep 21 2011, 19:55:41) IPython 0.8.4 -- An enhanced Interactive Python. In [1]: def test(): ...

Re: [OT] Book authoring

2012-01-03 Thread wesley chun
fwiw, i've given a related talk a couple of times on this subject, the most recent of which was at EuroPython this summer: http://ep2011.europython.eu/conference/talks/writing-books-using-python-open-source-software the content includes a couple of the tools mentioned in this thread as well as som

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Ben Finney
Sean Wolfe writes: > Hello everybody, I'm a happy pythonista newly subscribed to the group. Welcome! > I have a theoretical / philosophical question regarding strong vs duck > typing in Python. Let's say we wanted to type strongly in Python There may be an unstated assumption there, and your w

Is there anyway to selectively inherit/import a class/module?

2012-01-03 Thread Peter
I have a program that talks to a device via a serial interface. Structurally it looks like this: Program A -> module B -> Serial I want to add a protocol layer around the serial port without modifying any of the modules above and I want to be able to use BOTH cases of the program whenever conveni

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Ben Finney
Peter Otten <__pete...@web.de> writes: > If you want more women in IT go to a local school and show the girls > things they can do with a computer that they find fun and interesting. > If you have a daughter try more Lego and less Barbies. I have no objection to doing those things *as well as* re

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Ben Finney
Steven D'Aprano writes: > The joke cuts both ways. This is the Just World fallacy: you're implying that, because the same joke can be applied equally well to women or men, that therefore it is equally harmful. The fallacy is to ignore the fact that the playing field is not level. Yes, that same

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Terry Reedy
On 1/3/2012 4:06 PM, Devin Jeanpierre wrote: Python objects are strongly typed, in any sensible meaning of the term. There are people that hold definitions of strong typing that preclude Python. Those people think their definition is reasonable, but at the Can you give an actual example of su

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Joshua Landau
On 3 January 2012 20:38, Terry Reedy wrote: > On 1/3/2012 1:13 PM, Sean Wolfe wrote: > > I have a theoretical / philosophical question regarding strong vs duck >> typing in Python. Let's say we wanted to type strongly in Python and >> > > Python objects are strongly typed, in any sensible meanin

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Devin Jeanpierre
> Python objects are strongly typed, in any sensible meaning of the term. There are people that hold definitions of strong typing that preclude Python. Those people think their definition is reasonable, but at the same time haven't confused static typing with strong typing. I guess the problem is

Re: .format vs. %

2012-01-03 Thread Stefan Krah
Neil Cerutti wrote: > On 2012-01-03, Stefan Krah wrote: > > $ ./python -m timeit -n 100 '"%s" % 7.928137192' > > 100 loops, best of 3: 0.0164 usec per loop > > % is faster, but not by an order of magnitude. > > On my machine: > > C:\WINDOWS>python -m timeit -n 100 -s "n=7.92" "'%s'

Re: .format vs. %

2012-01-03 Thread Ethan Furman
Neil Cerutti wrote: On 2012-01-03, Stefan Krah wrote: Andrew Berg wrote: To add my opinion on it, I find format() much more readable and easier to understand (with the exception of the {} {} {} {} syntax), and would love to see %-style formatting phased out. For me the %-style is much more r

Re: Regular expression : non capturing groups are faster ?

2012-01-03 Thread Devin Jeanpierre
> I tested 10 million matches on my computer using capturing groups and it took > ~ 6 seconds, but only ~ 2 seconds with non-capturing params. Are you talking about Python or Perl? I can't reproduce this in Python. Best I can do is a 3:4 ratio between running times. ('(a)* versus '(?:a)*) Also,

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Terry Reedy
On 1/3/2012 1:13 PM, Sean Wolfe wrote: I have a theoretical / philosophical question regarding strong vs duck typing in Python. Let's say we wanted to type strongly in Python and Python objects are strongly typed, in any sensible meaning of the term. What you mean is statically or explicitly t

Re: .format vs. %

2012-01-03 Thread Ethan Furman
Devin Jeanpierre wrote: "one obvious way" != "only one way" Which way is the obvious way? Why is it obvious? Apparently, %-style is obvious to C and similar coders, while {}-style is obvious to Java and similar coders. :) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting an environment variable.

2012-01-03 Thread Nobody
On Tue, 03 Jan 2012 15:45:20 +1000, Ashton Fagg wrote: > I'm working with an embedded machine, which is using a Python script to > oversee the acquisition of some data. The supervisor script, which is > run by crontab every 5 minutes, relies on an environment variable to be > set. I've tried to

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread Devin Jeanpierre
> Interesting. I read the list using gmail, and I never saw the > original post. IIn fact I rarely see any spam at all. Apparently, > somebody at google knows how to identify spam. I wonder why they can't > do it for google groups. > [I also wonder if anybody will see this post, coming from an ev

Re: Regular expression : non capturing groups are faster ?

2012-01-03 Thread Octavian Rasnita
From: "Devin Jeanpierre" Subject: Re: Regular expression : non capturing groups are faster ? >> You meant Perl Documentation, didn't you ? > > I guess that works too. I did mean Python, though -- its intent is to > say "you shouldn't worry about this", but in the process it says "this > does no

Re: .format vs. %

2012-01-03 Thread Joshua Landau
On 3 January 2012 19:46, Neil Cerutti wrote: > On 2012-01-03, Stefan Krah wrote: > > Andrew Berg wrote: > >> To add my opinion on it, I find format() much more readable and easier > >> to understand (with the exception of the {} {} {} {} syntax), and would > >> love to see %-style formatting ph

Re: .format vs. %

2012-01-03 Thread Devin Jeanpierre
> "one obvious way" != "only one way" Which way is the obvious way? Why is it obvious? For me, sprintf-formatting is "obviously" easier to use (less typing) unless you're pulling values from a dictionary or object, or already have all the variables stored in a dict you can pass in with **d. -- D

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Evan Driscoll
On 1/3/2012 13:13, Sean Wolfe wrote: > What I am driving at is, if we are coding in python but looking for > more performance, what if we had an option to 1) restrict ourselves > somewhat by using strong typing to 2) make it easy to compile or > convert down to C++ and thereby gain more performance

Unable to install xmldiff package on WIndows7

2012-01-03 Thread hisan
Hi All i have downloaded "xmldiff-0.6.10" from their official site (http:// www.logilab.org/859). I have tried installing the same on my 32 bit Windows 7 OS using the command "setup.py install" but below exceptions are thrown in the console. please help me out in installing this package on Windows

Re: .format vs. %

2012-01-03 Thread Ethan Furman
Ian Kelly wrote: http://mail.python.org/pipermail/python-dev/2009-September/092399.html Thanks, that link is very informative. Here's the link to the last discussion last February: http://mail.python.org/pipermail/python-dev/2011-February/108155.html ~Ethan~ -- http://mail.python.org/mailm

Re: .format vs. %

2012-01-03 Thread Neil Cerutti
On 2012-01-03, Stefan Krah wrote: > Andrew Berg wrote: >> To add my opinion on it, I find format() much more readable and easier >> to understand (with the exception of the {} {} {} {} syntax), and would >> love to see %-style formatting phased out. > > For me the %-style is much more readable. A

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Neil Cerutti
On 2012-01-03, David Harks wrote: > On 1/3/2012 12:13 PM, Sean Wolfe wrote: >> if we are coding in python but looking for >> more performance, > > Are you in fact in this situation? Despite years of folks > mentioning how Python is 'slower than C++', I've seen a project > where a developer churned

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread David Robinow
On Tue, Jan 3, 2012 at 2:24 PM, Benjamin Kaplan wrote: > On Tue, Jan 3, 2012 at 1:49 PM, D'Arcy Cain wrote: >> On 12-01-03 01:24 PM, gene heskett wrote: >>> >>> The solution is to chop the link between google.groups and this list.  But >>> that subject has been declared verboten. Too much inconve

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread D'Arcy Cain
On 12-01-03 02:24 PM, Benjamin Kaplan wrote: :0 Hir * ^List-Id:.*python-list.python.org * ^From:.*@gmail.com * ^Newsgroups:.* /dev/null -- Wouldn't that just kill everything sent from a gmail account? That's not the same thing as Google Groups. The mailing list posts, at least, have an "Organi

Re: Repeating assertions in regular expression

2012-01-03 Thread Devin Jeanpierre
> Put simply, it doesn't occur often enough to be worth it. The cost > outweighs the potential benefit. I don't buy it. You could backtrack instead of failing for \b+ and \b*, and it would be almost as fast as this optimization. -- Devin On Tue, Jan 3, 2012 at 1:57 PM, MRAB wrote: > On 03/01/20

Re: Regular expression : non capturing groups are faster ?

2012-01-03 Thread Devin Jeanpierre
> You meant Perl Documentation, didn't you ? I guess that works too. I did mean Python, though -- its intent is to say "you shouldn't worry about this", but in the process it says "this does not exist" (a lie). "slightly better performance" would be accurate, as said by Goyvaerts/ -- Devin On T

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread Benjamin Kaplan
On Tue, Jan 3, 2012 at 1:49 PM, D'Arcy Cain wrote: > On 12-01-03 01:24 PM, gene heskett wrote: >> >> The solution is to chop the link between google.groups and this list.  But >> that subject has been declared verboten. Too much inconvenience to ask the >> googlers to subscribe to the real list I

Re: [Tutor] Parse multi line with re module.

2012-01-03 Thread Joel Goldstick
On Tue, Jan 3, 2012 at 12:51 PM, Robert Sjoblom wrote: > On 3 January 2012 16:21, Joel Goldstick wrote: >> -- > > Joel, when you start your emails with this (two dashes) some email > readers (gmail among them) will think you're ending your email; I have > to expand your post because it thinks tha

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread David Harks
On 1/3/2012 12:13 PM, Sean Wolfe wrote: if we are coding in python but looking for more performance, Are you in fact in this situation? Despite years of folks mentioning how Python is 'slower than C++', I've seen a project where a developer churned out a feature using Python's generators that

Re: Repeating assertions in regular expression

2012-01-03 Thread MRAB
On 03/01/2012 09:45, Devin Jeanpierre wrote: \\b\\b and \\b{2} aren't equivalent ? This sounds suspiciously like a bug! Why the wording is "should never" ? Repeating a zero-width assertion is not forbidden, for instance : import re re.compile("\\b\\b\w+\\b\\b") <_sre.SRE_Pattern obje

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread D'Arcy Cain
On 12-01-03 01:24 PM, gene heskett wrote: The solution is to chop the link between google.groups and this list. But that subject has been declared verboten. Too much inconvenience to ask the googlers to subscribe to the real list I guess. Because my spamassassin Perhaps they just need to be r

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread D'Arcy Cain
On 12-01-03 01:13 PM, Sean Wolfe wrote: Hello everybody, I'm a happy pythonista newly subscribed to the group. Welcome. The question is, given this possibility, would this get us closer to being able to compile down to a language like C or C++? That's "a" question. "The" question is "do yo

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Jérôme
Tue, 3 Jan 2012 09:58:35 -0800 (PST) Adam Skutt a écrit: > If you're really insistent on using the sox(1) command-line tools to play > your sounds, then you'll have to send SIGINT or SIGTERM in order to tell it > to terminate (which can be done just by calling the terminate() method). > > Which i

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread gene heskett
On Tuesday, January 03, 2012 01:13:08 PM John Ladasky did opine: > On Jan 3, 7:40 am, BV wrote: > > MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS > > Q0. Why do thousand-line religious posts appear in comp.lang.python? Already discussed, at considerable length & I got told off. The solution is to

Re: python philosophical question - strong vs duck typing

2012-01-03 Thread Nathan Rice
On Tue, Jan 3, 2012 at 1:13 PM, Sean Wolfe wrote: > Hello everybody, I'm a happy pythonista newly subscribed to the group. > How is it going? > I have a theoretical / philosophical question regarding strong vs duck > typing in Python. Let's say we wanted to type strongly in Python and > were willi

Re: .format vs. %

2012-01-03 Thread Ian Kelly
On Jan 3, 2012 6:55 AM, "Ethan Furman" wrote: > > Ian Kelly wrote: >> >> I'm not sure it's true that "there are no plans to do so in the >> foreseeable future." According to the release notes from Python 3.0, >> % formatting was supposed to be deprecated in Python 3.1. > > > Eric Smith wrote (fro

python philosophical question - strong vs duck typing

2012-01-03 Thread Sean Wolfe
Hello everybody, I'm a happy pythonista newly subscribed to the group. How is it going? I have a theoretical / philosophical question regarding strong vs duck typing in Python. Let's say we wanted to type strongly in Python and were willing to compromise our code to the extent necessary, eg not cha

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Adam Skutt
On Jan 3, 10:09 am, Jérôme wrote: > Tue, 3 Jan 2012 06:12:59 -0800 (PST) > Adam Skutt a écrit: > > > The conservative approach is to use another IPC mechanism to talk to > > the process, such as a pipe or a socket.  Why are you trying to send > > the child process SIGINT in the first place? > > Sa

Re: pickling instances of metaclass generated classes

2012-01-03 Thread Ian Kelly
> Ok, > > After reading all posts (thanks a lot), I am considering to use the > following base metaclass for all metaclasses that must lead to > pickleable instances (not pickleable classes): > > > import sys > > class Meta(type): >def __new__(mcls, name, bases, attrs): >cls = type.__ne

Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread John Ladasky
On Jan 3, 7:40 am, BV wrote: > MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS Q0. Why do thousand-line religious posts appear in comp.lang.python? -- http://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] Parse multi line with re module.

2012-01-03 Thread Robert Sjoblom
On 3 January 2012 16:21, Joel Goldstick wrote: > -- Joel, when you start your emails with this (two dashes) some email readers (gmail among them) will think you're ending your email; I have to expand your post because it thinks that what is hidden is the signature. Just thought you should know.

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Jérôme
Tue, 3 Jan 2012 17:24:44 +0100 Jérôme a écrit: > > Too many libraries do too many questionable things with signal handlers > > so I find it much safer and easier just to avoid the damn things whenever > > possible. > > My small program _seems to_ work with the dirty hacks I already exposed. > Yet

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Jérôme
Tue, 3 Jan 2012 07:03:08 -0800 (PST) Adam Skutt a écrit: > On Jan 3, 4:38 am, Jérôme wrote: > > I have an application that can spawn a subprocess to play a beep. I want > > it to kill the subprocess when exiting. > > Why? You shouldn't need to send a signal to tell the process to > terminate: i

Re: .format vs. %

2012-01-03 Thread 88888 Dihedral
davidfx於 2012年1月1日星期日UTC+8上午2時19分34秒寫道: > Hello everyone, > I just have a quick question about .format and %r %s %d. > > Should we always be using .format() for formatting strings or %? > > Example a = 'apples' > print "I love {0}.".format(a) > > If I wanted to put .format into a

Re: .format vs. %

2012-01-03 Thread Neil Cerutti
On 2012-01-03, Neil Cerutti wrote: > On 2012-01-03, Stefan Krah wrote: >> Neil Cerutti wrote: >>> > In the real-world telco benchmark for _decimal, replacing the >>> > single line >>> > >>> > outfil.write("%s\n" % t) >>> > >>> > with >>> > >>> > outfil.write("{}\n".format(t)) >>> > >>> >

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Adam Skutt
On Jan 3, 4:38 am, Jérôme wrote: > I have an application that can spawn a subprocess to play a beep. I want it > to kill the subprocess when exiting. Why? You shouldn't need to send a signal to tell the process to terminate: it should terminate when its stdin is closed or when it's done playing

Re: [Tutor] Parse multi line with re module.

2012-01-03 Thread Joel Goldstick
On Tue, Jan 3, 2012 at 9:13 AM, Ganesh Kumar wrote: > Hi Guys, > > I want parse multiple line. with re.module, this is my given string > http://dpaste.com/680760/ I have try with re.compile module. I want parse > two line mac address and channel, > I have done with for mac address finding > > r =

Re: Can't write to a directory made w/ os.makedirs

2012-01-03 Thread David Goldsmith
On Jan 1, 7:43 pm, MRAB wrote: > On 02/01/2012 03:14, David Goldsmith wrote: > > > > > > > > > > > On Jan 1, 7:05 am, Tim Golden  wrote: > >>  On 01/01/2012 12:05, David Goldsmith wrote: > >>    >>  ie can the Python process creating the directories, > > >>    >  Yes. > > >>    >>  and a subproces

Re: .format vs. %

2012-01-03 Thread Neil Cerutti
On 2012-01-03, Stefan Krah wrote: > Neil Cerutti wrote: >> > In the real-world telco benchmark for _decimal, replacing the >> > single line >> > >> > outfil.write("%s\n" % t) >> > >> > with >> > >> > outfil.write("{}\n".format(t)) >> > >> > adds 23% to the runtime. I think %-style formatt

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Adam Skutt
On Jan 2, 11:53 pm, Cameron Simpson wrote: > On 02Jan2012 19:16, Adam Skutt wrote: > | On Jan 2, 8:44 pm, Cameron Simpson wrote: > | > On 02Jan2012 20:31, Devin Jeanpierre wrote: > | > | > I think that catching the exception is probably the most Pythonic way. > | > | > | > | It's the only corre

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Jérôme
Tue, 3 Jan 2012 06:12:59 -0800 (PST) Adam Skutt a écrit: > The conservative approach is to use another IPC mechanism to talk to > the process, such as a pipe or a socket. Why are you trying to send > the child process SIGINT in the first place? Say, you've got an application that plays a sound f

Re: Regular expression : non capturing groups are faster ?

2012-01-03 Thread candide
Le 03/01/2012 12:56, Devin Jeanpierre a écrit : The second assertion sounds more likely. It seems very odd that Python and Perl implementations are divergent on this point. Any opinion ? The Python documentation oversimplifies. You meant Perl Documentation, didn't you ? It's a commun opinio

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Adam Skutt
On Jan 3, 3:58 am, Chris Angelico wrote: > On Tue, Jan 3, 2012 at 7:44 PM, Jérôme wrote: > > If so, I don't see how I can protect myself from that. Checking the process > > is alive and then hoping that the time interval for the race condition is so > > small that there are few chances for that t

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Adam Skutt
On Jan 3, 3:44 am, Jérôme wrote: > Mon, 2 Jan 2012 19:16:50 -0800 (PST) > Adam Skutt a écrit: > > > No. It is possible (however unlikely) for EPERM to be legitimately > > returned in this case.  Anything other than EINVAL should be > > interpreted as "The child process is dead".  Hence why you sho

Re: .format vs. %

2012-01-03 Thread Stefan Krah
Neil Cerutti wrote: > > In the real-world telco benchmark for _decimal, replacing the > > single line > > > > outfil.write("%s\n" % t) > > > > with > > > > outfil.write("{}\n".format(t)) > > > > adds 23% to the runtime. I think %-style formatting should not > > be deprecated at all. >

Parse multi line with re module.

2012-01-03 Thread Ganesh Kumar
Hi Guys, I want parse multiple line. with re.module, this is my given string http://dpaste.com/680760/ I have try with re.compile module. I want parse two line mac address and channel, I have done with for mac address finding r = re.compile("^Searching for OPUSH on (\w\w(:\w\w)+)") for channel f

Re: Locale bug?

2012-01-03 Thread =?ISO-8859-1?Q?Trond_Endrest=F8l?=
Marko Rauhamaa writes: > Mysterious 8-bit characters appear in the string returned by strftime. > > $ python > Python 2.7.2 (default, Oct 27 2011, 01:36:46) > [GCC 4.6.1 20111003 (Red Hat 4.6.1-10)] on linux2 > Type "help", "copyright", "credits" or "license" for more information

Re: .format vs. %

2012-01-03 Thread Neil Cerutti
On 2012-01-03, Stefan Krah wrote: > Andrew Berg wrote: >> To add my opinion on it, I find format() much more readable and easier >> to understand (with the exception of the {} {} {} {} syntax), and would >> love to see %-style formatting phased out. > > For me the %-style is much more readable. A

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Heiko Wundram
Am 03.01.2012 14:40, schrieb Adam Skutt: On Jan 3, 7:31 am, Heiko Wundram wrote: Yes, it can be avoided, that's what the default SIGCHLD-handling (keeping the process as a zombie until it's explicitly collected by a wait*()) is for, which forces the PID not to be reused by the operating system

Re: .format vs. %

2012-01-03 Thread Ethan Furman
Ian Kelly wrote: I'm not sure it's true that "there are no plans to do so in the foreseeable future." According to the release notes from Python 3.0, % formatting was supposed to be deprecated in Python 3.1. Eric Smith wrote (from a thread on pydev in 02-2011): > The last thread on this I have

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Adam Skutt
On Jan 3, 7:31 am, Heiko Wundram wrote: > Am 03.01.2012 02:19, schrieb Adam Skutt: > > > On Jan 2, 6:09 pm, Jérôme  wrote: > >> What is the clean way to avoid this race condition ? > > > The fundamental race condition cannot be removed nor avoided. Ideally, > > avoid the need to send the subproces

Re: Spamming PyPI with stupid packages

2012-01-03 Thread Ethan Furman
Peter Otten wrote: Lie Ryan wrote: On 01/02/2012 11:20 PM, Peter Otten wrote: Felinx Lee wrote: I have removed those packages (girlfriend and others) from PyPI forever, I apologize for that. The thought police has won :( I think the community has a right to defend themselves against trolls

Re: .format vs. %

2012-01-03 Thread Chris Angelico
On Tue, Jan 3, 2012 at 10:47 PM, Stefan Krah wrote: > For me the %-style is much more readable. It's also very similar to C's printf, which means it's similar to everything else that's similar to printf. That makes it instantly grokkable to many many people, which is a Good Thing. It's like using

Locale bug?

2012-01-03 Thread Marko Rauhamaa
Mysterious 8-bit characters appear in the string returned by strftime. $ python Python 2.7.2 (default, Oct 27 2011, 01:36:46) [GCC 4.6.1 20111003 (Red Hat 4.6.1-10)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time, locale >

Re: Python education survey

2012-01-03 Thread Eelco
> Why do people use pretty when we already have words that carry more > specific meaning? Because they are lazy! And laziness begets > stupidity. No, that would be because they are not autistic. Most people like having a repertoire of words with subtly different meanings in their natural language,

Re: Avoid race condition with Popen.send_signal

2012-01-03 Thread Heiko Wundram
Am 03.01.2012 02:19, schrieb Adam Skutt: On Jan 2, 6:09 pm, Jérôme wrote: What is the clean way to avoid this race condition ? The fundamental race condition cannot be removed nor avoided. Ideally, avoid the need to send the subprocess a signal in the first place. If it cannot be avoided, th

Re: Regular expression : non capturing groups are faster ?

2012-01-03 Thread Octavian Rasnita
From: "candide" Subject: Regular expression : non capturing groups are faster ? Excerpt from the Regular Expression HOWTO (http://docs.python.org/howto/regex.html#non-capturing-and-named-groups) : --- It should be mentioned that there’s no performan

  1   2   >