Re: how to tell a method is classmethod or static method or instance method

2012-02-13 Thread Steven D'Aprano
On Mon, 13 Feb 2012 15:59:27 +0900, Zheng Li wrote: > how to tell a method is class method or static method or instance > method? That's a good question, with a subtle answer that depends on exactly what you mean by the question. If you mean the object you get back from ordinary attribute acces

OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Steven D'Aprano
On Sun, 12 Feb 2012 20:48:54 -0800, Rick Johnson wrote: > Do you think that cost of healthcare is the problem? Do you think the > cost of healthcare insurance is the problem? NO! The problem is people > expect entitlements. Entitlements? I work hard and pay my taxes. I *earned* that healthcare t

Re: M2crypto

2012-02-13 Thread zigi
Hello, this is must be testing time to crypt files, using just M2crypto :-) I know this is a strange use of the library, but such is the will of the management. On 13 Lut, 01:28, geremy condra wrote: > On Sun, Feb 12, 2012 at 4:00 PM, Mel Wilson wrote: > > zigi wrote: > > >> Hello, > >> M2cry

Re: how to tell a method is classmethod or static method or instance method

2012-02-13 Thread 88888 Dihedral
在 2012年2月13日星期一UTC+8下午4时03分24秒,Steven D'Aprano写道: > On Mon, 13 Feb 2012 15:59:27 +0900, Zheng Li wrote: > > > how to tell a method is class method or static method or instance > > method? > > That's a good question, with a subtle answer that depends on exactly what > you mean by the question. If

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-13 Thread Vinay Sajip
On Feb 13, 3:57 am, Anh Hai Trinh wrote: > > I don't disagree with it. But the solution is really easy, just call 'sh' and > pass it a string! > > >>> from extproc import sh > >>> n = int(sh(“ls /etc –1 | wc –l”)) > > No parser needed written! > > Yes there is a danger of argument parsing and gl

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-13 Thread Vinay Sajip
On Feb 13, 7:08 am, Anh Hai Trinh wrote: > > Objection! Does the defense REALLY expect this court to believe that > > he can testify as to how MOST members of the Python community would or > > would not favor bash over Python? And IF they do in fact prefer bash, > > is this display of haughty arro

XSLT to Python script conversion?

2012-02-13 Thread Matej Cepl
Hi, I am getting more and more discouraged from using XSLT for a transformation from one XML scheme to another one. Does anybody could share any experience with porting moderately complicated XSLT stylesheet (https://gitorious.org/sword/czekms-csp_bible/blobs/master/CEP2OSIS.xsl) into a Pytho

Re: Read-only attribute in module

2012-02-13 Thread mloskot
Terry Reedy wrote > > On 2/10/2012 6:11 AM, mloskot wrote: >> The intent of xyz.flag is that it is a value set by the module >> internally. >> xyz is a module wrapping a C library. >> The C library defines concept of a global flag set by the C functions at >> some events, >> so user can check val

Re: XSLT to Python script conversion?

2012-02-13 Thread Stefan Behnel
Matej Cepl, 13.02.2012 12:20: > I am getting more and more discouraged from using XSLT for a transformation > from one XML scheme to another one. Could you explain what it is that discourages you about it? That would allow us to come up with better alternatives for your specific problem. > Does

ANN: eGenix pyOpenSSL Distribution 0.13.0-1.0.0g

2012-02-13 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.13.0-1.0.0g An easy-to-install and easy-to-use distribution of the pyOpenSSL Python interface for

Re: Removing items from a list

2012-02-13 Thread Thomas Philips
I could indeed have addressed this problem with a list comprehension. It escaped me at the time because the larger problem I was trying to solve included removing data from a dictionary: months = sorted(list(dataDict.keys())) #Sort months in ascending order

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Rick Johnson
On Feb 13, 2:05 am, Steven D'Aprano wrote: > On Sun, 12 Feb 2012 20:48:54 -0800, Rick Johnson wrote: > > Do you think that cost of healthcare is the problem? Do you think the > > cost of healthcare insurance is the problem? NO! The problem is people > > expect entitlements. > > Entitlements? I wor

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Steven D'Aprano
On Mon, 13 Feb 2012 08:01:59 -0800, Rick Johnson wrote: > Evolution knows how to handle degenerates. And yet here you still are. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Rick Johnson
On Feb 13, 10:12 am, Steven D'Aprano wrote: > On Mon, 13 Feb 2012 08:01:59 -0800, Rick Johnson wrote: > > Evolution knows how to handle degenerates. > > And yet here you still are. Embrace the perfection of evolution, and both our needs shall be met! -- http://mail.python.org/mailman/listinfo/py

Re: XSLT to Python script conversion?

2012-02-13 Thread Mike C. Fletcher
On 12-02-13 06:20 AM, Matej Cepl wrote: Hi, I am getting more and more discouraged from using XSLT for a transformation from one XML scheme to another one. Does anybody could share any experience with porting moderately complicated XSLT stylesheet (https://gitorious.org/sword/czekms-csp_bibl

Re: package extension problem

2012-02-13 Thread Miki Tebeka
> B[some_hash] still returns an instance of the old class A, while I want an instance of the new class A. I don't understand this sentence. How does B[some_hash] related to A? I've tried the below and it seems to work. Can you paste some code to help us understand more? -- old.py -- class A:

Re: package extension problem

2012-02-13 Thread Fabrizio Pollastri
Ok. To be more clear, consider the real python package Pandas. This package defines a Series class and a DataFrame class. The DataFrame is a matrix that can have columns of different type. If I write import pandas as pd df = pd.DataFrame({'A':[1,2,3],'B':[4,5,6]}) a data frame with two cols na

Re: package extension problem

2012-02-13 Thread Miki Tebeka
> import new_pandas as np > df = np.DataFrame({'A':[1,2,3],'B':[4,5,6]}) > col_A = df['A'] I'm not familiar with pandas, but my *guess* will be that you'll need to override __getitem__ in the new DataFrame. -- http://mail.python.org/mailman/listinfo/python-list

Re: package extension problem

2012-02-13 Thread Jerry Hill
On Sun, Feb 12, 2012 at 1:46 PM, Fabrizio Pollastri wrote: > Hello, > > I wish to extend the functionality of an existing python package by > creating > a new package that redefines the relevant classes of the old package. Each > new class inherits the equivalent old class and adds new methods. >

Re: Python usage numbers

2012-02-13 Thread Andrew Berg
On 2/12/2012 10:19 PM, Ben Finney wrote: > If it helps, ASCII art *is* UTF-8 art. So it will be the same in UTF-8. As will non-ASCII text art:   /l、 ゙(゚、 。 7  l、゙ ~ヽ   じしf_, )ノ -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Re: package extension problem

2012-02-13 Thread Peter Otten
Fabrizio Pollastri wrote: > Ok. To be more clear, consider the real python package Pandas. > > This package defines a Series class and a DataFrame class. > The DataFrame is a matrix that can have columns of > different type. > > If I write > > import pandas as pd > df = pd.DataFrame({'A':[1,2,3

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Ian Kelly
I hate being suckered in by trolls, but this paragraph demands a response. On Mon, Feb 13, 2012 at 9:01 AM, Rick Johnson wrote: > You are born with rights. Life, Liberty, and the pursuit of happiness. > Healthcare care is NOT a right, healthcare is a privileged. If you deprive a person of access

Re: package extension problem

2012-02-13 Thread Terry Reedy
On 2/13/2012 12:58 PM, Miki Tebeka wrote: import new_pandas as np df = np.DataFrame({'A':[1,2,3],'B':[4,5,6]}) col_A = df['A'] I'm not familiar with pandas, but my *guess* will be that you'll need to override __getitem__ in the new DataFrame. This is essentially the same problem that if you, f

[no subject]

2012-02-13 Thread roncy thomas
I'm doing a miniproject on electronics voting system.I require help for creating a code in python for coverting the barcode into binary digits.Or atleast an algorithm for the same..please Help..Reply to this mail id. Kindly help me. -- http://mail.pyt

Python barcode scanner was RE:

2012-02-13 Thread Prasad, Ramit
From: roncy thomas Sent: Monday, February 13, 2012 1:16 PM To: python-list@python.org Subject: I'm doing a miniproject on electronics voting system.I require help for creating a code in python for coverting the barcode into binary digits.Or atleast an algorithm for the same..please Help..Reply

Strange Behavior on Python 3 Windows Command Line

2012-02-13 Thread waylan
When I try running any Python Script on the command line with Python 3.2 I get this weird behavior. The cursor dances around the command line window and nothing ever happens. Pressing Ctr+C does nothing. When I close the window (mouse click on X in top right corner), an error dialog appears asking

Re: Strange Behavior on Python 3 Windows Command Line

2012-02-13 Thread Arnaud Delobelle
On 13 February 2012 19:50, waylan wrote: > When I try running any Python Script on the command line with Python > 3.2 I get this weird behavior. The cursor dances around the command > line window and nothing ever happens. Pressing Ctr+C does nothing. > When I close the window (mouse click on X in

Re: Strange Behavior on Python 3 Windows Command Line

2012-02-13 Thread Waylan Limberg
On Mon, Feb 13, 2012 at 3:16 PM, Arnaud Delobelle wrote: >> Strangely it was working fine the other day. Then while debugging a >> script it suddenly started do this and now does this for every script > > How were you debugging? I think I may have been attempting to use pipes to redirect stdin an

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Chris Angelico
On Tue, Feb 14, 2012 at 5:38 AM, Ian Kelly wrote: > "... Rights, that > **AMONG** these are Life, Liberty and the pursuit of Happiness." AMONG our rights are such elements as Life, Liberty, the Pursuit of Happiness, and an almost fanatical devotion to the Founding Fathers I'll come in again.

(Rebooting) Python Usage Statistics

2012-02-13 Thread Eric Snow
The original topic got side-tracked pretty quickly (surprise, surprise). However, I think the question is valuable enough that it's worth broaching again. Notably, the first time around I did get a meaningful response (thanks Stefan!). If you do feel like diverging from the topic of gathering us

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Rick Johnson
On Feb 13, 12:38 pm, Ian Kelly wrote: > I hate being suckered in by trolls, but this paragraph demands a response. > > On Mon, Feb 13, 2012 at 9:01 AM, Rick Johnson > > wrote: > > You are born with rights. Life, Liberty, and the pursuit of happiness. > > Healthcare care is NOT a right, healthcare

Re: frozendict

2012-02-13 Thread John Nagle
On 2/10/2012 9:52 PM, 8 Dihedral wrote: 在 2012年2月11日星期六UTC+8上午2时57分34秒,John Nagle写道: On 2/10/2012 10:14 AM, Nathan Rice wrote: Lets also not forget that knowing an object is immutable lets you do a lot of optimizations; it can be inlined, it is safe to convert to a contiguous block of memor

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Chris Angelico
Rick, you are either... On Tue, Feb 14, 2012 at 8:01 AM, Rick Johnson wrote: > I can however tell you that what DOES matter is the continued > improvement of the base gene pool. Yes, this improvement comes at a > cost; the cost of the individual. Those with quality genes will reap > the rewards,

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Mark Lawrence
On 13/02/2012 21:01, Rick Johnson wrote: Healthy people do not need healthcare very often, and in the rare cases when they do, they don't bog down the system because their bodies are strong. Why are their bodies strong? Because healthy people eat correctly, healthy people exercise, therefore, he

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Michael Torrie
On 02/13/2012 09:01 AM, Rick Johnson wrote: > Look, i hate super rich, arrogant people just as much i hate selfish > people. But wait, Rick. You are a man of contradictions. We all are, but you seem to bluster on and on more about it than most. Firstly, to *hate* anyone, super-rich, arrogant,

Automatic Type Conversion to String

2012-02-13 Thread Bruce Eckel
I'm creating a class to encapsulate OS paths, to reduce the visual noise and typing from the os.path methods. I've got the class and nose tests below, and everything works except the last test which I've prefixed with XXX: def XXXtest_should_work(self): """ Produces: op

Re: Automatic Type Conversion to String

2012-02-13 Thread Chris Rebert
On Mon, Feb 13, 2012 at 2:01 PM, Bruce Eckel wrote: > I'm creating a class to encapsulate OS paths, to reduce the visual > noise and typing from the os.path methods. I've got the class and nose > tests below, and everything works except the last test which I've > prefixed with XXX: > >    def XXXt

Re: M2crypto

2012-02-13 Thread geremy condra
On Mon, Feb 13, 2012 at 12:37 AM, zigi wrote: > Hello, > this is must be testing time to crypt files, using just M2crypto :-) > I know this is a strange use of the library, but such is the will of > the management. I take it you mean that you're benchmarking file encryption performance using M2Cr

Re: M2crypto

2012-02-13 Thread zigi
Ok, thanks. On 13 Lut, 23:27, geremy condra wrote: > On Mon, Feb 13, 2012 at 12:37 AM, zigi wrote: > > Hello, > > this is must be testing time to crypt files, using just M2crypto :-) > > I know this is a strange use of the library, but such is the will of > > the management. > > I take it you m

Change os.makedirs to handle existing directory

2012-02-13 Thread Wanderer
I think wanting to create a directory if one doesn't exist or do nothing if it does exist and just use the existing directory is a fairly normal programming need. Apparently this is somewhat complicated in Python. If you use if not os.path.exists(dirName): os.makedirs(dirName) you create a ra

Re: Change os.makedirs to handle existing directory

2012-02-13 Thread Tim Delaney
On 14 February 2012 09:59, Wanderer wrote: > I think wanting to create a directory if one doesn't exist or do > nothing if it does exist and just use the existing directory is a > fairly normal programming need. Apparently this is somewhat > complicated in Python. > ... > IMHO, os.makedirs should

Re: Automatic Type Conversion to String

2012-02-13 Thread Bruce Eckel
I'm willing to subclass str, but when I tried it before it became a little confusing -- I think mostly because anytime I assigned to self it seemed like it converted the whole object to a str rather than a Path. I suspect I don't know the proper idiom for doing this -- any hints? Thanks ... --

Re: Change os.makedirs to handle existing directory

2012-02-13 Thread Andrew Berg
On 2/13/2012 4:59 PM, Wanderer wrote: > I think wanting to create a directory if one doesn't exist or do > nothing if it does exist and just use the existing directory is a > fairly normal programming need. Apparently this is somewhat > complicated in Python. There are new exceptions in 3.3, one o

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Steven D'Aprano
On Mon, 13 Feb 2012 13:01:05 -0800, Rick Johnson wrote: > Healthy people do not need healthcare very often Healthy people don't need healthcase AT ALL. By definition, once you need healthcare, you are no longer healthy. Your faith in the magic of "immune system" is touching, but one wonders ho

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Rick Johnson
On Feb 13, 3:46 pm, Michael Torrie wrote: > On 02/13/2012 09:01 AM, Rick Johnson wrote: > > > Look, i hate super rich, arrogant people just as much i hate selfish > > people. > > But wait, Rick.  You are a man of contradictions.  We all are, but you > seem to bluster on and on more about it than m

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Ian Kelly
[Reply sent off-list, partly because this is way off-topic, but also because python-list rejected my response as spam] -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Michael Torrie
On 02/13/2012 05:39 PM, Rick Johnson wrote: > Why? Do you need the services of a professional software developer? Do you have some to offer? -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-13 Thread Chris Angelico
On Tue, Feb 14, 2012 at 11:39 AM, Rick Johnson wrote: > # Py>=3.0 > py> sum(earner.get_income(2012) for earner in earners2012) / > len(earners2012) > average_income > > Once you exceed that amount you are robbing your fellow man. How can > you justify making more than your fair share UNLESS someon

Re: how to tell a method is classmethod or static method or instance method

2012-02-13 Thread Zheng Li
I can get "method1" of class "Test" by a = getattr(Test, "method1") and I also want know how to invoke it a() or a(Test()) BTW: I don't see what the problem is if I ask a question just because I am curious about it. On 2012/02/13, at 16:23, Cameron Simpson wrote: > On 13Feb2012 15

re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

2012-02-13 Thread Devin Jeanpierre
Hey Pythonistas, Consider the regular expression "$*". Compilation fails with the exception, "sre_constants.error: nothing to repeat". Consider the regular expression "(?=$)*". As far as I know it is equivalent. It does not fail to compile. Why the inconsistency? What's going on here? -- Devin