Re: No trees in the stdlib?

2009-06-25 Thread Miles Kaufmann
On Jun 26, 2009, at 2:23 AM, Chris Rebert wrote: On Thu, Jun 25, 2009 at 10:55 PM, João Valverde wrote: Aahz wrote: In article , Tom Reed wrote: Why no trees in the standard library, if not as a built in? I searched the archive but couldn't find a relevant discussion. Seems like a g

Re: No trees in the stdlib?

2009-06-25 Thread Stefan Behnel
João Valverde wrote: > Besides some interface glitches, like returning None > on delete if I recall correctly. That's actually not /that/ uncommon. Operations that change an object are not (side-effect free) functions, so it's just purity if they do not have a return value. Although practicality

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Stefan Behnel
Hi, Kee Nethery wrote: > Why isn't et.parse the only way to do this? Why have XML or fromstring > at all? Well, use cases. XML() is an alias for fromstring(), because it's convenient (and well readable) to write section = XML('A to Z') section.append(paragraphs) for XML literals in source

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Stefan Behnel
Carl Banks wrote: > On Jun 25, 10:11 pm, Stefan Behnel wrote: >> Carl Banks wrote: Why isn't et.parse the only way to do this? Why have XML or fromstring at all? >>> Because Fredrick Lundh wanted it that way. Unlike most Python >>> libraries ElementTree is under the control of one pers

Re: No trees in the stdlib?

2009-06-25 Thread Chris Rebert
On Thu, Jun 25, 2009 at 10:55 PM, João Valverde wrote: > Aahz wrote: >> >> In article , >> Tom Reed   wrote: >> >>> >>> Why no trees in the standard library, if not as a built in? I searched >>> the archive but couldn't find a relevant discussion. Seems like a glaring >>> omission considering the b

Re: No trees in the stdlib?

2009-06-25 Thread João Valverde
João Valverde wrote: Aahz wrote: In article , Tom Reed wrote: Why no trees in the standard library, if not as a built in? I searched the archive but couldn't find a relevant discussion. Seems like a glaring omission considering the batteries included philosophy, particularly balanced bina

Re: No trees in the stdlib?

2009-06-25 Thread João Valverde
João Valverde wrote: Aahz wrote: In article , Tom Reed wrote: Why no trees in the standard library, if not as a built in? I searched the archive but couldn't find a relevant discussion. Seems like a glaring omission considering the batteries included philosophy, particularly balanced bina

Re: No trees in the stdlib?

2009-06-25 Thread João Valverde
Aahz wrote: In article , Tom Reed wrote: Why no trees in the standard library, if not as a built in? I searched the archive but couldn't find a relevant discussion. Seems like a glaring omission considering the batteries included philosophy, particularly balanced binary search trees. No i

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Carl Banks
On Jun 25, 10:11 pm, Stefan Behnel wrote: > Carl Banks wrote: > >> Why isn't et.parse the only way to do this? Why have XML or fromstring   > >> at all? > > > Because Fredrick Lundh wanted it that way.  Unlike most Python > > libraries ElementTree is under the control of one person, which means >

Re: No trees in the stdlib?

2009-06-25 Thread Aahz
In article , Tom Reed wrote: > >Why no trees in the standard library, if not as a built in? I searched >the archive but couldn't find a relevant discussion. Seems like a >glaring omission considering the batteries included philosophy, >particularly balanced binary search trees. No interest, no

No trees in the stdlib?

2009-06-25 Thread Tom Reed
Why no trees in the standard library, if not as a built in? I searched the archive but couldn't find a relevant discussion. Seems like a glaring omission considering the batteries included philosophy, particularly balanced binary search trees. No interest, no good implementations, something oth

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Stefan Behnel
Carl Banks wrote: >> Why isn't et.parse the only way to do this? Why have XML or fromstring >> at all? > > Because Fredrick Lundh wanted it that way. Unlike most Python > libraries ElementTree is under the control of one person, which means > it was not designed or vetted by the community, whic

Re: I need a dict that inherits its mappings

2009-06-25 Thread Rachel P
On Jun 25, 5:31 am, samwyse wrote: > I need a dict-like object that, if it doesn't contain a key, will > return the value from a "parent" object.   See: http://code.activestate.com/recipes/305268/ Also try subclassing dict and implementing a __missing__() method. Raymond -- http://mail.pytho

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Carl Banks
On Jun 25, 8:53 pm, Kee Nethery wrote: > On Jun 25, 2009, at 8:04 PM, Carl Banks wrote: > > A few minor > > things should be no big deal. > > True and I will eventually get past the minor quirks. As a newbie,   > figured I'd point out the difficult portions, things that conceptually   > are confus

Re: Why is it that str.replace doesn't work sometimes?

2009-06-25 Thread Tim Roberts
humn wrote: > >Thank you! Didn't know that it would escape characters with single >quotes. I thought it only did that with double quotes. That's only true in Perl and PHP, but not in Python or C. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/lis

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread Scott David Daniels
norseman wrote: ... A note here: In reading the original posting I get symbols that are not familiar to me as alphabet. From the line in your original: Label(root, text='ęóąśłżźćń').pack() I see text=' then an e with a goatee a capitol O with an accent symbol o

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Kee Nethery
thank you to everyone, I'll play with these suggestions tomorrow at work and report back. On Jun 25, 2009, at 8:04 PM, Carl Banks wrote: Because Fredrick Lundh wanted it that way. Unlike most Python libraries ElementTree is under the control of one person, which means it was not designed or

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Carl Banks
On Jun 25, 6:02 pm, Kee Nethery wrote: > Summary: I have XML as string and I want to pull it into ElementTree   > so that I can play with it but it is not working for me. XML and   > fromstring when used with a string do not do the same thing as parse   > does with a file. How do I get this to wor

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread unayok
On Jun 25, 9:02 pm, Kee Nethery wrote: > Summary: I have XML as string and I want to pull it into ElementTree > so that I can play with it but it is not working for me. XML and > fromstring when used with a string do not do the same thing as parse > does with a file. How do I get this to work? > >

Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Nobody
On Thu, 25 Jun 2009 18:02:25 -0700, Kee Nethery wrote: > Summary: I have XML as string and I want to pull it into ElementTree > so that I can play with it but it is not working for me. XML and > fromstring when used with a string do not do the same thing as parse > does with a file. How do I

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread MRAB
Sebastian Pająk wrote: You're providing the same text for a Button and a Label. On Mac OSX the Button shows the text correctly, but the Label doesn't. Is this correct? Yes this is correct. My first mail is here: http://mail.python.org/pipermail/python-list/2009-June/717666.html My only other

ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Kee Nethery
Summary: I have XML as string and I want to pull it into ElementTree so that I can play with it but it is not working for me. XML and fromstring when used with a string do not do the same thing as parse does with a file. How do I get this to work? Details: I have a CGI that receives XML via

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread Martin v. Löwis
>>> After applying this, the effect remains the same - one big garbage. >> Can you please be more specific? What is "one big garbage"? >> > > There is a square (or some other weird sign) ***PLEASE*** be specific. A square box is something *completely* different than any other weird sign. It is im

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread norseman
Sebastian Pająk wrote: Can, but should not. I read that the problem is when using the Polish language only. Otherwise things work normally. Is that correct? Yes, correct If so then byte swap may be a problem. Using the u'string' should solve that. I am assuming you have the Polish alphabet w

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

2009-06-25 Thread Robert Kern
On 2009-06-25 18:43, Scott David Daniels wrote: Robert Kern wrote: ... I wish people would stop representing decimal floating point arithmetic as "more accurate" than binary floating point arithmetic. It isn't. Decimal floating point arithmetic does have an extremely useful niche: ... Well, we

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

2009-06-25 Thread Aahz
In article , Scott David Daniels wrote: > >Well, we don't actually have an arbitrary-precision, huge exponent >version of binary floating point. gmpy? -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "as long as we like the same operating system, things are co

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

2009-06-25 Thread Mensanator
On Jun 25, 6:43 pm, Scott David Daniels wrote: > Robert Kern wrote: > > ... I wish people would stop representing decimal floating point arithmetic > > as "more accurate" than binary floating point arithmetic. It isn't. > > Decimal floating point arithmetic does have an extremely useful niche: > >

Re: Meta question: disappearing posts (was Re: calculating aself.value, self.randomnum = normalvariate(x, y))

2009-06-25 Thread Aahz
In article , Hendrik van Rooyen wrote: > >I have lately had some posts returned with a "seems to be forged" message. >Two reasons for that: >- first is if I use the smtp server from our local telco - saix - then there is > no apparent relationship between where the message comes from and > where

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

2009-06-25 Thread Robert Kern
On 2009-06-25 18:43, Scott David Daniels wrote: Robert Kern wrote: ... I wish people would stop representing decimal floating point arithmetic as "more accurate" than binary floating point arithmetic. It isn't. Decimal floating point arithmetic does have an extremely useful niche: ... Well, we

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

2009-06-25 Thread Scott David Daniels
Robert Kern wrote: ... I wish people would stop representing decimal floating point arithmetic as "more accurate" than binary floating point arithmetic. It isn't. Decimal floating point arithmetic does have an extremely useful niche: ... Well, we don't actually have an arbitrary-precision, hug

Re: C-extension 2 times slower than exe

2009-06-25 Thread MRAB
Nick Craig-Wood wrote: Rolf Wester wrote: Hello, thank you all very much for your replies. I tried to simplify things and make the two versions as comparable as possible. I put the C++ part of the program into a shared object libff.so. For the exe the main function is linked against this

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread Sebastian Pająk
> Can, but should not. > I read that the problem is when using the Polish language only. Otherwise > things work normally. Is that correct? Yes, correct > If so then byte swap may be a problem.  Using the u'string' should solve > that. I am assuming you have the Polish alphabet working correctly

Re: Problem with multithreading

2009-06-25 Thread MRAB
Jeffrey Barish wrote: [snip] Lou Pecora wrote: Try putting a flush in after the 2nd print statement in case the output is left in some I/O buffer when the thing terminates. e.g. import sys try: print 'in try" sys.stdout.flush() I was hoping for some suggestions of things

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread norseman
Sebastian Pająk wrote: 2009/6/25 "Martin v. Löwis" : I've tried various UTF file encoding (also with BOM mark), use of u"text" Always use u"text". This should work. Everything else might not work. But I tried this here without success After applying this, the effect remains the same - one b

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread MRAB
Sebastian Pająk wrote: 2009/6/25 "Martin v. Löwis" : I've tried various UTF file encoding (also with BOM mark), use of u"text" Always use u"text". This should work. Everything else might not work. But I tried this here without success After applying this, the effect remains the same - one b

Re: C-extension 2 times slower than exe

2009-06-25 Thread Nick Craig-Wood
Rolf Wester wrote: > Hello, > > thank you all very much for your replies. > > I tried to simplify things and make the two versions as comparable as > possible. I put the C++ part of the program into a shared object > libff.so. For the exe the main function is linked against this shared > o

Re: Python simple web development

2009-06-25 Thread Gabriel Genellina
En Thu, 25 Jun 2009 04:29:28 -0300, Private Private escribió: I am looking for a python library which will allow me to do a simple web development. I need to use some forms (but nice looking :-) ), creating images based on input from those forms, etc. I have read a bit about Django and TurboGea

Re: [Gimp-user] Color change a whole range based on a break point

2009-06-25 Thread norseman
I know I'm not the only one that does archival scanning and georefferencing of old maps. What follows is the combined conversations between myself (norse...@hughes.net and saulgo...@flashingtwelve.brickfilms.com) that lead to getting what is needed for the above process when working with sour

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread Sebastian Pająk
2009/6/25 "Martin v. Löwis" : >> I've tried various UTF file encoding (also with BOM mark), use of >> u"text" > > Always use u"text". This should work. Everything else might not work. But I tried this here without success >> After applying this, the effect remains the same - one big garbage. > >

Re: print u'\u2013' error on console/terminal

2009-06-25 Thread Martin v. Löwis
> is there a switch to suppress those encoding errors for standard print's > on the console No, there is no such switch. > or a new filter file class necessary? You can wrap sys.stdout with a codecs.StreamWriter, passing "replace" as the error handler. Regards, Martin -- http://mail.python.org

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread Martin v. Löwis
> I've tried various UTF file encoding (also with BOM mark), use of > u"text" Always use u"text". This should work. Everything else might not work. > After applying this, the effect remains the same - one big garbage. Can you please be more specific? What is "one big garbage"? > I'm out of idea

Re: trace options

2009-06-25 Thread Terry Reedy
Edward Peschko wrote: All, I've been looking at the trace module, and although it looks useful, I'm surprised that there aren't a couple of features that I would have thought would be fairly basic. So, does trace support (for the --trace option): I have never used the trace module but decided

Re: Problem with multithreading

2009-06-25 Thread Jeffrey Barish
Lou Pecora wrote: > In article , > "larudwer" wrote: > >> "Jeffrey Barish" schrieb im Newsbeitrag >> news:mailman.2091.1245902997.8015.python-l...@python.org... >> > Jeffrey Barish wrote: >> > >> >> I have a program that uses multithreading to monitor two loops. When >> >> something happens i

py2exe: some problems

2009-06-25 Thread gianbrix
Hi, I am trying to get an exe file using py2exe with one my application. If I let all in the same main folder it works fine. If I set zipfile="bin\\myapp.zip" I get some errors like this: "unable to load dlls:" relating to win32gui or win32print etc. What is wrong? There is a way to have zipfile s

Re: Slow wxPyhon on Vista?

2009-06-25 Thread Martin Schöön
David Lyon writes: > On Fri, 19 Jun 2009 10:16:39 +0200, martin.sch...@gmail.com (Martin > Schöön) wrote: >> Here is my problem. When I use it on a Vista box its >> user interface is very, very slow when it comes to >> some but not all operations. On any other Windows >> version it reacts instant

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

2009-06-25 Thread Mark Dickinson
On Jun 25, 7:41 pm, Michael Torrie wrote: > I guess PHP artificially rounds the results or something to make it seem > like it's doing accurate calculations, which is a bit surprising to me. After a bit of experimentation on my machine, it *looks* as though PHP is using the usual hardware floats

Re: extending method descriptors

2009-06-25 Thread Carl Banks
On Jun 25, 8:10 am, Michael Sliczniak wrote: > Suppose I have this: > > Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > Type "help", "copyright", "credits" or "license" for more information.>>> > class A(object): > > ...     __slots__ = ('x', 'y'

Re: Barbara Liskov wins Turing Award

2009-06-25 Thread Martin v. Löwis
> Python's object model, assignment semantics, and call-by-object > mechanism, and that name, come from CLU. Whether Guido knew of it > directly or not, I do not know. To the extent that the above is part of > the heart of Python, I think Steven's statement stands pretty well. Why do you say that

Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread Sebastian Pająk
Hello I'm writing an application in Python 2.5.4 under Windows (xp sp3 en). I use Tkinter as the main GUI toolkit. The app is intended to be portable (not fully but win & mac os x is a must). It works as it should on my system, but when I've sent the program to my friend who has a mac computer, he

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

2009-06-25 Thread Robert Kern
On 2009-06-25 13:41, Michael Torrie wrote: If you want accurate math, check out other types like what is in the decimal module: import decimal a=decimal.Decimal('3.2') print a * 3 9.6 I wish people would stop representing decimal floating point arithmetic as "more accurate" than binary flo

Re: scipy stats binom_test

2009-06-25 Thread Robert Kern
On 2009-06-25 07:14, dusans wrote: Amm i using the function wrong or ...? cuz in R i get the right value binom_test(3, 5, p=0.8) 0.262 dbinom(3, 5, 0.8) [1] 0.205 The R equivalent of scipy.stats.binom_test() is binom.test(), not dbinom(). If you want the equivalent of dbinom(), use scipy

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

2009-06-25 Thread Michael Torrie
Bojan Sudarevic wrote: > The first thing I typed into it was 3.2*3 (don't ask why I typed *that*, > I don*t know, I just did). And the answer wasn't 9.6. > > Here it is: > 3.2*3 > 9.6014 I'm surprised how often people encounter this and wonder about it. As I began programming

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

2009-06-25 Thread Bojan Sudarevic
In article <26be756e-5a0a-40cd-b9a2-133ce14ac7d7 @n30g2000vba.googlegroups.com>, dicki...@gmail.com says... > This is a FAQ. Take a look at: > > http://docs.python.org/tutorial/floatingpoint.html > > and let us know whether that explains things to your > satisfaction. > Hi Mark, Yes, that exp

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

2009-06-25 Thread Mark Dickinson
On Jun 25, 7:04 pm, Bojan Sudarevic wrote: > The first thing I typed into it was 3.2*3 (don't ask why I typed *that*, > I don*t know, I just did). And the answer wasn't 9.6. It looks like it's false in PHP too, by the way (not that I know any PHP, so I could well be missing something...) bernou

Re: Python simple web development

2009-06-25 Thread Chris Withers
Private Private wrote: What I've read about Django, Turbogears is that they are powerful enough to create big web-based portals, applications, etc. I need just simple forms without any sophisticated functionality. So again: why I am wrong ? Just because something is powerful doesn't mean you ca

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: 3.2*2 is 9.6 ... or maybe it isn't?

2009-06-25 Thread Emile van Sebille
On 6/25/2009 11:04 AM Bojan Sudarevic said... 3.2*3 9.601 I wasn't particularly good in math in school and university, but I'm pretty sure that 3.2*3 is 9.6. Yes -- in this world. But in the inner workings of computers, 3.2 isn't accurately representable in binary. This is a

Re: Problem with multithreading

2009-06-25 Thread Lou Pecora
In article , "larudwer" wrote: > "Jeffrey Barish" schrieb im Newsbeitrag > news:mailman.2091.1245902997.8015.python-l...@python.org... > > Jeffrey Barish wrote: > > > >> I have a program that uses multithreading to monitor two loops. When > >> something happens in loop1, it sends a message to

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

2009-06-25 Thread Tomasz Zieliński
On 25 Cze, 20:04, Bojan Sudarevic wrote: > > I wasn't particularly good in math in school and university, but I'm > pretty sure that 3.2*3 is 9.6. > It's not math, it's floating point representation of numbers - and its limited accuracy. Type 9.6 and you'll get 9.5996 -- Tomasz Ziel

Re: I need a dict that inherits its mappings

2009-06-25 Thread Terry Reedy
samwyse wrote: I need a dict-like object that, if it doesn't contain a key, will return the value from a "parent" object. Is there an easy way to do this so I don't have to define __getitem__ and __contains__ and others that I haven't even thought of yet? Here's a use case, if you're confused:

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

2009-06-25 Thread Mark Dickinson
On Jun 25, 7:04 pm, Bojan Sudarevic wrote: > 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

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

2009-06-25 Thread Amos Anderson
I think what your experiencing is addressed on this page... http://docs.python.org/tutorial/floatingpoint.html ... it has to do with the binary representation of the numbers. On Thu, Jun 25, 2009 at 1:04 PM, Bojan Sudarevic wrote: > Hi, > > I'm PHP developer and entirely new to Python. I instal

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

2009-06-25 Thread Bojan Sudarevic
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 did). And the answer wasn't 9.6. Here

Re: Python simple web development

2009-06-25 Thread Private Private
On Jun 25, 10:59 am, Chris Withers wrote: > Private Private wrote: > > from those forms, etc. I have read a bit about Django and TurboGears > > but I am afraid that this is too big for my requirements (am I > > wrong ?). > > You are wrong :-) Why ? What I've read about Django, Turbogears is that

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread norseman
rom wrote: Thanks again. After your replies, I have understood how to do what I wanted. What I wanted to do is to get a value after clicking a button and use it in another part of the program. As you said, after getting the value, I have to store it in a global variable. However, the program does

Re: Problem with multithreading

2009-06-25 Thread larudwer
"Jeffrey Barish" schrieb im Newsbeitrag news:mailman.2091.1245902997.8015.python-l...@python.org... > Jeffrey Barish wrote: > >> I have a program that uses multithreading to monitor two loops. When >> something happens in loop1, it sends a message to loop2 to have it >> execute >> a command.

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread norseman
rom wrote: Ok. I think I got it. I have to do it in this way: ### import Tkinter import tkFileDialog filename='' root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=lambda: open_file_dialog()).pack() def open_file_dialog(): global filename

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread norseman
rom wrote: Thanks for your response. I have modified this minimal program as you suggested but still is not able to print the filename: ## import Tkinter import tkFileDialog global filename # NO NO NO! No global line here filename='' root = Tkinter.Tk() Tkinter.

Re: It's ...

2009-06-25 Thread MRAB
Angus Rodgers wrote: On Thu, 25 Jun 2009 10:31:47 -0500, Kirk Strauser wrote: At 2009-06-24T19:53:49Z, Angus Rodgers writes: print ''.join(map(detab, f.xreadlines())) An equivalent in modern Pythons: print ''.join(line.expandtabs(3) for line in file('h071.txt')) I guess the code below

Re: It's ...

2009-06-25 Thread Angus Rodgers
On Thu, 25 Jun 2009 17:56:47 +0100, I found a new way to disgrace myself, thus: >[...] something like x.readlines()? ^ I don't know how that full stop got in there. Please ignore it! -- Angus Rodgers -- http://mail.python.org/mailman/listinfo/python-list

Re: IMPORTANT: I NEED TO HELP WITH ONE OF THE CORE DEVELOPERS

2009-06-25 Thread Martin P. Hellwig
Chris Rebert wrote: In the future, also NOTE THAT SHOUTING TYPICALLY DOES NOT EARN ONE SYMPATHY. Cheers, Chris Let me demonstrate: Chris, I have no sympathy for you :-) -- MPH http://blog.dcuktec.com 'If consumed, best digested with added seasoning to own preference.' -- http://mail.python.

Re: It's ...

2009-06-25 Thread Angus Rodgers
On Thu, 25 Jun 2009 17:56:47 +0100, I burbled incoherently: >[...] does the new feature, >by which a file becomes iterable, operate by some kind of coercion >of a file object to a list object, via something like x.readlines()? Sorry to follow up my own post yet again (amongst my weapons is a fana

Re: It's ...

2009-06-25 Thread Angus Rodgers
On Thu, 25 Jun 2009 17:53:51 +0100, I wrote: >On Thu, 25 Jun 2009 10:31:47 -0500, Kirk Strauser > wrote: > >>At 2009-06-24T19:53:49Z, Angus Rodgers writes: >> >>> print ''.join(map(detab, f.xreadlines())) >> >>An equivalent in modern Pythons: >> > print ''.join(line.expandtabs(3) for line in

Re: extending method descriptors

2009-06-25 Thread Peter Otten
Michael Sliczniak wrote: > Suppose I have this: > > Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > Type "help", "copyright", "credits" or "license" for more information. class A(object): > ... __slots__ = ('x', 'y') > ... a = A() >

Re: It's ...

2009-06-25 Thread Angus Rodgers
On Thu, 25 Jun 2009 10:31:47 -0500, Kirk Strauser wrote: >At 2009-06-24T19:53:49Z, Angus Rodgers writes: > >> print ''.join(map(detab, f.xreadlines())) > >An equivalent in modern Pythons: > print ''.join(line.expandtabs(3) for line in file('h071.txt')) I guess the code below would also ha

Re: Best way to enumerate classes in a module

2009-06-25 Thread Nick Craig-Wood
Carl Banks wrote: > On Jun 23, 10:02 pm, Дамјан Георгиевски wrote: > > I need to programmaticaly enumerate all the classes in a given module. > > Currently I'm using dir(module) but the Notice on the documentation page > > [1]  says "dir() is supplied primarily as a convenience for use at an > >

Re: A superclass using a child classes' methods

2009-06-25 Thread Nick Craig-Wood
Kurt Schwehr wrote: > Thanks for the excellent response setting me straight. Now to figure > out what dumb thing I did to make my code not work... If you have trouble then post the code (or a cut down version demonstrating the code) - it always helps to have real code with real error messages

Re: Measuring Fractal Dimension ?

2009-06-25 Thread pdpi
On Jun 25, 10:38 am, Paul Rubin wrote: > Robin Becker writes: > > someone once explained to me that the set of systems that are > > continuous in the calculus sense was of measure zero in the set of all > > systems I think it was a fairly formal discussion, but my >

Re: IMPORTANT: I NEED TO HELP WITH ONE OF THE CORE DEVELOPERS

2009-06-25 Thread Paul Boddie
On 24 Jun, 15:22, "Pegasus" wrote: > I need help with an implementation of your > interpreter under PSPE/PSP. There doesn't seem to be much of an intersection between the PSP and "mainstream" Python communities, so some more context may have been desirable here. [...] > We believe that the trou

Re: It's ...

2009-06-25 Thread Kirk Strauser
At 2009-06-24T19:53:49Z, Angus Rodgers writes: > stop = 3 # Tab stops every 3 characters > from types import StringType # Is this awkwardness necessary? > detab = lambda s : StringType.expandtabs(s, stop) # Or use def > f = open('h071.txt') # Do some stuff to f, perhaps, and then: > f.seek

Re: Measuring Fractal Dimension ?

2009-06-25 Thread pdpi
On Jun 25, 12:23 pm, Robin Becker wrote: > Paul Rubin wrote: > > so does this render all the discreteness implied by quantum theory unreliable? > or is it that we just cannot see(measure) the continuity that really happens? > Certainly there are people like Wolfram who seem to think we're in some

Re: generator expression works in shell, NameError in script

2009-06-25 Thread Aahz
In article <13e776b0-6ca8-479e-ba82-eb5b7eb8f...@a5g2000pre.googlegroups.com>, ssc wrote: >On Jun 18, 10:49=A0am, Jon Clements wrote: >> >> Why are you doing this? I'm assuming a code to title look up is >> required (don't forget military, royal and honorable titles >> etc... :) ) > >I'm in New

extending method descriptors

2009-06-25 Thread Michael Sliczniak
Suppose I have this: Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> class A(object): ... __slots__ = ('x', 'y') ... >>> a = A() >>> b = A() So I am using descriptors (and

compiling python 2.6.2 on uclibc

2009-06-25 Thread Jeseem S
hi, am looking for patched to compile python 2.6.2 on uclibc. any help is greatly appreciated thanks jeseem -- http://mail.python.org/mailman/listinfo/python-list

Re: IMPORTANT: I NEED TO HELP WITH ONE OF THE CORE DEVELOPERS

2009-06-25 Thread Grant Edwards
On 2009-06-24, Chris Rebert wrote: > In the future, also NOTE THAT SHOUTING TYPICALLY DOES NOT EARN ONE SYMPATHY. And to insure that a post is ignored, make sure the subject contains no meaningful question, only a plea for help: http://catb.org/~esr/faqs/smart-questions.html#bespecificurget

Re: os.walk and os.listdir problems python 3.0+

2009-06-25 Thread Amos Anderson
Thank you. That works very well when writing to a text file but what is the equivalent when writing the information to stdout using print? Sorry when I originally replied I sent it directly and it didn't go to the list. On Thu, Jun 25, 2009 at 12:57 AM, Mark Tolonen > wrote: > > "Amos Anderson"

Re: Tutorials on Jinja

2009-06-25 Thread Saurabh
On Jun 25, 2:04 am, Wayne Brehaut wrote: > On Wed, 24 Jun 2009 11:46:55 -0700 (PDT), Saurabh > > wrote: > >Hi All, > > >I am trying to move my application on a MVC architecture and plan to > >use Jinja for the same. Can anyone provide me with few quick links > >that might help me to get started w

Re: pyinstaller

2009-06-25 Thread Gabriel Genellina
En Sun, 21 Jun 2009 21:48:29 -0300, Arlie escribió: Newbie here using Python 2.6.2 on MS WinXP Pro SP3. I'm trying create an frozen exec and was able to generate and exe file. Have you tried py2exe? Imported files in myprog.py: import MySQLdb Probably using MySQLdb requires some extra wor

Re: Paramiko help - processing multiple commands

2009-06-25 Thread J. Clifford Dyer
On Wed, 2009-06-24 at 15:22 -0700, Frank Ruiz wrote: > Greetings, > > I am trying to process multiple commands using paramiko. I have > searched other threads, and I think my use case is a little different. > I am trying to login to a storage node that has a special shell, and > as such I cant exe

trace options

2009-06-25 Thread Edward Peschko
All, I've been looking at the trace module, and although it looks useful, I'm surprised that there aren't a couple of features that I would have thought would be fairly basic. So, does trace support (for the --trace option): - indentation tracking stacklevel (where each function is prefixed

Re: How to get filename from a pid?

2009-06-25 Thread Tim Golden
Dudeja, Rajat wrote: Hi, I've a PID of a process (the process is a notepad application), I want to know which file is opened by this process. Is there anything wrong with this answer which I gave you last week? (Note: there might be, but the fact that you seem to have ignored it makes me wond

Re: How to convert he boolean values into integers

2009-06-25 Thread samwyse
>>> int('1010100110', 2) 678 On Jun 25, 7:06 am, krishna wrote: > Hi Guys, > > I need to convert 1010100110 boolean value to some think like 2345, if > its possible then post me your comment on this > > Advanced thanks for all > > Narayana perumal.G -- http://mail.python.org/mailman/listinfo/py

I need a dict that inherits its mappings

2009-06-25 Thread samwyse
I need a dict-like object that, if it doesn't contain a key, will return the value from a "parent" object. Is there an easy way to do this so I don't have to define __getitem__ and __contains__ and others that I haven't even thought of yet? Here's a use case, if you're confused: en_GB=mydict() e

Re: How to convert he boolean values into integers

2009-06-25 Thread Ulrich Eckhardt
krishna wrote: > I need to convert 1010100110 boolean value to some think like 2345, if > its possible then post me your comment on this Yes, sure. You can simply sum up the digit values and then format them as decimal number. You can also just look up the number: def decode_binary(input):

scipy stats binom_test

2009-06-25 Thread dusans
Amm i using the function wrong or ...? cuz in R i get the right value >>> binom_test(3, 5, p=0.8) 0.262 > dbinom(3, 5, 0.8) [1] 0.205 -- http://mail.python.org/mailman/listinfo/python-list

How to convert he boolean values into integers

2009-06-25 Thread krishna
Hi Guys, I need to convert 1010100110 boolean value to some think like 2345, if its possible then post me your comment on this Advanced thanks for all Narayana perumal.G -- http://mail.python.org/mailman/listinfo/python-list

Re: Recipes for trace statements inside python programs?

2009-06-25 Thread Francesco Bochicchio
On 25 Giu, 13:15, koranthala wrote: > On Jun 25, 1:40 pm, Francesco Bochicchio wrote: > > > Is assert what you are looking for? > No. Assert raises exception if some condition is met. I just want to be able to enable/disable the printout of intermediate data, on a per function/method/class/module

How to get filename from a pid?

2009-06-25 Thread Dudeja, Rajat
Hi, I've a PID of a process (the process is a notepad application), I want to know which file is opened by this process. regards, Rajat Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privil

Re: Python simple web development

2009-06-25 Thread samwyse
I just started with web2py (http://www.web2py.com/) for an internal- use-only app that doesn't need to be very pretty. Been using it for about a week and after re-watching the tutorial, I've decided that I'm making things way too complicated. So today I'm going to replace a lot of my code with so

Re: Recipes for trace statements inside python programs?

2009-06-25 Thread samwyse
I use an @trace decorator. This (http://wordaligned.org/articles/ echo) will get you started but there are lots of others available. My personal preference is a decorator that catches, displays and re- raises exceptions as well as displaying both calling parameters and returned values. btw, here

  1   2   >