Re: insert unique data in a list

2009-12-13 Thread Alf P. Steinbach
} >>> a {1, 2, 3} >>> a |= {4} >>> a {1, 2, 3, 4} >>> a |= {4} >>> a {1, 2, 3, 4} >>> _ Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: More stuff added to ch 2 of my programming intro

2009-12-13 Thread Alf P. Steinbach
* Alf P. Steinbach: Format: PDF http://preview.tinyurl.com/ProgrammingBookP3> The new stuff, section 2.7, is about programs as simulations and handling data, focusing on modeling things. It includes some Python GUI programming. The plan is to discuss containers like lists

Re: More stuff added to ch 2 of my programming intro

2009-12-16 Thread Alf P. Steinbach
* Alf P. Steinbach: * Alf P. Steinbach: Format: PDF http://preview.tinyurl.com/ProgrammingBookP3> The new stuff, section 2.7, is about programs as simulations and handling data, focusing on modeling things. It includes some Python GUI programming. The plan is to discuss containers l

Re: More stuff added to ch 2 of my programming intro

2009-12-16 Thread Alf P. Steinbach
* Mensanator: On Dec 16, 4:41 pm, Mensanator wrote: On Dec 14, 1:23 am, "Alf P. Steinbach" wrote: * Alf P. Steinbach: Format: PDF http://preview.tinyurl.com/ProgrammingBookP3> The new stuff, section 2.7, is about programs as simulations and handling data, focusin

Re: More stuff added to ch 2 of my programming intro

2009-12-16 Thread Alf P. Steinbach
* Mensanator: On Dec 16, 5:45 pm, "Alf P. Steinbach" wrote: * Mensanator: On Dec 16, 4:41 pm, Mensanator wrote: On Dec 14, 1:23 am, "Alf P. Steinbach" wrote: * Alf P. Steinbach: Format: PDF http://preview.tinyurl.com/ProgrammingBookP3> The new stuff

Re: Either IDLE Can't Start a subprocess or a firewall software firewall is blocking the connection (Win)--Battlin McAfee

2009-12-16 Thread Alf P. Steinbach
#x27; very over-zealous "security" measures). Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: shouldn't list comprehension be faster than for loops?

2009-12-17 Thread Alf P. Steinbach
you're constructing n tuples that you're not constructing in the loop. Have you tried this with dip1 = [dp - 0.01 if dp == 90 else dp for dp in dipList] ? Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
o UC... So both these two deviations from Python practice are /intentional/, since this is a book about programming, not about Python the language & how to conform to idiosyncratic language-specific conventions. But, if there are other deviations from Python practice I'd be very glad

Re: iterators and views of lists

2009-12-18 Thread Alf P. Steinbach
uctures, that this flaw gives C++ iterators the power of "goto" but also with all the negative baggage... I'm too lazy to Google, but you might search for Alexandrescu and "ranges", and possibly throw in "iterators" among the search terms. Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: iterators and views of lists

2009-12-18 Thread Alf P. Steinbach
* Carl Banks: On Dec 18, 11:08 am, "Alf P. Steinbach" wrote: * Carl Banks: On Dec 17, 10:00 pm, Brendan Miller wrote: On Thu, Dec 17, 2009 at 6:44 PM, Steven D'Aprano wrote: On Thu, 17 Dec 2009 12:07:59 -0800, Brendan Miller wrote: I was thinking it would be cool to m

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
east provide uppercase names so as conform to very firmly established convention. There might even be tools that rely on that convention. But for application code the uppercase names are just distracting, and they don't help you... Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Steven D'Aprano: On Fri, 18 Dec 2009 19:00:48 +0100, Alf P. Steinbach wrote: In fact almost no Python code does, but then it seems that people are not aware of how many of their names are constants and think that they're uppercasing constants when in fact they're not. E.g. ro

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 19 Dec 2009 01:25:48 +0100, Alf P. Steinbach wrote: That said, and a bit off-tangent to your comment's main thrust, the time spent on coding that repeated-division-by-2 optimization would, I think, be better spent googling "Collatz Conjecture"

Re: Creating Classes

2009-12-18 Thread Alf P. Steinbach
class Seq( object ): E.g., >>> class A: pass ... >>> A.__bases__ (,) >>> >>> class B( object ): pass ... >>> B.__bases__ (,) >>> _ Curiously I can't find anything about 'object' in the language spec, but

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
an you can ever find by Googling! And how did I achieve that? By writing such code. Be a good boy and maybe I'll show you how to do Ulam's Spiral with Turtle Graphics. It's probably good for you that you know so much about Collatz. I fail to see the relevance to anything.

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 19 Dec 2009 04:04:51 +0100, Alf P. Steinbach wrote: * Steven D'Aprano: On Fri, 18 Dec 2009 19:00:48 +0100, Alf P. Steinbach wrote: In fact almost no Python code does, but then it seems that people are not aware of how many of their names are constants

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 19 Dec 2009 04:29:22 +0100, Alf P. Steinbach wrote: * Steven D'Aprano: On Sat, 19 Dec 2009 01:25:48 +0100, Alf P. Steinbach wrote: That said, and a bit off-tangent to your comment's main thrust, the time spent on coding that repeated-division-by

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-19 Thread Alf P. Steinbach
* John Posner: On Fri, 18 Dec 2009 13:00:48 -0500, Alf P. Steinbach wrote: Chapter 2 is about Basic Concepts (of programming). It's the usual: variables, ... 1. Overall suggestion You have a tendency to include non-pertinent asides [1]. But then, rambling a bit endows a manuscript

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-20 Thread Alf P. Steinbach
as illegal and manually typed in by some kid. He he, they do a great service for us who don't have ready continuous access to a university library! Cheers, - Alf PS: Argh! Someone did it -- serious programming intro based on Python -- already! However, there's a difference betwee

Re: Windows, IDLE, __doc_, other

2009-12-20 Thread Alf P. Steinbach
dit facility? I suggest you download a programmers' editor (like Notepad++ or PsPad) for programming work and use the basic Python interpreter for interactive work. The basic interpreter lives in a standard Window console window where you can use up and down arrow keys, F8 completion, F7 for list of earlier commands, etc (as documented by the doskey command in the Windows command interpreter). Just forget IDLE in windows: while Windows console windows are something from the middle ages, IDLE seems to stem from a period before that! Cheers & hth., - Alf PS: Shameless plug: take a look at http://tinyurl.com/programmingbookP3>, it's for Windows. -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows, IDLE, __doc_, other

2009-12-21 Thread Alf P. Steinbach
* Alf P. Steinbach: * W. eWatson: When I use numpy.__doc__ in IDLE under Win XP, I get a heap of words without reasonable line breaks. "\nNumPy\n=\n\nProvides\n 1. An array object of arbitrary homogeneous items\n 2. Fast mathematical operations over arrays\n 3. Linear Al

Ch 3 of my writings, first few sections posted

2009-12-21 Thread Alf P. Steinbach
n & terminology. 2 3.1.1 The vocabulary and notation of basic arithmetic, including Σ and Π. 2 3.1.2 Quadratic and exponential time & memory (also introducing timeit). 5 -EOT_ 9 Cheers, - Alf PS: Hm, Open Office's PDF generation does funny things with Greek sigmas inside formula

Re: How to validate the __init__ parameters

2009-12-21 Thread Alf P. Steinbach
self.items = seq class A: # Your example def __init__( self, foo = None, Bar = None ): self._foo = _Foo( foo ) self._bar = bar def set_foo( self, foo ): self._foo = _Foo( foo ) foo = property( setter = set_foo ) Cheers & hth., - Alf -- http://mai

Re: Ch 3 of my writings, first few sections posted

2009-12-21 Thread Alf P. Steinbach
doubt that there are many errors etc., all mine!). * Alf P. Steinbach, in [comp.lang.python]: Tentatively titled "Foundations". Also, these first 2/3 sections may be moved to some later point, i.e. even the structure is tentative, but I'd value comments! http://tinyurl.c

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Alf P. Steinbach
ring to an earlier posting by Alex Martelli, was broken. I believe it was the posting available here: http://www.opensubscriber.com/message/python-list@python.org/2659890.html>. Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you configure IDLE on a Mac, seeing as there's no Configure Option...

2010-01-04 Thread Alf P. Steinbach
onfig, but I think this is default) is invisible when you're looking at the debugger window for single stepping. You can see it by switching back to the source code window but that's annoying, not very practical. Invisible highlighting of the current line, he he... Cheers &a

Re: PIL how to display multiple images side by side

2010-01-09 Thread Alf P. Steinbach
Maybe I've misunderstood something (in that case glad to learn!), but I believe PhotoImage is not a widget, and that a PhotoImage has to be presented in e.g. a Label widget or some other widget that's able to display images. Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: how to duplicate array entries

2010-01-11 Thread Alf P. Steinbach
d' and then write list( repeat_items_in( [1, 2, 3], 3 ) ) Re the thing I don't understand: it's the same in C++, people using hours on figuring out how to do something very simple in an ungrokkable indirect and "compiled" way using template metaprogramming stuff, when they could just write a simple 'for' loop and be done with in, say, 3 seconds, and much clearer too! Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: how to duplicate array entries

2010-01-11 Thread Alf P. Steinbach
* Steven D'Aprano: On Mon, 11 Jan 2010 08:56:36 +0100, Alf P. Steinbach wrote: * Paul Rudin: Sebastian writes: I have an array x=[1,2,3] In python such an object is called a "list". (In cpython it's implemented as an automatically resizable array.) I don't t

Re: how to duplicate array entries

2010-01-11 Thread Alf P. Steinbach
* Chris Rebert: On Mon, Jan 11, 2010 at 1:03 AM, Alf P. Steinbach wrote: * Steven D'Aprano: On Mon, 11 Jan 2010 08:56:36 +0100, Alf P. Steinbach wrote: * Paul Rudin: Sebastian writes: I have an array x=[1,2,3] In python such an object is called a "list". (In cpython i

Re: how to duplicate array entries

2010-01-11 Thread Alf P. Steinbach
* Chris Rebert: On Mon, Jan 11, 2010 at 2:20 AM, Alf P. Steinbach wrote: * Chris Rebert: On Mon, Jan 11, 2010 at 1:03 AM, Alf P. Steinbach wrote: * Steven D'Aprano: On Mon, 11 Jan 2010 08:56:36 +0100, Alf P. Steinbach wrote: * Paul Rudin: Sebastian writes: Using the term &

Re: PIL how to display multiple images side by side

2010-01-11 Thread Alf P. Steinbach
* suresh.amritapuri: On Jan 9, 9:51 pm, "Alf P. Steinbach" wrote: * Lie Ryan: On 1/9/2010 8:43 AM, suresh.amritapuri wrote: Hi, In PIL, how to display multiple images in say m rows and n colums when I have m*n images. suresh Tkinter has PhotoImage widget and PIL has support for t

Re: Fractional Hours from datetime?

2010-01-11 Thread Alf P. Steinbach
ogy (it gets more unreliable year by year). It's easier to place the comment here: There seems to be some controversy about this and other matters of datetime. <http://blog.twinapex.fi/2008/06/30/relativity-of-time-shortcomings-in-python-datetime-and-workaround/> No, not at all. :-) Instead, just ignore silly requests for message id's. Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Fractional Hours from datetime?

2010-01-11 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * W. eWatson: Ben Finney wrote: "W. eWatson" writes: See my post about the datetime controversy about 3-4 posts up from yours. This forum is distributed, and there's no “up” or “3-4 messages” that is common for all readers. Cou

Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
er Account somewhere. But hopefully it doesn't? Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: [...] PS: It would be nice if someone(TM) could describe here in detail how to properly report errors like this. Of course I'm not going to do it if it involves establishing Yet Another Account somewhere. But hopefully it doesn't? That's

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Alf P. Steinbach: * Steve Holden: Alf P. Steinbach wrote: [...] PS: It would be nice if someone(TM) could describe here in detail how to properly report errors like this. Of course I'm not going to do it if it involves establishing Yet Another Account somewhere. But hopefully it do

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Stefan Behnel: Alf P. Steinbach, 12.01.2010 12:51: Well how f*g darn patient do they expect me to be? I've decided: I'm not. Oh sh**, just as I typed the period above the mail finally arrived. It's been, let's see, about 20+ minutes! And still some miles to go.

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Stefan Behnel: Alf P. Steinbach, 12.01.2010 13:10: * Stefan Behnel: Maybe you should just stop using the module. Writing the code yourself is certainly going to be faster than reporting that bug, don't you think? It's part of the standard Python distribution. Don't you th

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* André: On Jan 12, 9:33 am, "Alf P. Steinbach" wrote: Well, this is for my Python (actually, beginning programmer) writings, at http://tinyurl.com/programmingbookP3 Thanks for writing this book. I just had a quick look at the beginning of it where you write: === As of th

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Stefan Behnel: Alf P. Steinbach, 12.01.2010 12:51: Well how f*g darn patient do they expect me to be? I've decided: I'm not. Oh sh**, just as I typed the period above the mail finally arrived. It's been, let's see, about 20+

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: If you have any suggestions for improving things (and the same goes for any other readers) I will be happy to listen to them. I do agree that the bug tracker is a rather high hurdle for people to have to jump over just to offer feedback on software faults

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: [...] FYI there is already some feedback in the tracker. Yeah, someone who had the bright idea that maybe there isn't a bug, thinking instead that maybe a "wrong" name in *a comment* might be the culprit -- of all

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Steven D'Aprano: On Tue, 12 Jan 2010 23:42:28 +0100, Alf P. Steinbach wrote: * André: On Jan 12, 9:33 am, "Alf P. Steinbach" wrote: Well, this is for my Python (actually, beginning programmer) writings, at http://tinyurl.com/programmingbookP3 Thanks for writing thi

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Steven D'Aprano: On Tue, 12 Jan 2010 23:47:31 +0100, Alf P. Steinbach wrote: PS: Next time it would have helped to include a URL to the issue. http://bugs.python.org/issue7681 FYI there is already some feedback in the tracker. Yeah, someone who had the bright idea that maybe

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Terry Reedy: On 1/12/2010 6:31 PM, Alf P. Steinbach wrote: Perhaps change to CAPTCHA instead of mail confirmation. I disagree. The point of mail confirmation is not just to assure that a human is registering, but that we have a valid email for responses to be sent to. Many issues are

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread Alf P. Steinbach
* Stefan Behnel: Alf P. Steinbach, 13.01.2010 06:39: * Steven D'Aprano: On Tue, 12 Jan 2010 23:42:28 +0100, Alf P. Steinbach wrote: It is hopeless, especially for a newbie, to create correct Python 2.x+3.x compatible code, except totally trivial stuff of course. So you allege, but

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Alf P. Steinbach
* Stefan Behnel: Alf P. Steinbach, 13.01.2010 06:55: * Steven D'Aprano: I think you need to chill out and stop treating a simple bug report as a personal slight on you. I'm sorry but you're again trying to make people believe something that you know is false, which is common

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Alf P. Steinbach
gs to anyone (or nearly), I'd like the text on that page to still fit on one page. :-) Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Alf P. Steinbach
* Steven D'Aprano: On Wed, 13 Jan 2010 06:55:27 +0100, Alf P. Steinbach wrote: * Steven D'Aprano: On Tue, 12 Jan 2010 23:47:31 +0100, Alf P. Steinbach wrote: PS: Next time it would have helped to include a URL to the issue. http://bugs.python.org/issue7681 FYI there

Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Alf P. Steinbach
ies), rattling along the housetops, and fiercely agitating the scanty flame of the lamps that struggled against the darkness" -- but in my case, not 1st sentence but the 2nd and 3rd paragraphs! Comments welcome. Cheers, - Alf PS: Now more stuff added to ch 3 but I've not updated

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steven D'Aprano: Nobody is trying to understate the complexity of writing a large application that supports both 2.6 and 3.x, or of taking an existing library written for 2.5 and upgrading it to support 3.1. But the magnitude of these tasks

Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-13 Thread Alf P. Steinbach
* Alf P. Steinbach: * Steve Holden: Alf P. Steinbach wrote: * Steven D'Aprano: Nobody is trying to understate the complexity of writing a large application that supports both 2.6 and 3.x, or of taking an existing library written for 2.5 and upgrading it to support 3.1. But the magnitu

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread Alf P. Steinbach
python 3 and the first one with python 2. Statement (2) is about porting, statement (1) is about something else. Having said all that I actually seriously doubt (probably in agreement with you) that Alf is able to write good and helpful material on the relationship between python 2 and 3, porting

A simple-to-use sound file writer

2010-01-13 Thread Alf P. Steinbach
bytes ) ) self._bytes[s] = bytes self._pos = s.stop else: self._bytes.extend( bytes ) self._pos = len( self._bytes ) def flush( self ): pass def close( self ): pass Cheers & enjoy, - Alf PS: Comments welcome, except the BytesCollector which I just hacked together to test something, it may contain eroRs but worked for my purpose. -- http://mail.python.org/mailman/listinfo/python-list

Re: maintain 2 versions of python on my computer

2010-01-14 Thread Alf P. Steinbach
* version information in some kind of 'database', which might be a separate file or simply hardcoded in your dummy startup program. But I think personally I'd go for filename extensions and using 'assoc' and 'ftype', because while ugly it's simplest,

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at http://tinyurl.com/programmingbookP3>, but sans sine wave generation since I hav

Re: a problem with writing a generator

2010-01-14 Thread Alf P. Steinbach
aven't used *nix, if that's your environment, since mid 1990's... Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at http://tinyurl.com/programmingbookP3&

Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-14 Thread Alf P. Steinbach
* Lie Ryan -> Alf P. Steinbach: why do you think it is "impossible" to write a complex and portable python script? I don't. You're not quoting me. Though keeping everything in one code base may often be difficult and only of little practical benefit, it is not imp

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Mel: Alf P. Steinbach wrote: * Steve Holden: It's not clear to me that you can approximate any waveform with a suitable combination of square waves, Oh. It's simple to prove. At least conceptually! :-) Consider first that you need an infinite number of sine waves to create

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: [...] With the goal of just a rough approximation you can go about it like this: 1. Divide a full cycle of the sine wave into n intervals. With sine wave frequency f this corresponds to n*f sample rate for digital

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Peter Otten: Alf P. Steinbach wrote: Just as a contribution, since someone hinted that I haven't really contributed much to the Python community. The [simple_sound] code will probably go into my ch 3 at http://tinyurl.com/programmingbookP3>, but sans sine wave generation since I hav

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Grant Edwards: On 2010-01-14, Alf P. Steinbach wrote: It's not clear to me that you can approximate any waveform with a suitable combination of square waves, Oh. It's simple to prove. At least conceptually! :-) [...] With the goal of just a rough approximation you can go abo

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Grant Edwards wrote: On 2010-01-14, Alf P. Steinbach wrote: [bogus hand-waving] After all, it's the basis of digital representation of sound! Huh? I've only studied basic DSP, but I've never heard/seen that as the basis of digital represention of sound.

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: Grant Edwards wrote: On 2010-01-14, Alf P. Steinbach wrote: [bogus hand-waving] After all, it's the basis of digital representation of sound! Huh? I've only studied basic DSP, but I've never heard/seen that as the b

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Lie Ryan: On 01/15/10 05:42, Alf P. Steinbach wrote: I'm beginning to believe that you maybe didn't grok that simple procedure. It's very very very trivial, so maybe you were looking for something more intricate -- they used to say, in the old days, "hold on, this proof

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Lie Ryan: On 01/15/10 05:42, Alf P. Steinbach wrote: I'm beginning to believe that you maybe didn't grok that simple procedure. It's very very very trivial, so maybe you were looking for something more intricate -- they used to say, in the old days, "hold on, this proof

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Lie Ryan: On 01/15/10 05:42, Alf P. Steinbach wrote: I'm beginning to believe that you maybe didn't grok that simple procedure. It's very very very trivial, so maybe you were looking for something more intricate -- they used to say,

Re: A simple-to-use sound file writer

2010-01-14 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: [...] Perhaps you'd also admit to being wrong, and retract your innuoendo etc.? Disregarding any matters of right or wrong (for this post, at least), I herebe retract anything I have said about you that you consider innuendo. OK. Feel fr

Re: A simple-to-use sound file writer

2010-01-15 Thread Alf P. Steinbach
* Steven D'Aprano: On Fri, 15 Jan 2010 05:23:48 +0100, Alf P. Steinbach wrote: You're again into innuendo, misleading statements and so forth. [...] [Steve Holden] prefers to spout innuendu, personal attacks and misleading statements. Your constant and repeated accusation

Re: A simple-to-use sound file writer

2010-01-15 Thread Alf P. Steinbach
* Ben Finney: "Alf P. Steinbach" writes: You did lie, that's established. In addition as I recall in the same post you went on about my motivations for doing the Terrible Deed that you invented. None of that matches my (largely disinterested) observations. This is pure fan

Re: A simple-to-use sound file writer

2010-01-15 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Ben Finney: "Alf P. Steinbach" writes: You did lie, that's established. In addition as I recall in the same post you went on about my motivations for doing the Terrible Deed that you invented. None of that matches my (largel

Re: A simple-to-use sound file writer

2010-01-15 Thread Alf P. Steinbach
ed direct way, just dividing the current product by the number removed from the collection, is then invalid. And some people might take that limited applicability of the direct simple way as evidence that it's impossible to remove numbers, failing to see any of the trivial practical soluti

Re: A simple-to-use sound file writer

2010-01-15 Thread Alf P. Steinbach
ed to this thread, and that it works, and that besides the algorithm is trivial so that "claim" is a rather meaningless word here), read the article that you then responded to. Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Using invalid.com email addresses

2010-01-15 Thread Alf P. Steinbach
one who thought that /including/ the word "invalid" was the way to do it. Cheers, just my 3 øre, - Alf PS: in the same way, not including "OT" in the subject line here might be considered rude. But then, if I were to add it, some newsreader might split the thread. So it

Re: maintain 2 versions of python on my computer

2010-01-16 Thread Alf P. Steinbach
be quoted. // Note: in order to handle Unicode paths needs to use Windows API command line. // // If this code works then it was written (but not tested) by Alf P. Steinbach. // Otherwise it's someone impersonating me. #include// std::wstring #include// std::vector

Re: A simple-to-use sound file writer

2010-01-16 Thread Alf P. Steinbach
* 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 a "pulse train"), as I envisa

Re: A simple-to-use sound file writer

2010-01-16 Thread Alf P. Steinbach
* Alf P. Steinbach: * Steve Holden: Though for what it's worth I wasn't impressed by the results of running the posted program, since it yielded an AIFF file of mostly zeroes that produced no audible sound. $ od -bc sinewave.aiff 000 106 117 122 115 000 002 261 076 101 111 1

Re: maintain 2 versions of python on my computer

2010-01-16 Thread Alf P. Steinbach
* Gertjan Klein: Alf P. Steinbach wrote: * Gertjan Klein: What I've been thinking about is to write a single [Windows] executable that gets associated with .py and .pyw (instead of python.exe itself). Well, you need two: one for console subsystem, and one for GUI subsystem. Why? I&#

Re: maintain 2 versions of python on my computer

2010-01-16 Thread Alf P. Steinbach
* Gertjan Klein: Alf P. Steinbach wrote: * Gertjan Klein: Alf P. Steinbach wrote: Thinking about it some more, perhaps that way I can't get at return codes a python script might provide. I haven't used those, but they may be useful at some point. Return codes work OK no matter wha

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
followed right after some discussion we had. Thus my impression of you or or responses in this group was colored by a false interpretation. But, checking, which is often a good idea!, and *which I should have done then*, as far as I can see the term was first used in this group in April 2001, http://groups.google.com/group/comp.lang.python/browse_thread/thread/12a125ceddd401e2/c021547a1dc14a41>. It's still a mystery to me what it refers to, though... :-) Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: The answer

2010-01-17 Thread Alf P. Steinbach
  Save as current ... b) If there's already a PYTHONPATH, Edit it, adding a semi-colon and the full path of folder Module to the end. 5) Put your module folders into the folder Module. 6) (Here's a r

Re: thread return code

2010-01-19 Thread Alf P. Steinbach
me that code? join() always returns None. But you can store the code in the thread object, and then access it after the join(). Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

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

2010-01-19 Thread Alf P. Steinbach
'o' then you can write 'o["menu"]' or 'o.cget( "menu" )' to get at that logical attribute. And tkinter Menu has various methods that you can use to inspect or update the menu; see http://effbot.org/tkinterbook/menu.htm>. Disclaimer: I have

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Alf P. Steinbach
t by transforming it to equivalent code and putting the target expressions innermost there. And so the main factor causing a slowdown for a list comprehension would, I think, be paging and such if the list it produced was Really Huge, while for the generator there's no memory issue but rather much calling & context shifting. Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterate over group names in a regex match?

2010-01-19 Thread Alf P. Steinbach
ps() ('1', '2', '3') >>> type( m.groups() ) >>> dir( m ) ['__copy__', '__deepcopy__', 'end', 'expand', 'group', 'groupdict', 'groups', 'span', 'start'] >>> m.groupdict >>> m.groupdict() {'one': '1', 'three': '3', 'two': '2'} >>> print( tuple( m.groupdict().keys() ) ) ('one', 'three', 'two') >>> _ Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Alf P. Steinbach
then it can do that (since I've implemented that). But I don't know for a fact that it's practical to do so in Python. In order to use the space the implementation must know that there's only one reference to the string. And I don't know whether that information is readily available in a CPython implementation (say), although I suspect that it is. Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

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
whatever the background of the newbie, do introduce turtle graphics right away. The ch 2 of the above reference contains some t.g. examples that you might use (initial silly figures, graphs of functions, recursive figures). It doesn't go into the turtle module objects. But if objects are what you want to show right away, then I think the turtle module is great also for that, because those objects are simple and can be easily explored. Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

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
hat Steven wants to apply bitlevel and/or arithmetic operations for e.g. some custom cryptographic thing. The string that he uses as example is not completely unlike a message digest. Another possibility is custom serialization/deserialization. But it would be nice to know what it's actually abou

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
all last): File "", line 1, in NameError: name 'up' is not defined >>> _ Of course it's an abuse of the language. :-) So I wouldn't recommend it, but it's perhaps worth having seen it. Cheers & hth., - Alf PS: I hope this was not a homework question. -- http://mail.python.org/mailman/listinfo/python-list

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
Huh? I guess you meant to reply to the OP, not me. Cheers, - Alf * Javier Collado: Hello, I'd say that isn't totally incorrect to use strings instead of symbols. Please note that in other programming languages symbols, atoms and the like are in fact immutable strings, which is w

Re: Symbols as parameters?

2010-01-21 Thread Alf P. Steinbach
not difficult to do. I provided an example in my answer to the OP (first reply in the thread). However, it's IMHO an abuse of the language, not something that one should do. Cheers & hth., - Alf -- http://mail.python.org/mailman/listinfo/python-list

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,

<    1   2   3   4   5   6   7   >