Re: EAFP gone wrong

2010-02-10 Thread Arnaud Delobelle
Malte Helmert writes: > Arnaud Delobelle wrote: > >> This means that EAFP made me hide a typo which would have been obviously >> detected had I LBYLed, i.e. instead of >> >> try: >> return val.latex() >> except AttributeError: >> ... >> >> do >> >> if hasattr(val, '

Re: Modifying Class Object

2010-02-10 Thread Alf P. Steinbach
* Stephen Hansen: On Tue, Feb 9, 2010 at 1:08 PM, Alf P. Steinbach > wrote: [abundant snips which do not accurately represent who said what where due to my own laziness] Not sure, but perhaps it's possible to mail directly to gman

Re: Modifying Class Object

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 12:13 AM, Alf P. Steinbach wrote: > You've dismissed at least one of my arguments with a simple hand-waving of, >> "That's invalid, cuz." >> > > That is not a quote of me. It is a lie. > > > > The thing is, there was no basis for 'cuz' beyond "In my own head this is >> wh

Re: Ternary plus

2010-02-10 Thread Mark Dickinson
On Feb 9, 6:47 pm, Martin Drautzburg wrote: > BTW I am not really trying to add three objects, I wanted a third object > which controls the way the addition is done. Sort of like "/" and "//" > which are two different ways of doing division. That seems like a reasonable use case for a third param

Re: Modifying Class Object

2010-02-10 Thread Stephen Hansen
> > On Wed, Feb 10, 2010 at 12:13 AM, Alf P. Steinbach wrote: > >> I do offer unsolicited help now and then, as I gave you and for which >>> Steve Holden decided that a bit of personal attack would be suitable. >> >> Really, I do have to say. It's one thing to say, "Aren't you being rude?" (pleas

Re: "if {negative}" vs. "if {positive}" style

2010-02-10 Thread Martin P. Hellwig
On 02/10/10 03:36, Tim Chase wrote: Larry Hudson wrote: But a minor rearrangement is simpler, and IMHO clearer: if 'mystring' not in s: print 'not found' else: print 'foundit' print 'processing' I've always vacillated on whether that would better be written as Larry does, or as if 'mystring'

Re: Ternary plus

2010-02-10 Thread Mark Dickinson
On Feb 10, 8:31 am, Mark Dickinson wrote: > And here's how it's used in the decimal.Context module: Aargh! decimal.Context *class*, not module. And it occurs to me that it would have been cleaner to have Decimal.__add__ call Context.add rather than the other way around. Then Decimal.__add__ cou

Re: use strings to call functions

2010-02-10 Thread Klaus Neuner
On Feb 9, 11:01 am, Stefan Behnel wrote: > KlausNeuner, 09.02.2010 10:04: > > > my program is supposed to parse files that I have created myself and that > > are on my laptop. It is not supposed to interact with anybody else > > than me. > > Famous last words. > > Stefan All right, I admit that e

Re: Programing family

2010-02-10 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Tue, 09 Feb 2010 17:49:21 +0100, Bruno Desthuilliers wrote: Not that much C++ in Python, IMHO. If that's for the OO part, then the closer to Python's object model I can think of is javascript. I thought that Javascript didn't even have inheritance until recently?

Re: Creating formatted output using picture strings

2010-02-10 Thread Peter Otten
pyt...@bdurham.com wrote: > Does Python provide a way to format a string according to a > 'picture' format? > > For example, if I have a string '123456789' and want it formatted > like '(123)-45-(678)[9]', is there a module or function that will > allow me to do this or do I need to code this typ

Re: mac install

2010-02-10 Thread Ned Deily
In article , Thomas Nelson wrote: > I downloaded the 3.1.1 dmg from http://www.python.org/download/releases/3.1.1/ > but when I run it I get the error "The folowing install step failed: > run postflight script for python documentation." The bugs list has > this bug at http://bugs.python.org/is

Re: New to Python

2010-02-10 Thread Jean-Michel Pichavant
Quin wrote: Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to PyScripter and will test tomorrow. I'm willing to bet money that it is not. If ironPython had a broken if statement, don't you think we would have known, already ? There's a rule when test writing/testin

Re: New to Python

2010-02-10 Thread Quin
Well, PyScripter works find with that code. Furthermore, the un-intellisense in IronPython was problematic, inserting the wrong things, which I had to erase. Also, there were some code constructs IronPython let pass that PyScripter didn't, namely, print(), PyScripter requires the () Somethi

Re: New to Python

2010-02-10 Thread Quin
Well, now you know! "Jean-Michel Pichavant" wrote in message news:mailman.2286.1265797348.28905.python-l...@python.org... Quin wrote: Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to PyScripter and will test tomorrow. I'm willing to bet money that it is not. If i

Re: Creating formatted output using picture strings

2010-02-10 Thread Olof Bjarnason
2010/2/10 Peter Otten <__pete...@web.de>: > pyt...@bdurham.com wrote: > >> Does Python provide a way to format a string according to a >> 'picture' format? >> >> For example, if I have a string '123456789' and want it formatted >> like '(123)-45-(678)[9]', is there a module or function that will >>

Re: New to Python

2010-02-10 Thread Jean-Michel Pichavant
Quin wrote: Well, now you know! "Jean-Michel Pichavant" wrote in message news:mailman.2286.1265797348.28905.python-l...@python.org... Quin wrote: Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to PyScripter and will test tomorrow. I'm willing to bet money that it

Re: ANN: obfuscate

2010-02-10 Thread Daniel Fetchinson
>> All algorithms in obfuscate are obsolete, insecure and only >> interesting for people *that* want to get well educated in the history >> of encryption. > > Not true. Another use case is suggested by the chosen name for the > library: to obfuscate text against casual human reading, while not > ma

Re: "if {negative}" vs. "if {positive}" style (was: New to Python)

2010-02-10 Thread Simon Brunning
On 10 February 2010 03:36, Tim Chase wrote: > Any thoughts on how others make the choice? There are two criteria that I use here. I'll often tend towards the positive test; it's just that little bit easier to comprehend, I think. On the other hand, if one case is overwhelmingly more common, I'll

Re: ANN: obfuscate

2010-02-10 Thread Simon Brunning
On 10 February 2010 01:24, Ben Finney wrote: > The classic example is rot-13 encryption of text in internet messages; > it would be a failure of imagination to suggest there are not other, > similar use cases. That's built-in: >>> "Hello World!".encode('rot-13') 'Uryyb Jbeyq!' -- Cheers, Simon

Re: ANN: obfuscate

2010-02-10 Thread Tim Golden
On 10/02/2010 11:23, Simon Brunning wrote: "Hello World!".encode('rot-13') Not any more! Python 3.1.1 (r311:74483, Aug 17 2009, win32 Type "help", "copyright", "credits" or "Hello World!".encode('rot-13') Traceback (most recent call last): File "", line 1, in LookupError: unknown encodin

Re: Creating formatted output using picture strings

2010-02-10 Thread Alf P. Steinbach
* Olof Bjarnason: 2010/2/10 Peter Otten <__pete...@web.de>: pyt...@bdurham.com wrote: Does Python provide a way to format a string according to a 'picture' format? For example, if I have a string '123456789' and want it formatted like '(123)-45-(678)[9]', is there a module or function that wi

Re: use strings to call functions

2010-02-10 Thread Bruno Desthuilliers
Klaus Neuner a écrit : All right, I admit that eval() is evil and should never be used. Can you tell the difference between your above statement and the following: """ eval() is potentially dangerous and can make code harder to debug. 99% of the proposed use case for eval() are covered by si

Re: New to Python

2010-02-10 Thread Martin P. Hellwig
On 02/10/10 10:53, Jean-Michel Pichavant wrote: Quin wrote: Well, now you know! All I know is that you are using a python implementation that does not support python 3. No wonder why your py3 code fails. You knew you known, you know :-) -- mph -- http://mail.python.org/mailman/listinfo/

Generic spreadsheet interface

2010-02-10 Thread Phil Hibbs
I've currently got an Excel spreadsheet with loads of VBA, and I've been thinking of porting it to OpenOffice.org. "This is a Python list!" I hear you cry, but bear with me - rather than just re-writing all the VBA code in OOo script, I thought, "why not make it generic - so it can work with Excel

Re: Dreaming of new generation IDE

2010-02-10 Thread Fuzzyman
On Feb 3, 7:38 pm, Phlip wrote: > On Feb 3, 10:57 am, Adam Tauno Williams > wrote: > > > > Current editors suck because they can't see into the code and browse > > > it - unless it's so statically typed it's painful. > > > ?  I edit Python in MonoDevelop  2.2;  and I can browse my file, > > class

Re: Creating formatted output using picture strings

2010-02-10 Thread Olof Bjarnason
2010/2/10 Alf P. Steinbach : > * Olof Bjarnason: >> >> 2010/2/10 Peter Otten <__pete...@web.de>: >>> >>> pyt...@bdurham.com wrote: >>> Does Python provide a way to format a string according to a 'picture' format? For example, if I have a string '123456789' and want it formatted

Re: Your beloved python features

2010-02-10 Thread Ricardo Aráoz
Bruce C. Baker wrote: > "Terry Reedy" wrote in message > news:mailman.1929.1265328905.28905.python-l...@python.org... > >> Iterators, and in particular, generators. >> A killer feature. >> >> Terry Jan Reedy >> >> > > Neither unique to Python. > > And then're the other killer "features" s

Re: Easter Eggs

2010-02-10 Thread rantingrick
On Feb 9, 5:40 pm, "Alf P. Steinbach" wrote: > I know 3 Python Easter Eggs, > >    from __future__ import braces >    import this >    help( "antigravity" ) > > Are there more? > > Cheers, > > - Alf Oh this is just great ALF! Now what secrets will the Py-Illuminati have to giggle about whist watc

Re: Tangling with mathplotlib(MPL) on XP and Win7 -- show() stopper

2010-02-10 Thread W. eWatson
Solved. I need to get into the interactive mode. Never heard of it until this morning. -- http://mail.python.org/mailman/listinfo/python-list

Re: Personal criticisms and logical fallacies

2010-02-10 Thread Ben Finney
"D'Arcy J.M. Cain" writes: > On Wed, 10 Feb 2010 01:38:50 +0100 > "Alf P. Steinbach" wrote: > > However, although in this particular case the Ad Hominems > > constituted logical fallacies, not all Ad Hominems are logical > > fallacies. > > Yes they are. Using the reputation of someone to prove

Re: How to measure elapsed time under Windows?

2010-02-10 Thread Grant Edwards
On 2010-02-09, Grant Edwards wrote: > On 2010-02-09, Jean-Michel Pichavant wrote: >> Did you try with the datetime module ? > > No. What mechanism does it use to get the current date/time? > >> import datetime >> t0 = datetime.datetime.now() >> t1 = t0 - datetime.datetime.now() >> t1.microsecon

Re: Programing family

2010-02-10 Thread Paul Rubin
Bruno Desthuilliers writes: > Now you forgot the whole Lisp / ML heritage - most FP stuff -, and of > course Simula and Smalltalk. http://i.imgur.com/1gF1j.jpg -- http://mail.python.org/mailman/listinfo/python-list

Re: Programing family

2010-02-10 Thread Gnarlodious
On Feb 9, 9:56 am, Paul Rubin wrote: > http://i.imgur.com/1gF1j.jpg Very funny, except where is Python and Forth? -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list

Re: use strings to call functions

2010-02-10 Thread Klaus Neuner
On Feb 10, 12:55 pm, Bruno Desthuilliers wrote: > KlausNeunera écrit : > > > > > All right, I admit that eval() is evil and should never be used. > > Can you tell the difference between your above statement and the following: As already pointed out in my second post (though perhaps not explicitly

ANN: visvis v1.1

2010-02-10 Thread Almar Klein
Hi all, I am pleased to announce version 1.1 of visvis, a Python visualization library for of 1D to 4D data. Website: http://code.google.com/p/visvis/ Discussion group: http://groups.google.com/group/visvis/ Documentation: http://code.google.com/p/visvis/wiki/Visvis_basics === Description === V

Re: How to measure elapsed time under Windows?

2010-02-10 Thread Paul McGuire
On Feb 10, 2:24 am, Dennis Lee Bieber wrote: > On Tue, 9 Feb 2010 21:45:38 + (UTC), Grant Edwards > declaimed the following in > gmane.comp.python.general: > > > Doesn't work.  datetime.datetime.now has granularity of > > 15-16ms. > > > Intervals much less that that often come back with a del

Re: "if {negative}" vs. "if {positive}" style (was: New to Python)

2010-02-10 Thread Roy Smith
In article , Tim Chase wrote: > Larry Hudson wrote: > > But a minor rearrangement is simpler, and IMHO clearer: > > > > if 'mystring' not in s: > > print 'not found' > > else: > > print 'foundit' > > print 'processing' > > I've always vacillated on whether that would better be w

Re: Dreaming of new generation IDE

2010-02-10 Thread catonano
Vladimir, On Feb 3, 12:10 pm, Vladimir Ignatov wrote: > Hello, > > I am sitting here for quite some time, but usually keep silent ;-) I > Finally I develop a feeling that strong instrumentation / tools can > bring us the best of two worlds. That I am dreaming on is an absolute > new type/class

Re: use strings to call functions

2010-02-10 Thread Bruno Desthuilliers
Klaus Neuner a écrit : On Feb 10, 12:55 pm, Bruno Desthuilliers wrote: KlausNeunera écrit : All right, I admit that eval() is evil and should never be used. Can you tell the difference between your above statement and the following: As already pointed out in my second post (though perhap

Re: Modifying Class Object

2010-02-10 Thread Duncan Booth
"Alf P. Steinbach" wrote: >> In CPython objects once created remain in the same memory location >> (and their id is their address). Compare that to IronPython where the >> objects themselves can move around in memory so they have no fixed >> address. Try comparing the IronPython implementation to

Re: New to Python

2010-02-10 Thread Quin
You know, Jack, that was the point of my original post: to determine why things weren't working. Do you still want to bet money that it is? I can screenshot you TD. "Jean-Michel Pichavant" wrote in message news:mailman.2288.1265799238.28905.python-l...@python.org... Quin wrote: Well, now

Function attributes

2010-02-10 Thread Muhammad Alkarouri
Hi everyone, What is the simplest way to access the attributes of a function from inside it, other than using its explicit name? In a function like f below: def f(*args): f.args = args print args is there any other way? I am guessing the next question will be: should I really care? It ju

Re: Modifying Class Object

2010-02-10 Thread Steven D'Aprano
On Wed, 10 Feb 2010 09:13:22 +0100, Alf P. Steinbach wrote: >> You've >> dismissed at least one of my arguments with a simple hand-waving of, >> "That's invalid, cuz." > > That is not a quote of me. It is a lie. Alf, although your English in this forum has been excellent so far, I understand yo

Re: Python and Ruby

2010-02-10 Thread waku
On Feb 9, 10:41 pm, Jonathan Gardner wrote: > On Feb 9, 1:51 am, waku wrote: > > > 'stupid', 'wrong', 'deficient', 'terrible', ...  you're using strong > > words instead of concrete arguments, it might intimidate your > > opponents, but is hardly helpful in a fair discussion. > > In today's day a

Re: Function attributes

2010-02-10 Thread Steven D'Aprano
On Wed, 10 Feb 2010 05:59:41 -0800, Muhammad Alkarouri wrote: > Hi everyone, > > What is the simplest way to access the attributes of a function from > inside it, other than using its explicit name? In a function like f > below: > > def f(*args): > f.args = args > print args > > is ther

Re: New to Python

2010-02-10 Thread Peter Otten
Quin wrote: > You know, Jack, that was the point of my original post: to determine why > things weren't working. Do you still want to bet money that it is? I can > screenshot you TD. You haven't posted the complete script, and you haven't given a thorough description how you invoke that script

Re: Function attributes

2010-02-10 Thread Krister Svanlund
On Wed, Feb 10, 2010 at 2:59 PM, Muhammad Alkarouri wrote: > Hi everyone, > > What is the simplest way to access the attributes of a function from > inside it, other than using its explicit name? > In a function like f below: > > def f(*args): >    f.args = args >    print args > > is there any ot

Re: use strings to call functions

2010-02-10 Thread Klaus Neuner
> Or perhaps is it me that failed to re-read a bit more of the thread > before answering - I obviously missed the irony (and made an a... of > myself), sorry :-/ There is nothing to be sorry about. I am grateful to all participants of this thread. I know a lot more about Python than before. -- ht

Re: Python and Ruby

2010-02-10 Thread Steve Holden
waku wrote: > On Feb 9, 10:41 pm, Jonathan Gardner > wrote: >> On Feb 9, 1:51 am, waku wrote: >> >>> 'stupid', 'wrong', 'deficient', 'terrible', ... you're using strong >>> words instead of concrete arguments, it might intimidate your >>> opponents, but is hardly helpful in a fair discussion. >>

Re: New to Python

2010-02-10 Thread Jean-Michel Pichavant
Quin wrote: You know, Jack, that was the point of my original post: to determine why things weren't working. Do you still want to bet money that it is? I can screenshot you TD. Another flaming war starting... IronPython implements python 2.5 and you're still complaining about your py3 cod

looking for some libraries

2010-02-10 Thread Vision
hi all, I am doing some stuffs with some software, which has similar layout like this: Editbox1 Editbox2 Editbox3 _OK_ ___ |output| |output| |output| |output| |output|

Re: Function attributes

2010-02-10 Thread John Posner
On 2/10/2010 9:36 AM, Steven D'Aprano wrote: On Wed, 10 Feb 2010 05:59:41 -0800, Muhammad Alkarouri wrote: Hi everyone, What is the simplest way to access the attributes of a function from inside it, other than using its explicit name? In a function like f below: def f(*args): f.args = a

Re: Function attributes

2010-02-10 Thread Bruno Desthuilliers
John Posner a écrit : On 2/10/2010 9:36 AM, Steven D'Aprano wrote: On Wed, 10 Feb 2010 05:59:41 -0800, Muhammad Alkarouri wrote: (snip) def f(*args): f.args = args print args (snip) I completely agree with you. It is a wart that functions are only able to refer to themselves by

Python v. Processing

2010-02-10 Thread Sky Larking
I am a light user of Python in a role as a systems administrator...I am new to the list, but have grown to really enjoy using Python to help in my job...Another interest I have ( but haven't fully explored ) is the idea of using programming as a creative outlet .. I have heard Processing: http://p

Re: Function attributes

2010-02-10 Thread Steven D'Aprano
On Wed, 10 Feb 2010 10:08:47 -0500, John Posner wrote: >> This won't work correctly, because old_f still tries to refer to itself >> under the name "f", and things break very quickly. > > They didn't break immediately for me -- what am I missing?: The original function f doesn't try to refer to

Re: Modifying Class Object

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 6:16 AM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > While it is true that quoted text is officially meant to indicate a > direct quote, it is also commonly used in informal text to indicate a > paraphrase. (There are other uses as well, but they don't

Re: Dreaming of new generation IDE

2010-02-10 Thread Steve Holden
catonano wrote: [... much wishing for the "good old day" of SmallTalk ...] > Today, I tried to understand the twisted.web.client code and I found 3 > methods I couldn't find by who were called. > > I asked on the mailing list and they suggested me where they were > called and that the tool for suc

Re: Python v. Processing

2010-02-10 Thread Robert Franke
Hi Sky, there is a project called pyprocessing (http://code.google.com/p/pyprocessing/) that aims to create a similar environment like processing in python. I am not sure though how advanced this is. Cheers, Robert On Wed, Feb 10, 2010 at 4:29 PM, Sky Larking wrote: > I am a light user of Pyt

Re: Function attributes

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 6:36 AM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Wed, 10 Feb 2010 05:59:41 -0800, Muhammad Alkarouri wrote: > > What is the simplest way to access the attributes of a function from > > inside it, other than using its explicit name? In a function

Re: Creating formatted output using picture strings

2010-02-10 Thread MRAB
Olof Bjarnason wrote: 2010/2/10 Peter Otten <__pete...@web.de>: pyt...@bdurham.com wrote: Does Python provide a way to format a string according to a 'picture' format? For example, if I have a string '123456789' and want it formatted like '(123)-45-(678)[9]', is there a module or function tha

Re: Creating formatted output using picture strings

2010-02-10 Thread Stephen Hansen
On Wed, Feb 10, 2010 at 1:45 AM, Peter Otten <__pete...@web.de> wrote: > A basic implementation without regular expressions: > > >>> def picture(s, pic, placeholder="@"): > ... parts = pic.split(placeholder) > ... result = [None]*(len(parts)+len(s)) > ... result[::2] = parts > ...

Re: Personal criticisms and logical fallacies

2010-02-10 Thread Robert Kern
On 2010-02-10 01:06 AM, Steven Howe wrote: Really, is this a relevant topic on a program mail list? Yes. Meta-discussions about how we discuss programming productively are also on-topic. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is mad

Re: How to measure elapsed time under Windows?

2010-02-10 Thread Grant Edwards
On 2010-02-09, Gabriel Genellina wrote: > En Tue, 09 Feb 2010 13:10:56 -0300, Grant Edwards > escribi?: > >> What's the correct way to measure small periods of elapsed >> time. I've always used time.clock() in the past: >> >> However on multi-processor machines that doesn't work. >> Sometimes I

Re: looking for some libraries

2010-02-10 Thread rantingrick
On Feb 10, 8:59 am, Vision wrote: > hi all, > I am doing some stuffs with some software, which has similar layout > like this: > Editbox1 > Editbox2 > Editbox3 >        _OK_ > ___ > |        output        | > |        output        | > |        output        | >

Re: Function attributes

2010-02-10 Thread MRAB
Stephen Hansen wrote: On Wed, Feb 10, 2010 at 6:36 AM, Steven D'Aprano > wrote: On Wed, 10 Feb 2010 05:59:41 -0800, Muhammad Alkarouri wrote: > What is the simplest way to access the attributes of a function from > inside it, other than

Re: Creating formatted output using picture strings

2010-02-10 Thread python
Original poster here. Thank you all for your ideas. I certainly learned some great techniques by studying everyone's solutions!! I was thinking that there was a built-in function for this common(?) use case which is why I shied away from writing my own in the first place ... hoping to not-reinven

Re: [PyOpenGL-Users] Mouse wheel events?

2010-02-10 Thread Craig Berry
I'm happy to report that FreeGLUT solved my problem. I obtained the Windows prepackaged binary distribution, pulled out freeglut.dll, renamed it to glut32.dll, and replaced the existing glut32.dll in the PyOpenGL installation directory tree with the new version. Mousewheel events are now reported

Re: looking for some libraries

2010-02-10 Thread Jean-Michel Pichavant
Vision wrote: hi all, I am doing some stuffs with some software, which has similar layout like this: Editbox1 Editbox2 Editbox3 _OK_ ___ |output| |output| |output| |output| |output

Re: Creating formatted output using picture strings

2010-02-10 Thread Tim Chase
pyt...@bdurham.com wrote: Original poster here. Thank you all for your ideas. I certainly learned some great techniques by studying everyone's solutions!! Thanks for the positive feedback -- it's something most folks like to hear when they try to assist and such thanks appears too rarely on

Re: Function attributes

2010-02-10 Thread John Posner
On 2/10/2010 10:24 AM, Bruno Desthuilliers wrote: They didn't break immediately for me -- what am I missing?: The fact that in the OP's snippet, code inside f's body refers to f by its name. Of course! Tx. -John -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating formatted output using picture strings

2010-02-10 Thread Arnaud Delobelle
pyt...@bdurham.com writes: > Original poster here. > > Thank you all for your ideas. I certainly learned some great techniques > by studying everyone's solutions!! > > I was thinking that there was a built-in function for this common(?) use > case which is why I shied away from writing my own in t

Re: Creating formatted output using picture strings

2010-02-10 Thread python
Hi Tim, Thank you very much for your update to MRAB's creative solution. > You don't give the expected output for these test cases, so > it's hard to tell whether you want to pad-left or pad-right. To be honest, I wasn't sure myself :) My original post was the result of doing some simple forma

Re: [PyOpenGL-Users] Mouse wheel events?

2010-02-10 Thread Gary Herron
Craig Berry wrote: I'm happy to report that FreeGLUT solved my problem. I obtained the Windows prepackaged binary distribution, pulled out freeglut.dll, renamed it to glut32.dll, and replaced the existing glut32.dll in the PyOpenGL installation directory tree with the new version. Mousewheel ev

Re: Python and Ruby

2010-02-10 Thread Andreas Waldenburger
On Wed, 10 Feb 2010 09:51:11 -0500 Steve Holden wrote: > [snip] > It's as sensible to complain about people being "*forced* to keep > perfect indentation" as it is to complain about people being *forced* > to use braces to delimit code blocks. > > This is called "syntax", and it's a part of the

Re: Function attributes

2010-02-10 Thread Arnaud Delobelle
Steven D'Aprano writes: > On Wed, 10 Feb 2010 10:08:47 -0500, John Posner wrote: > >>> This won't work correctly, because old_f still tries to refer to itself >>> under the name "f", and things break very quickly. >> >> They didn't break immediately for me -- what am I missing?: > > The original

Re: Creating formatted output using picture strings

2010-02-10 Thread python
Arnaud, Very cool!! Just when I thought the problem couldn't be made simpler ... WOW!!! Again, a big thank you to everyone who posted solutions!!! I'm humbled at how clever and different everyone's techniques have been. I have to say, I learned much more than I thought I needed to learn :) Tha

Re: Function attributes

2010-02-10 Thread Steven D'Aprano
On Wed, 10 Feb 2010 17:23:36 +, MRAB wrote: > Stephen Hansen wrote: >> On Wed, Feb 10, 2010 at 6:36 AM, Steven D'Aprano >> > > wrote: >> >> On Wed, 10 Feb 2010 05:59:41 -0800, Muhammad Alkarouri wrote: >> > What is the simplest way to acce

Re: Creating formatted output using picture strings

2010-02-10 Thread donn
On 10/02/2010 20:36, pyt...@bdurham.com wrote: def picture(s, pic, placeholder='@'): nextchar=iter(s).next return ''.join(nextchar() if i == placeholder else i for i in pic) Hell's teeth - even I understood that! Amazing solution. \d -- Fonty Python and Things! -- http://otherwise.re

Re: Function attributes

2010-02-10 Thread Steven D'Aprano
On Wed, 10 Feb 2010 18:31:23 +, Arnaud Delobelle wrote: > It's not ideal, but you can use a decorator like this to solve this > problem: > > def bindfunction(f): > def bound_f(*args, **kwargs): > return f(bound_f, *args, **kwargs) > bound_f.__name__ = f.__name__ > return b

Need debugging knowhow for my creeping Unicodephobia

2010-02-10 Thread kj
Some people have mathphobia. I'm developing a wicked case of Unicodephobia. I have read a *ton* of stuff on Unicode. It doesn't even seem all that hard. Or so I think. Then I start writing code, and WHAM: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not i

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-10 Thread Jonathan Gardner
On Feb 10, 11:09 am, kj wrote: > > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: > ordinal not in range(128) > You'll have to understand some terminology first. "codec" is a description of how to encode and decode unicode data to a stream of bytes. "decode" means you

Re: Creating formatted output using picture strings

2010-02-10 Thread MRAB
Tim Chase wrote: pyt...@bdurham.com wrote: Original poster here. Thank you all for your ideas. I certainly learned some great techniques by studying everyone's solutions!! Thanks for the positive feedback -- it's something most folks like to hear when they try to assist and such thanks appea

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-10 Thread Duncan Booth
kj wrote: > But to ground > the problem a bit I'll say that the exception above happens during > the execution of a statement of the form: > > x = '%s %s' % (y, z) > > Also, I found that, with the exact same values y and z as above, > all of the following statements work perfectly fine: > >

Re: Creating formatted output using picture strings

2010-02-10 Thread Grant Edwards
On 2010-02-10, pyt...@bdurham.com wrote: [regardning "picture" output format specifiers] > I was thinking that there was a built-in function for this > common(?) use case I haven't seen that paradigm since my one-and-only exposure to COBOL in a class I took back in 1979. Is the "picture" thing

Re: Modifying Class Object

2010-02-10 Thread Alf P. Steinbach
* Duncan Booth: "Alf P. Steinbach" wrote: In CPython objects once created remain in the same memory location (and their id is their address). Compare that to IronPython where the objects themselves can move around in memory so they have no fixed address. Try comparing the IronPython implementa

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-10 Thread MRAB
kj wrote: Some people have mathphobia. I'm developing a wicked case of Unicodephobia. I have read a *ton* of stuff on Unicode. It doesn't even seem all that hard. Or so I think. Then I start writing code, and WHAM: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ord

Re: Modifying Class Object

2010-02-10 Thread Alf P. Steinbach
* Steven D'Aprano: On Wed, 10 Feb 2010 09:13:22 +0100, Alf P. Steinbach wrote: You've dismissed at least one of my arguments with a simple hand-waving of, "That's invalid, cuz." That is not a quote of me. It is a lie. Alf, although your English in this forum has been excellent so far, I und

SocketServer error: AttributeError: instance has no __call__ method

2010-02-10 Thread Jordan Apgar
Hey guys, I'm having some issues connecting to my Socket Server, I get this traceback on the sever side: Exception happened during processing of request from ('127.0.0.1', 56404) Traceback (most recent call last): File "/usr/lib/python2.6/SocketServer.py"

Re: Creating formatted output using picture strings

2010-02-10 Thread sstein...@gmail.com
On Feb 10, 2010, at 2:57 PM, Grant Edwards wrote: > On 2010-02-10, pyt...@bdurham.com wrote: > > [regardning "picture" output format specifiers] > >> I was thinking that there was a built-in function for this >> common(?) use case > > I haven't seen that paradigm since my one-and-only exposure

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-10 Thread Anthony Tolle
On Feb 10, 2:09 pm, kj wrote: > Some people have mathphobia.  I'm developing a wicked case of > Unicodephobia. > [snip] Some general advice (Looks like I am reiterating what MRAB said -- I type slower :): 1. If possible, use unicode strings for everything. That is, don't use both str and unicod

Re: New to Python

2010-02-10 Thread Terry Reedy
On 2/10/2010 5:21 AM, Quin wrote: Well, PyScripter works find with that code. Furthermore, the un-intellisense in IronPython was problematic, inserting the wrong things, which I had to erase. Also, there were some code constructs IronPython let pass that PyScripter didn't, namely, print(), PySc

Re: Creating formatted output using picture strings

2010-02-10 Thread Tim Chase
Grant Edwards wrote: [regardning "picture" output format specifiers] I was thinking that there was a built-in function for this common(?) use case I haven't seen that paradigm since my one-and-only exposure to COBOL in a class I took back in 1979. Is the "picture" thing commonly used in other

Re: Creating formatted output using picture strings

2010-02-10 Thread Grant Edwards
On 2010-02-10, sstein...@gmail.com wrote: > On Feb 10, 2010, at 2:57 PM, Grant Edwards wrote: > >> On 2010-02-10, pyt...@bdurham.com wrote: >> >> [regardning "picture" output format specifiers] >> >>> I was thinking that there was a built-in function for this >>> common(?) use case >> >> I hav

A silly question on file opening

2010-02-10 Thread joy99
Dear Group, I was using Python with IDLE as GUI for quite some time. My Operating System was Windows XP with Service Pack2. Recently I changed the Operating System to Windows XP with Service Pack3. I had to reinstall Python for which I downloaded "python-2.6.4.msi"and loaded it in my D drive. Her

Re: "if {negative}" vs. "if {positive}" style

2010-02-10 Thread Ethan Furman
Tim Chase wrote: Any thoughts on how others make the choice? -tkc If one branch is only a few lines, it comes first. As often as not, that tiny branch is checking for errors, and the "else" branch doesn't need to be indented. def func(arg1): if arg1 is 'stupid': raise ValueErr

Re: Creating formatted output using picture strings

2010-02-10 Thread sstein...@gmail.com
On Feb 10, 2010, at 3:40 PM, Grant Edwards wrote: > On 2010-02-10, sstein...@gmail.com wrote: >> On Feb 10, 2010, at 2:57 PM, Grant Edwards wrote: >> >>> On 2010-02-10, pyt...@bdurham.com wrote: >>> >>> [regardning "picture" output format specifiers] >>> I was thinking that there was a

Re: A silly question on file opening

2010-02-10 Thread Anthony Tolle
On Feb 10, 3:42 pm, joy99 wrote: > Dear Group, > [snip] > I tried to change the location to D:\file and as I saw in Python Docs > the file reading option is now "r+" so I changed the statement to >    file_open=open("D:\file","r+") > but it is still giving error. Only use "r+" if you need to also

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-10 Thread kj
In <402ac982-0750-4977-adb2-602b19149...@m24g2000prn.googlegroups.com> Jonathan Gardner writes: >On Feb 10, 11:09=A0am, kj wrote: >> FWIW, I'm using Python 2.6. =A0The example above happens to come from >> a script that extracts data from HTML files, which are all in >> English, but they are a

Re: Modifying Class Object

2010-02-10 Thread Ethan Furman
Steven D'Aprano wrote: Believe me Alf, the fact that people are taking the time to try to argue with you instead of just kill-filing you is a compliment. It's a compliment I am not paying, although I am grateful to those who are attempting to teach him. At the rate it's going, though, I don

Re: Modifying Class Object

2010-02-10 Thread Steve Holden
Alf P. Steinbach wrote: > * Duncan Booth: >> "Alf P. Steinbach" wrote: >> In CPython objects once created remain in the same memory location (and their id is their address). Compare that to IronPython where the objects themselves can move around in memory so they have no fixed

  1   2   >