Re: Easy way to play single musical notes in Python

2009-11-14 Thread James Harris
On 15 Nov, 00:12, James Harris wrote: > Is there a simple way to play musical notes in Python? Something like > >   voice.play("c4") > > to play C in octave 4 would be ideal. I included a voice parameter as > I'd like to play proper notes, not just beeps. This is for recognition > of pitch. For e

Re: Simple object reference

2009-11-14 Thread Ben Finney
Chris Rebert writes: > On Sat, Nov 14, 2009 at 3:25 PM, AON LAZIO wrote: > > Hi, I have some problem with object reference > > Say I have this code > > > > a = b = c = None > > slist = [a,b,c] > > Values are stored in the list, not references to names. Modifying the > list does not change what v

A different take on finding primes

2009-11-14 Thread Vincent Davis
Out of pure curiosity I would like to compare the efficiency of different methods of finding primes (need not be consecutive). Let me be clear, given 2min, how many primes can you find, they need not be in order or consecutive. I have not seen any examples of this. I am assume the solution is diffe

Re: Run a external program.

2009-11-14 Thread Terry Reedy
Top-posting makes things more confusing. You cannot pass a Python file object to an external process. Pass the name instead. Yasser Almeida Hernández wrote: So, how can i pass an argument as a variable in this context...? Quoting MRAB : Yasser Almeida Hernández wrote: Hi all!! I'm writin

Re: Python & Go

2009-11-14 Thread Terry Reedy
Yoav Goldberg wrote: On Sun, Nov 15, 2009 at 12:10 AM, Terry Reedy > wrote: Paul Rubin wrote: Mark Chu-Carroll has a new post about Go: http://scienceblogs.com/goodmath/2009/11/the_go_i_forgot_concurrency_an.php In a couple of minutes, I w

Re: Documentation bugs in 3.1 - C-API - TypeObjects

2009-11-14 Thread Martin v. Löwis
> This cannot work, because Foo_Type is no PyObject but a PyVarObject > (independent > of the use of PyVarObject_HEAD_INIT or PyObject_HEAD_INIT). The code > line would > work so: > > ((PyObject *)&Foo_Type)->ob_type = &PyType_Type However, this is not what you should use. Instead, use Py_Type(&

Re: A "terminators' club" for clp

2009-11-14 Thread Terry Reedy
Paul Rubin wrote: Terry Reedy writes: To post from g.c.p.g, one must use a real email address and respond once to an email sent to that address. So, the only reason to use c.l.p is if one wants to post anonymously, like the spammers do ;-). No I don't think so. "Unwilling to disclose email

Re: A "terminators' club" for clp

2009-11-14 Thread Terry Reedy
r wrote: On Nov 14, 4:52 pm, Terry Reedy wrote: So, the only reason to use c.l.p is if one wants to post anonymously, like the spammers do ;-). I don't think that completely correct. Lots of people find GG's to be more suited to their news reading pleasures, I was referring to c.l.p on a nn

Re: A "terminators' club" for clp

2009-11-14 Thread Terry Reedy
Ben Finney wrote: Terry Reedy writes: So, the only reason to use c.l.p is if one wants to post anonymously, like the spammers do ;-). Or if one has an ISP who provides a Usenet feed, like mine does. Gmane is a nntp news feed, just not a usenet feed. If you can read usenet, you can read gm

Re: python simply not scaleable enough for google?

2009-11-14 Thread Vincent Manis
This whole thread has now proceeded to bore me senseless. I'm going to respond once with a restatement of what I originally said. Then I'm going to drop it, and never respond to the thread again. Much of what's below has been said by others as well; I'm taking no credit for it, just trying to pu

Re: Simple object reference

2009-11-14 Thread Terry Reedy
Chris Rebert wrote: On Sat, Nov 14, 2009 at 3:25 PM, AON LAZIO wrote: Hi, I have some problem with object reference Say I have this code a = b = c = None slist = [a,b,c] Values are stored in the list, not references to names. That is not right either, or else newbies would not be surprised

Re: Simple object reference

2009-11-14 Thread Chris Rebert
On Sat, Nov 14, 2009 at 6:53 PM, Terry Reedy wrote: > Chris Rebert wrote: >> On Sat, Nov 14, 2009 at 3:25 PM, AON LAZIO wrote: >>> Hi, I have some problem with object reference >>> Say I have this code >>> >>> a = b = c = None >>> slist = [a,b,c] >> >> Values are stored in the list, not reference

Re: python simply not scaleable enough for google?

2009-11-14 Thread Steven D'Aprano
On Fri, 13 Nov 2009 18:25:59 -0800, Vincent Manis wrote: > On 2009-11-13, at 15:32, Paul Rubin wrote: >> This is Usenet so >> please stick with Usenet practices. > Er, this is NOT Usenet. Actually it is. I'm posting to comp.lang.python. > 1. I haven't, to the best of my recollection, made a U

Re: Vote on PyPI comments

2009-11-14 Thread Steven D'Aprano
On Fri, 13 Nov 2009 07:53:05 -0800, Michele Simionato wrote: > I am skeptical about the utility of both rating and comments. If > somebody wants to know > if a package is good, she should ask here. Because unlike people writing comments, people here are never incompetent, misinformed, dishonest,

Re: The ol' [[]] * 500 bug...

2009-11-14 Thread Steven D'Aprano
On Fri, 13 Nov 2009 21:26:01 +, kj wrote: > ...just bit me in the "fuzzy posterior". It's not a bug. Just because it doesn't behave as you would like it to behave doesn't mean it isn't behaving as designed. > The best I can come up with is the hideous > > lol = [[] for _ in xrange(500)

Re: Python & Go

2009-11-14 Thread Steven D'Aprano
On Sat, 14 Nov 2009 11:14:04 +, kj wrote: > In <7xpr7lixnn@ruckus.brouhaha.com> Paul Rubin > writes: > >>It seems a little weird to me that they (Google) are concerned with the >>speed of the compiler, indicating that they plan to write enormous >>programs i

Re: Anything better than shutil?

2009-11-14 Thread Steven D'Aprano
On Sat, 14 Nov 2009 07:48:39 -0800, Roy Smith wrote: > I'm converting some old bash scripts to python. There's lots of places > where I'm doing things like "rm $source_dir/*.conf". The best way I can > see to convert this into python is: > > configs = glob.glob(os.path.join(source_dir, '*.c

Re: python simply not scaleable enough for google?

2009-11-14 Thread John Nagle
Steven D'Aprano wrote: On Wed, 11 Nov 2009 16:38:50 -0800, Vincent Manis wrote: I'm having some trouble understanding this thread. My comments aren't directed at Terry's or Alain's comments, but at the thread overall. 1. The statement `Python is slow' doesn't make any sense to me. Python is a

Re: QuerySets in Dictionaries

2009-11-14 Thread Steven D'Aprano
On Fri, 13 Nov 2009 14:10:10 -0800, scoopseven wrote: > I actually had a queryset that was dynamically generated, so I ended up > having to use the eval function, like this... > > d = {} > for thing in things: > query_name = 'thing_' + str(thing.id) > query_string = 'Thing.object

Re: Python & Go

2009-11-14 Thread Michele Simionato
On Nov 14, 7:18 pm, John Nagle wrote: >      Leaving out exceptions was a mistake.  Exceptions are well understood > now, > and they're far better than the usual "ignore errors" approach one sees in > lamer > C programs. I am also surprised about the lack of exceptions. I could infer that Rob P

Re: Python & Go

2009-11-14 Thread Michele Simionato
On Nov 15, 3:00 am, Terry Reedy wrote: > It seems to me that generators are already 'channels' that connect the > calling code to the __next__ method, a semi-coroutine based on the body > of the generator function. At present, the next method waits until an > object is requested. Then it goes into

Re: Req. comments on "first version" ch 2 progr. intro (using Python 3.x in Windows)

2009-11-14 Thread Aahz
In article , sstein...@gmail.com wrote: >On Nov 9, 2009, at 11:54 AM, Jon Clements wrote: >> On Nov 9, 4:10 pm, "Alf P. Steinbach" wrote: >>> First, because as opposed to ch 1 there is quite a bit of code >>> here, and since I'm a >>> Python newbie I may be using non-idiomatic constructs, > >We

Re: Easy way to play single musical notes in Python

2009-11-14 Thread r
On Nov 14, 6:21 pm, James Harris wrote: > Is there a simple way to play musical notes in Python? Something like >   voice.play("c4") Uhh, tksnack is pretty easy to use IMO, see this link... http://www.daniweb.com/code/snippet216655.html No python does not have access to cross platform soundcard

Re: A different take on finding primes

2009-11-14 Thread Dave Angel
Vincent Davis wrote: Out of pure curiosity I would like to compare the efficiency of different methods of finding primes (need not be consecutive). Let me be clear, given 2min, how many primes can you find, they need not be in order or consecutive. I have not seen any examples of this. I am assum

Re: Python as network protocol

2009-11-14 Thread Aahz
In article , Cooch wrote: > >I want to implement such specific feature: >I have a server written in Python. I have a client written in C++. I >want to use Python as network protocol between them. I mean: client >send to server such string: "a = MyObject()", so object of this type >will appear in

Re: Python & Go

2009-11-14 Thread Michele Simionato
Let me add a quote from the FAQ: """ Why does Go not have exceptions? Exceptions are a similar story. A number of designs for exceptions have been proposed but each adds significant complexity to the language and run-time. By their very nature, exceptions span functions and perhaps even goroutine

Re: A "terminators' club" for clp

2009-11-14 Thread Aahz
In article <877htsskox@benfinney.id.au>, Ben Finney wrote: >Terry Reedy writes: >> >> So, the only reason to use c.l.p is if one wants to post anonymously, >> like the spammers do ;-). > >Or if one has an ISP who provides a Usenet feed, like mine does. Mine does, too. >A pox upon Andrew Cu

Re: Documentation bugs in 3.1 - C-API - TypeObjects

2009-11-14 Thread DreiJane
Thanks ! Okay, i've already used the call of tp_free as the last statement in tp_dealloc and do understand now, that a call of tp_dealloc should be the last statement in the code for tp_free in specific cases. And yes, "Py_Type(&Foo_Type) = &PyType_Type" will be more stable against changes of the

Re: A "terminators' club" for clp

2009-11-14 Thread Aahz
In article <7xiqddt1fd@ruckus.brouhaha.com>, Paul Rubin wrote: > >There is automatic moderation software that auto-approves any post >from an address that has had one or two posts manually approved. >While that's susceptible to address forgery, the typical spamme

Re: python simply not scaleable enough for google?

2009-11-14 Thread Rami Chowdhury
On Saturday 14 November 2009 18:42:07 Vincent Manis wrote: > > 3. Very clearly CPython can be improved. I don't take most benchmarks > very seriously, but we know that CPython interprets bytecode, and > thus suffers relative to systems that compile into native code, and > likely to some other i

Re: python simply not scaleable enough for google?

2009-11-14 Thread Terry Reedy
John Nagle wrote: Steven D'Aprano wrote: Take a good look at Shed Skin. One guy has been able to build a system that compiles Python to C++, without requiring the user to add "annotations" about types. In *only* compiles a subset of Python, as does Cython. Both cannot (currently) do gene

Calling Python functions from Excel

2009-11-14 Thread Cannonbiker
Hi, unfortunately is my question about server COM (win32com) http://groups.google.com/group/comp.lang.python/browse_thread/thread/ee804cec7f58c6a7# without answer. Please I need Calling Python functions from Excel and receive result back in Excel. Can me somebody advise simplest solution please? I

Re: python simply not scaleable enough for google?

2009-11-14 Thread greg
John Nagle wrote: Take a good look at Shed Skin. ... You give up some flexibility; a variable can have only one primitive type in its life, or it can be a class object. That's enough to simplify the type analysis to the point that most types can be nailed down before the program is run. Th

Re: Calling Python functions from Excel

2009-11-14 Thread Carsten Haese
Cannonbiker wrote: > Please I need Calling Python functions from Excel and receive result > back in Excel. Can me somebody advise simplest solution please? I am > more VBA programmer than Python. Maybe this will help: http://oreilly.com/catalog/pythonwin32/chapter/ch12.html (Scroll down to "Implem

<    1   2