Re: Python's Reference And Internal Model Of Computing Languages

2010-02-05 Thread David Thole
I read thisand am a tiny bit confused about the actual problem.

It's not exactly complex to realize that something like:
a = b = array
that a and b both point to the array.

Logically speaking, I'm not sure how one could assume that the same
assignment would yield a and b point to the same duplicate array.  If
that was the case, why not do:
a = array..
b = array..

I know with what you were complaining about a few days ago, .clear makes
perfect sense.  If a and b point to the same array, clear should clear
both arrays.  Again, if you didn't want that to happen, create a
duplicate array.

Personally I feel that this complexity doesn't hamper programming
process, and yes while its good for efficiency it also just makes sense.

Also, I wouldn't look at PHP on the right way to do something
programming wise.  I have ~5 years experience in this language, and I
dislike it a whole lot.  There's a lot of things it should do right that
it doesn't out of convenience.

-David
www.thedarktrumpet.com

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PHP's str_replace ?

2008-09-10 Thread David Thole
On Sep 10, 12:20 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Anjanesh Lekshminarayanan wrote:
> >> import re
> >> new_str = re.sub('[aeiou]', '-', str)
> > Wow - this is neat. Thanks
>
> But probably slower and definitely harder to understand. For simple
> problems the str methods are usually faster than a regular expression.
>
> Christian

It's true that regular expressions are generally slower, but I
disagree that it's hard to understand.  When dealing with text, I
think it's an absolute must that programmers know about regular
expressions.  I think this here is an example where even str_replace
in Python wouldn't have worked well.

-David
http://www.thedarktrumpet.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to record audio from Python on Mac?

2008-09-09 Thread David Thole
On Sep 9, 1:11 pm, Kevin Walzer <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > (I asked this on pythonmac-sig a couple days ago but got no response, so I'm
> > casting a broader net.)
>
> > Can I easily control audio record/playback from Python on my Mac?  I know
> > zip about audio recording or about Apple APIs via Python.  Pointers to
> > simple examples would be much appreciated.
>
> > Thanks,
>
> > Skip
>
> You can probably access this functionality via PyObjC--it provides
> access to the Cocoa frameworks.
>
> --
> Kevin Walzer
> Code by Kevinhttp://www.codebykevin.com

Another option you could use is calling Applescript from the command
line, to open, execute, and handle audio.

An easy example of this is with iTunes actually.  Once you get iTunes
down, doing this for other apps should be easy (if they have
applescript bindings):
http://www.macosxhints.com/article.php?story=20011108211802830

You could probably also do what Kevin recommends, but depending on
your needs, this may be a whole lot more simple.

-David Thole
http://www.thedarktrumpet.com
--
http://mail.python.org/mailman/listinfo/python-list