Re: A simple-to-use sound file writer

2010-01-16 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: * Grant Edwards: On 2010-01-15, Steve Holden wrote: I will, however, observe that your definition of a square wave is what I would have to call a "'square' wave" (and would prefer to call

Re: A simple-to-use sound file writer

2010-01-17 Thread Alf P. Steinbach
* Alf P. Steinbach: * Steve Holden: Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: * Grant Edwards: On 2010-01-15, Steve Holden wrote: I will, however, observe that your definition of a square wave is what I would have to call a "'square' wave" (and

Re: A simple-to-use sound file writer

2010-01-17 Thread Alf P. Steinbach
* Alf P. Steinbach: Just as a contribution, ... The original code I posted was only written for Python 3.1.1 (because the code was for my writings which assumes 3.x). In the simple_sound module this caused a deprecation warning with 2.x. And the example program didn't work with 2.x.

Re: Inheriting methods but over-riding docstrings

2010-01-17 Thread Alf P. Steinbach
* Gabriel Genellina: En Sat, 16 Jan 2010 14:55:11 -0300, Steven D'Aprano escribió: I have a series of subclasses that inherit methods from a base class, but I'd like them to have their own individual docstrings. The obvious solution (other than copy-and-paste) is this: class Base(object):

Re: The answer

2010-01-17 Thread Alf P. Steinbach
* Jive Dadson: Okay, with your help I've figured it out. Instructions are below, but read the caveat by Ben Fenny in this thread. All this stuff is good for one default version of Python only. The PYTHONPATH described below, for example, cannot specify a version number. Yes, that's a pain i

Re: thread return code

2010-01-19 Thread Alf P. Steinbach
* Rajat: Hi, I'm using threading module in Python 2.6.4. I'm using thread's join() method. On the new thread I'm running a function which returns a code at the end. Is there a way I access that code in the parent thread after thread finishes? Simply, does join() could get me that code? join()

Re: Updating an OptionMenu every time the text file it reads from is updated (Tkinter)

2010-01-19 Thread Alf P. Steinbach
* Dr. Benjamin David Clarke: I currently have a program that reads in values for an OptionMenu from a text file. I also have an option to add a line to that text file which corresponds to a new value for that OptionMenu. How can I make that OptionMenu update its values based on that text file wit

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Alf P. Steinbach
* Gerald Britton: Yesterday I stumbled across some old code in a project I was working on. It does something like this: mystring = '\n'.join( [ line for line in lines if ] ) where "lines" is a simple list of strings. I realized that the code had been written before you could put a list compr

Re: Iterate over group names in a regex match?

2010-01-19 Thread Alf P. Steinbach
* Brian D: Here's a simple named group matching pattern: s = "1,2,3" p = re.compile(r"(?P\d),(?P\d),(?P\d)") m = re.match(p, s) m <_sre.SRE_Match object at 0x011BE610> print m.groups() ('1', '2', '3') Is it possible to call the

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Alf P. Steinbach
* Steven D'Aprano: On Tue, 19 Jan 2010 16:20:42 -0500, Gerald Britton wrote: That's surprising. I wouldn't implement it that way at all. I'd use a dynamically-expanding buffer as I suggested. That way you get a single pass and don't have to calculate anything before you begin. In the best ca

Re: Performance of lists vs. list comprehensions

2010-01-20 Thread Alf P. Steinbach
* Steven D'Aprano: On Wed, 20 Jan 2010 05:25:22 +0100, Alf P. Steinbach wrote: * Steven D'Aprano: On Tue, 19 Jan 2010 16:20:42 -0500, Gerald Britton wrote: That's surprising. I wouldn't implement it that way at all. I'd use a dynamically-expanding buffer as I sugge

Re: examining an initial, pristine python3 shell session

2010-01-20 Thread Alf P. Steinbach
* Robert P. J. Day: still working my way through "dive into python 3" and i've already been asked to give a newbie tutorial on it -- blind leading the blind, as it were. that should be hilarious. i'll be using python 3 and it occurred to me that it would be educatio

Re: examining an initial, pristine python3 shell session

2010-01-20 Thread Alf P. Steinbach
* Alf P. Steinbach: * Robert P. J. Day: still working my way through "dive into python 3" and i've already been asked to give a newbie tutorial on it -- blind leading the blind, as it were. that should be hilarious. i'll be using python 3 and it occurred to me that it

Re: Best way to convert sequence of bytes to long integer

2010-01-20 Thread Alf P. Steinbach
* Mark Dickinson: On Jan 20, 7:36 am, Steven D'Aprano wrote: I have a byte string (Python 2.x string), e.g.: s = "g%$f yg\n1\05" assert len(s) == 10 I wish to convert it to a long integer, treating it as base-256. By the way, are you willing to divulge what you're using this functionality f

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Martin Drautzburg: Hello all, When passing parameters to a function, you sometimes need a paramter which can only assume certain values, e.g. def move (direction): ... If direction can only be "up", "down", "left" or "right", you can solve this by passing strings, but

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
hat python provides by default. Best regards, Javier 2010/1/21 Alf P. Steinbach : * Martin Drautzburg: Hello all, When passing parameters to a function, you sometimes need a paramter which can only assume certain values, e.g. def move (direction): ... If direction can o

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Carl Banks: On Jan 20, 11:43 pm, Martin Drautzburg [snip] What I am really looking for is a way - to be able to call move(up) - having the "up" symbol only in the context of the function call Short answer is, you can't do it. On the contrary, it's not difficult to do.

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Stefan Behnel: Alf P. Steinbach, 21.01.2010 09:30: * Martin Drautzburg: - to be able to call move(up) - having the "up" symbol only in the context of the function call So it should look something like this ... magic, magic ... move(up) ... unmagic, unmagic ..

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Stefan Behnel: Alf P. Steinbach, 21.01.2010 11:38: * Carl Banks: On Jan 20, 11:43 pm, Martin Drautzburg [snip] What I am really looking for is a way - to be able to call move(up) - having the "up" symbol only in the context of the function call Short answer is,

Re: Create object name from string value?

2010-01-21 Thread Alf P. Steinbach
* Gnarlodious: On Jan 20, 10:35 pm, Steven D'Aprano wrote: That's the wrong way to handle the problem. Named objects are only useful if you know the name of the object when writing the code. Otherwise, how do you know what name to use in the code? Thank you for the help. I am gathering the na

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Carl Banks: On Jan 21, 2:38 am, "Alf P. Steinbach" wrote: * Carl Banks: On Jan 20, 11:43 pm, Martin Drautzburg [snip] What I am really looking for is a way - to be able to call move(up) - having the "up" symbol only in the context of the function c

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Diez B. Roggisch: Am 21.01.10 12:58, schrieb Alf P. Steinbach: * Stefan Behnel: Alf P. Steinbach, 21.01.2010 11:38: * Carl Banks: On Jan 20, 11:43 pm, Martin Drautzburg [snip] What I am really looking for is a way - to be able to call move(up) - having the "up" symbol o

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Diez B. Roggisch: Am 21.01.10 19:48, schrieb Alf P. Steinbach: * Diez B. Roggisch: Am 21.01.10 12:58, schrieb Alf P. Steinbach: * Stefan Behnel: Alf P. Steinbach, 21.01.2010 11:38: * Carl Banks: On Jan 20, 11:43 pm, Martin Drautzburg [snip] What I am really looking for is a way - to

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Diez B. Roggisch: Am 21.01.10 20:01, schrieb Alf P. Steinbach: * Diez B. Roggisch: Am 21.01.10 19:48, schrieb Alf P. Steinbach: * Diez B. Roggisch: Am 21.01.10 12:58, schrieb Alf P. Steinbach: * Stefan Behnel: Alf P. Steinbach, 21.01.2010 11:38: * Carl Banks: On Jan 20, 11:43 pm

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Carl Banks: On Jan 21, 10:46 am, "Alf P. Steinbach" wrote: * Carl Banks: On Jan 21, 2:38 am, "Alf P. Steinbach" wrote: * Carl Banks: On Jan 20, 11:43 pm, Martin Drautzburg [snip] What I am really looking for is a way - to be able to call move(up)

Re: Rounding up to the next 100

2010-01-21 Thread Alf P. Steinbach
* michael.coll-ba...@verizonwireless.com: From: noydb If one has a floating number as a string, is there a spiffy way to round that string-number UP to the nearest 100? XstrNmbr = 3579.127893 -- would want to round that to 3600. What's wrong with round? round( XstrNmbr, -2 ) seems to d

Re: Rounding up to the next 100

2010-01-21 Thread Alf P. Steinbach
* noydb: Sorry, although what I really need is the string-number rounded UP every time. So if the number is 3890.32, it needs to go to 3900; if the number is 3811.345, it needs to go to 3900 also. So, Florian's answer works. You might also consider -100*(-3579.127893//100) :-) Which avoi

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
* Martin Drautzburg: Thanks for all the answers. Let me summarize (1) I fail to see the relevance of >>> def move( direction ): ... print( "move " + str( direction ) ) ... >>> move( "up" ) move up not only in the context of my question. And I don't see an abuse of the language either. May

Re: Symbols as parameters?

2010-01-22 Thread Alf P. Steinbach
* Stefan Behnel: Alf P. Steinbach, 21.01.2010 20:24: Do you understand how bad that makes you look? I think the right thing to say at this point is "don't feed the troll". I find it amazing that you continue this kind of ad hominem attack. You leave it open who you regard a

Re: Symbols as parameters?

2010-01-22 Thread Alf P. Steinbach
* Martin Drautzburg: Here is a complete expample using a decorator, still a bit noisy def move(aDirection): print "moving " + aDirection #Here comes the decorator def scope(aDict): def save(locals): """Set symbols in locals and remember their original state""" setSymbols

Re: Symbols as parameters?

2010-01-22 Thread Alf P. Steinbach
* Steven D'Aprano -> Alf P. Steinbach: No, you got it spot on. Not to discourage you, but you're at least the third person who pointed this out in this thread. I get the impression that there's some message traffic that I don't see, perhaps on the mailing list, s

Re: Symbols as parameters?

2010-01-22 Thread Alf P. Steinbach
* Steven D'Aprano: One implementation-specific trick is that modifying locals does actually work inside a class definition (at least in Python 2.5): class Foo(object): ... x = 1 ... print locals() ... locals()['x'] = 2 ... {'x': 1, '__module__': '__main__'} Foo.x 2 But it doe

Re: Symbols as parameters?

2010-01-22 Thread Alf P. Steinbach
* Wolfgang Rohdewald: On Friday 22 January 2010, Alf P. Steinbach wrote: I get the impression that there's some message traffic that I don't see For example, the recent thread "Covert number into string" started with a reply in my newreader, using EternalSeptember&#

Re: maintain 2 versions of python on my computer

2010-01-22 Thread Alf P. Steinbach
* Aahz: In article , Duncan Booth wrote: That seems overkill. This does pretty much the same thing: @(C:\Python26\Python -x %~f0 %* || pause) && goto:EOF import sys print sys.version # raise RuntimeError # uncomment to trigger the 'pause' What version of Wi

Re: list.pop(0) vs. collections.dequeue

2010-01-22 Thread Alf P. Steinbach
* Steve Howell: On Jan 22, 7:09 pm, Roy Smith wrote: In article <3ac173bd-4124-434d-b726-0b9baaeec...@36g2000yqu.googlegroups.com>, Steve Howell wrote: In my case I'm not really concerned about giving the memory back right away, it's more about keeping my code simple. Once I'm done with an

Re: list.pop(0) vs. collections.dequeue

2010-01-23 Thread Alf P. Steinbach
* Steve Howell: On Jan 23, 12:13 am, Terry Reedy wrote: Challenge yes, mock no. Part of writing good basic data structures is not adding needless complication from featuritis and not penalizing 99.99% of access to satify a .01% need better satisfied another way. I would like to challenge yo

Re: list.pop(0) vs. collections.dequeue

2010-01-23 Thread Alf P. Steinbach
* Steve Howell: On Jan 23, 12:32 am, "Alf P. Steinbach" wrote: * Steve Howell: On Jan 23, 12:13 am, Terry Reedy wrote: Challenge yes, mock no. Part of writing good basic data structures is not adding needless complication from featuritis and not penalizing 99.99% of access to sa

Re: iterating lists

2010-01-23 Thread Alf P. Steinbach
* ceciliasei...@gmx.de: As you were talking about list.pop()... Is anyone able to reproduce the following and explain why this happens by chance? (Using 3.1.1) l1 = ["ready", "steady", "go"] l2 = ["one", "two", "tree"] l3 = ["lift off"] for w in l1: print(l1.pop()) #prints only "go stead

Re: list.pop(0) vs. collections.dequeue

2010-01-23 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 23 Jan 2010 09:57:04 -0500, Roy Smith wrote: In article , "Alf P. Steinbach" wrote: But it would IMHO have been better if it wasn't called "list", which brings in the wrong associations for someone used to other languages. +1. Whe

Re: this customize sort did not work ,what's wrong?

2010-01-23 Thread Alf P. Steinbach
* thinke365: jesus, now i fixed it, using odd lambda sort. l.sort(lambda x,y: cmp(len(x), len(y))) print l This uses 'cmp'. Your earlier code, quoted below, used '>'. BUT I AM STILL CONFUSED WHY COSTOMIZED SORT FAILED TO SORT AS IT IS PROGRAMMER! Please don't shout. thinke365 wrote: i

Re: ISO module for binomial coefficients, etc.

2010-01-24 Thread Alf P. Steinbach
* Dave Angel: kj wrote: Before I go off to re-invent a thoroughly invented wheel, I thought I'd ask around for some existing module for computing binomial coefficient, hypergeometric coefficients, and other factorial-based combinatorial indices. I'm looking for something that can handle fairly

Re: how to list the attributes of a class, not an object?

2010-01-24 Thread Alf P. Steinbach
* Robert P. J. Day: once again, probably a trivial question but i googled and didn't get an obvious solution. how to list the attributes of a *class*? eg., i was playing with dicts and noticed that the type returned by the keys() method was "dict_keys". so i'm n

Re: how to list the attributes of a class, not an object?

2010-01-24 Thread Alf P. Steinbach
* Robert P. J. Day: On Sun, 24 Jan 2010, Alf P. Steinbach wrote: * Robert P. J. Day: once again, probably a trivial question but i googled and didn't get an obvious solution. how to list the attributes of a *class*? eg., i was playing with dicts and noticed that the type returned b

Re: Symbols as parameters?

2010-01-24 Thread Alf P. Steinbach
* Gabriel Genellina: En Fri, 22 Jan 2010 10:16:50 -0300, Alf P. Steinbach escribió: I get the impression that there's some message traffic that I don't see, perhaps on the mailing list, since (a) I haven't seen that about 'locals' pointed out by anyone else in this

Re: Symbols as parameters?

2010-01-24 Thread Alf P. Steinbach
Just top-posting for clarity. :-) up = "UP" left= "LEFT" down= "DOWN" right = "RIGHT" # This code is not guaranteed to work by the language specification. # But it is one way to do the solution I presented earlier in the thread. import sys def import_from( module_name ):

Re: [Edu-sig] some turtle questions

2010-01-24 Thread Alf P. Steinbach
* Helene Martin: I'm almost sure that there's no way for a turtle to know anything about the background. That's an unfortunate limitation! The "background" for the turtle is just a Tkinter canvas. So yes, it's technically possible to inspect things there, since there is method to obtain the

Re: start .pyo files with doubleclick on windows

2010-01-24 Thread Alf P. Steinbach
* News123: Hi, I'd like to start .pyo files under windows with a double click. (I know I can just write a .bat wrapper, but somehow it would be more fun to start with a direct double click) Currently this works if the file does not import any other .pyo file. The problem is, that a doblecl

Re: TypeError not caught by except statement

2010-01-25 Thread Alf P. Steinbach
* siddu: Hi, except not able to caught the TypeError exception occured in the below code log.info("refer",ret) in the try block throws a TypeError which is not caught . Also sometimes process is getting hanged. --

Re: Total maximal size of data

2010-01-25 Thread Alf P. Steinbach
* AlexM: On Jan 25, 2:07 pm, Terry Reedy wrote: On 1/25/2010 2:05 PM, Alexander Moibenko wrote: I have a simple question to which I could not find an answer. Because it has no finite answer What is the total maximal size of list including size of its elements? In theory, unbounded. In pra

Re: list.pop(0) vs. collections.dequeue

2010-01-25 Thread Alf P. Steinbach
* Ethan Furman: Steve Howell wrote: On Sat, 23 Jan 2010 09:57:04 -0500, Roy Smith wrote: So, we're right back to my statement earlier in this thread that the docs are deficient in that they describe behavior with no hint about cost. Given that, it should be no surprise that users make incorrect

Re: Accessing the name of an actual parameter

2010-01-26 Thread Alf P. Steinbach
* Hellmut Weber: consider the following piece of code, please - - def f(param): nameOfParam = ??? # here I want to access the name of the variable # which was given as parameter to the function print nameOfParam, param return if __name__ == __main__: a = 1 f(a) b = '

Re: deriving from array.array

2010-01-26 Thread Alf P. Steinbach
* Torsten Mohr: Hello, i try to derive a class from array.array: import array class Abc(array.array): def __init__(self, a, b): array.array.__init__(self, 'B') self.a = a self.b = b a = Abc(4, 5) print a print a.a I get an error for "a = Abc(4, 5)", seems the p

Re: deriving from array.array

2010-01-26 Thread Alf P. Steinbach
* Alf P. Steinbach: * Torsten Mohr: Hello, i try to derive a class from array.array: import array class Abc(array.array): def __init__(self, a, b): array.array.__init__(self, 'B') self.a = a self.b = b a = Abc(4, 5) print a print a.a I get an er

Re: deriving from array.array

2010-01-26 Thread Alf P. Steinbach
* Torsten Mohr: thanks a lot for your hint, it works fine. I get an error for "a = Abc(4, 5)", seems the parameters are forwarded to array's __init__ as they are. No, with CPython they're forwarded to __new__. Not sure if i understand this correctly, if i derive from other classes (like wxp

Re: python 3's adoption

2010-01-26 Thread Alf P. Steinbach
I'm responding to the original message by Xah Lee, which is not carried by my Usenet provider. * Alan Harris-Reid: Xah Lee wrote: Some thoughts about Python 3 Adoption. Xah Lee, 2010-01-26 Some notes of Wikipedia readings related to Python. Unladen Swallow, a new project from Google. It is

Re: python 3's adoption

2010-01-26 Thread Alf P. Steinbach
* alex23: "Alf P. Steinbach" wrote: Actually not, IMHO. All it does is is to provide incompatibility. They forgot Ronald Reagan's old maxim: if it don't need fixin', don't fix it. [...] Probably there must have been some rationale, but to put it bluntly removi

Re: python 3's adoption

2010-01-26 Thread Alf P. Steinbach
* Steve Holden: [Off-list] alex23 wrote: "Alf P. Steinbach" wrote: Actually not, IMHO. All it does is is to provide incompatibility. They forgot Ronald Reagan's old maxim: if it don't need fixin', don't fix it. [...] Probably there must have been some ra

Re: python 3's adoption

2010-01-26 Thread Alf P. Steinbach
* John Bokma: "Alf P. Steinbach" writes: Please don't post more noise and ad hominem attacks to the group, Steve. Funny that you talk about noise while replying yourself to noise. Xah Lee is just a pathetic spammer. He's not going to reply in this thread. He just shits

Re: Just drawing lines and plotting points?

2010-01-26 Thread Alf P. Steinbach
* rantingrick: On Jan 26, 9:38 pm, Terry Reedy wrote: On 1/26/2010 7:54 PM, Chris Rebert wrote: On Tue, Jan 26, 2010 at 4:36 PM, Someone Something wrote: Hello, I need a python library that makes drawing lines and plotting points (these two things are the only things I need to do) easy. Or,

Re: Just drawing lines and plotting points?

2010-01-27 Thread Alf P. Steinbach
* rantingrick: On Jan 26, 10:52 pm, "Alf P. Steinbach" wrote: * rantingrick: On Jan 26, 9:38 pm, Terry Reedy wrote: On 1/26/2010 7:54 PM, Chris Rebert wrote: On Tue, Jan 26, 2010 at 4:36 PM, Someone Something wrote: Hello, I need a python library that makes drawing

Re: python 3's adoption

2010-01-27 Thread Alf P. Steinbach
* Daniel Fetchinson: * Print is now a function. Great, much improvement. Actually not, IMHO. All it does is is to provide incompatibility. What incompatibility are you exactly talking about? Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57) [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2

Re: python 3's adoption

2010-01-27 Thread Alf P. Steinbach
* Daniel Fetchinson: * Print is now a function. Great, much improvement. Actually not, IMHO. All it does is is to provide incompatibility. What incompatibility are you exactly talking about? Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57) [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2

Re: python 3's adoption

2010-01-27 Thread Alf P. Steinbach
* Daniel Fetchinson: * Print is now a function. Great, much improvement. Actually not, IMHO. All it does is is to provide incompatibility. What incompatibility are you exactly talking about? Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57) [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2 T

Re: python 3's adoption

2010-01-27 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: [...] The main problem with the incompatibility is for porting code, not for writing code from scratch. It's also a problem wrt. learning the language. And I see no good reason for it: print can't really do more, or less, or more conveniently (r

Re: python 3's adoption

2010-01-27 Thread Alf P. Steinbach
* Adam Tauno Williams: On Wed, 2010-01-27 at 18:52 +0100, Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: [...] The main problem with the incompatibility is for porting code, not for writing code from scratch. It's also a problem wrt. learning the language. And I see no

Re: python 3's adoption

2010-01-28 Thread Alf P. Steinbach
* Steven D'Aprano: On Wed, 27 Jan 2010 18:29:25 +0100, Alf P. Steinbach wrote: The main problem with the incompatibility is for porting code, not for writing code from scratch. Correct. It's a trivial problem, but still a problem. It's also a problem wrt. learning the l

Re: interaction of mode 'r+', file.write(), and file.tell(): a bug or undefined behavior?

2010-01-28 Thread Alf P. Steinbach
* Anthony Tolle: On Jan 28, 7:12 am, Lie Ryan wrote: In the code: """ f = open('input.txt', 'r+') for line in f: s = line.replace('python', 'PYTHON') # f.tell() f.write(s) """ [snip] My guess is that there are a few possible problems: 1) In this case, writing to file opened with

Re: Need help with a program

2010-01-28 Thread Alf P. Steinbach
* evilweasel: Hi folks, I am a newbie to python, and I would be grateful if someone could point out the mistake in my program. Basically, I have a huge text file similar to the format below: AGACTCGAGTGCGCGGA 0 AGATAAGCTAATTAAGCTACTGG 0 AGATAAGCTAATTAAGCTACTGGGTT 1 A

Re: is there any alternative to savefig?

2010-01-28 Thread Alf P. Steinbach
* kiwanuka: On Jan 28, 12:29 pm, kiwanuka wrote: Hi all, I wonder if anyone knows any alternative function in pylab (or otherwise) that could be used to save an image. My problem is as follows: --- from pylab import * ... figure(1) fig1 = gca() figure(2) fig2 = gca() figure(3) fi

Re: python 3's adoption

2010-01-28 Thread Alf P. Steinbach
* Roy Smith: In article , Mitchell L Model wrote: I use the sep and end keywords all the time. What are 'sep' and 'end'? I'm looking in http://docs.python.org/3.1/genindex-all.html and don't see those mentioned at all. Am I just looking in the wrong place? >>> print( print.__doc__ )

Re: python 3's adoption

2010-01-28 Thread Alf P. Steinbach
* Lie Ryan: On 01/28/10 20:12, Alf P. Steinbach wrote: >>> import builtins >>> >>> org_print = print >>> builtins.print = 666 >>> >>> print( "trallala" ) Traceback (most recent call last): File "", line

Re: mix statically typed with dynamically typed

2010-01-28 Thread Alf P. Steinbach
* Yingjie Lan: [snip] def speed(float dist, float time): return dist/time then the compiler would generate code to first check parameter types (or even do some casts if appropriate, say cast an int into float) in the beginning of this function. and the rest of the function would then be com

Re: mix statically typed with dynamically typed

2010-01-28 Thread Alf P. Steinbach
* Duncan Booth: "Alf P. Steinbach" wrote: I'm not sure I like your idea of introducing static typing to increase speed, but it could be done without introducing new syntax simply by defining a special meaning to such annotation expressions that are 'type' invocations,

Re: python 3's adoption

2010-01-28 Thread Alf P. Steinbach
* Steve Holden: While I am fully aware that premature optimization, etc., but I cannot resist an appeal to efficiency if it finally kills off this idea that "they took 'cmp()' away" is a bad thing. Passing a cmp= argument to sort provides the interpreter with a function that will be called eac

Re: python 3's adoption

2010-01-29 Thread Alf P. Steinbach
* Steven D'Aprano: On Fri, 29 Jan 2010 07:10:01 +0100, Alf P. Steinbach wrote: >>> L = ["æ", "ø", "å"] # This is in SORTED ORDER in Norwegian L [...] >>> L.sort( key = locale.strxfrm ) >>> L ['å', 'æ

Re: Microsoft Office Word and Python (Win XP)

2010-01-30 Thread Alf P. Steinbach
* peskar.m...@hotmail.com: 21 days has passed and still noone is willing to help :-( Did you see the reply from Marco Nawin? If you don't see that reply, dated (a bit less than) 2 hours after your original posting on the 9th, I can repost it here. If you have any follow-up questions just po

Re: list.extend([]) Question

2010-01-30 Thread Alf P. Steinbach
* Dan Brown: Why does extending a list with the empty list result in None? It seems very counterintuitive to me, at least --- I expected ['a'].extend ([]) to result in ['a'], not None. It does. 'extend' is an operation that /modifies/ the array. It just returns None as its expression result,

Re: Slow down while creating a big list and iterating over it

2010-01-30 Thread Alf P. Steinbach
* marc magrans de abril: Dear colleagues, I was doing a small program to classify log files for a cluster of PCs, I just wanted to simplify a quite repetitive task in order to find errors and so. My first naive implementation was something like: patterns = [] while(logs): patter

Re: PEP 3147 - new .pyc format

2010-01-30 Thread Alf P. Steinbach
* John Bokma: MRAB writes: The PEP has a .pyr directory for each .py file: foo.py foo.pyr/ f2b30a0d.pyc # Python 2.5 f2d10a0d.pyc # Python 2.6 f2d10a0d.pyo # Python 2.6 -O f2d20a0d.pyc # Python 2.6 -U 0c4f0a0d.pyc # Python 3.1 wow: so much for

Re: Still too slow

2010-01-30 Thread Alf P. Steinbach
* elsa: Thanks for the tips r.e random.ranint(). This improved matters somewhat, however my program is still too slow. If anyone has any further tips on how to speed it up, they would be much appreciated! So, I'm calling evolve(L,limit) from the interactive prompt. L is initally [[100],['NA']].

Re: Still too slow

2010-01-30 Thread Alf P. Steinbach
* Alf P. Steinbach: * elsa: Thanks for the tips r.e random.ranint(). This improved matters somewhat, however my program is still too slow. If anyone has any further tips on how to speed it up, they would be much appreciated! So, I'm calling evolve(L,limit) from the interactive prompt.

Re: PEP 3147 - new .pyc format

2010-01-30 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 30 Jan 2010 18:40:42 -0800, Paul Rubin wrote: Ben Finney writes: 0c4f0a0d.pyc # Python 3.1 Mapping magic numbers to versions is infeasible and will be incomplete: Any mapping that exists in (say) Python 3.1 can't know in advance what the magic number will be fo

Re: Business issues regarding adapting Python

2009-09-27 Thread Martin P. Hellwig
Nash wrote: If I rephrase the question: In an absense of steady Python Developers; can there be a viable strategy involving training? Or will it be much safer going with an already common developer pool. Please note that my goal is not to promote python but to make a sound business decision. Us

Re: user authorization (with one time login) in a Python desktop application ?

2009-09-27 Thread Martin P. Hellwig
Stef Mientki wrote: What you want is pretty hard as long as the data source is not centrally protected with a password. That is you have a database on a server you only access, there is a central db but access to it is restricted to the admin, everybody else has a unique login name and a 'per

Re: Business issues regarding adapting Python

2009-09-28 Thread Martin P. Hellwig
Nash wrote: I think normal market rules will apply to Pakistan too, if your desired trade has not the quantity you wish, the price per item should get higher. Net result should be that more quantity will be available due to increased interest. -- MPH http://blog.dcuktec.com 'If consumed, bes

Re: Business issues regarding adapting Python

2009-09-28 Thread Martin P. Hellwig
Vladimir Ignatov wrote: Ha-ha-ha (sorry, can't resist). Here is at Moscow/Russia I have had a tought time finding a Python-related programming job. Positions both very rare (comparing with Java/C++ - maybe 1/100) and not pays well. And about 99% of them are web+Django. To who/what are you reply

Why does passing tuple as arg WITHOUT scattering work?

2009-10-20 Thread Alf P. Steinbach
Hi all. I'm just learning Python from scratch, on my own. Apologies if this question is too newbie... Or perhaps answered in some FAQ (where?). Here's my original code for simple starter program, using the ActivePython implementation in Windows XP Prof, Python version is 2.6: import Tkint

Re: Why does passing tuple as arg WITHOUT scattering work?

2009-10-20 Thread Alf P. Steinbach
* Rhodri James: On Tue, 20 Oct 2009 22:42:07 +0100, Alf P. Steinbach wrote: [snip] canvas.create_oval( bbox, fill = "PeachPuff" ) [snip] It worked nicely, and I thought this code was fairly perfect until I started studying the language reference. It seems that formally co

Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
[Cross-posted comp.programming and comp.lang.python] Hi. I may finally have found the perfect language for a practically oriented introductory book on programming, namely Python. C++ was way too complex for the novice, JScript and C# suffered from too fast-changing specifications and runtime

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
* Chris Rebert: On Tue, Oct 27, 2009 at 11:52 PM, Alf P. Steinbach wrote: [Cross-posted comp.programming and comp.lang.python] Hi. I may finally have found the perfect language for a practically oriented introductory book on programming, namely Python. C++ was way too complex for the novice

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
* tm: On 28 Okt., 07:52, "Alf P. Steinbach" wrote: [Cross-posted comp.programming and comp.lang.python] Looking at your topic '(Python in Windows)', without taking a glimpse at your actual introduction, I have the following to say: I think it is not a good idea to teac

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Martin P. Hellwig
Alf P. Steinbach wrote: * tm: On 28 Okt., 07:52, "Alf P. Steinbach" wrote: [Cross-posted comp.programming and comp.lang.python] Looking at your topic '(Python in Windows)', without taking a glimpse at your actual introduction, I have the following to say: I think it i

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
* eb303: On Oct 28, 7:52 am, "Alf P. Steinbach" wrote: [snip] But since I don't know much Python -- I'm *learning* Python as I write -- I know that there's a significant chance of communicating misconceptions, non-idiomatic ways to do things, bad conventions, etc.,

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
* eb303: On Oct 28, 10:48 am, "Alf P. Steinbach" wrote: * eb303: On Oct 28, 7:52 am, "Alf P. Steinbach" wrote: [snip] But since I don't know much Python -- I'm *learning* Python as I write -- I know that there's a significant chance of communicating misco

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
* Jon Clements: On 28 Oct, 08:58, "Alf P. Steinbach" wrote: [snip] Without reference to an OS you can't address any of the issues that a beginner has to grapple with, including most importantly tool usage, without which it's not even possible to get started, but also, very

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
* Jon Clements: Inline reply: On 28 Oct, 11:49, "Alf P. Steinbach" wrote: * Jon Clements: On 28 Oct, 08:58, "Alf P. Steinbach" wrote: [snip] Without reference to an OS you can't address any of the issues that a beginner has to grapple with, including most import

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Alf P. Steinbach
* Dann Corbit: In article , al...@start.no Unfortunately Google docs doesn't display the nice table of contents in each document, but here's the public view of ch 1 (complete) and ch 2 (about one third completed, I've not yet settled on a title so it's just chapter "asd"): http://previ

Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
Hi. Or, to whomever this concerns... ;-) I thought it would be prudent to install 3.1.1 for Windows from scratch, so I uninstalled everything (CPython, ActivePython), and then installed Python 3.1.1. In the "Advanced" option I told the installer to compile packages. The compiler then found

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
* Alf P. Steinbach: Hi. Or, to whomever this concerns... ;-) I thought it would be prudent to install 3.1.1 for Windows from scratch, so I uninstalled everything (CPython, ActivePython), and then installed Python 3.1.1. In the "Advanced" option I told the installer to compil

Re: Bug(s) in Python 3.1.1 Windows installation

2009-10-28 Thread Alf P. Steinbach
* Alf P. Steinbach: * Alf P. Steinbach: Hi. Or, to whomever this concerns... ;-) I thought it would be prudent to install 3.1.1 for Windows from scratch, so I uninstalled everything (CPython, ActivePython), and then installed Python 3.1.1. In the "Advanced" option I told the in

<    6   7   8   9   10   11   12   13   14   15   >