PyQt 4.0beta1 Released

2006-04-29 Thread Phil Thompson
Riverbank Computing is pleased to announce the release of PyQt v4.0beta1 available from http://www.riverbankcomputing.co.uk/pyqt/. PyQt is a comprehensive set of Qt bindings for the Python programming language and supports the same platforms as Qt (Windows, Linux and MacOS/X). Like Qt, PyQt is

Summer of Code mailing list

2006-04-29 Thread Neal Norwitz
There's a new SoC mailing list. [EMAIL PROTECTED] You can sign up here: http://mail.python.org/mailman/listinfo/soc2006 This list is for any SoC discussion: mentors, students, idea, etc. Student can submit applications starting May 1, so now is the time to get students interested in your

python-dev Summary for 2006-01-16 through 2006-01-31

2006-04-29 Thread Steven Bethard
Sorry the summaries are so late. We were late already, and it's taken me a bit of time to get set up with the new python.org site. But I should be all good now, and hopefully we'll get caught up with all the summaries by the end of May. Hope you all weren't too depressed without your bi-weekly

python-dev Summary for 2006-03-01 through 2006-03-15

2006-04-29 Thread Steven Bethard
python-dev Summary for 2006-03-01 through 2006-03-15 .. contents:: [The HTML version of this Summary is available at http://www.python.org/dev/summary/2006-03-01_2006-03-15] = Announcements = ---

python-dev Summary for 2006-02-01 through 2006-02-15

2006-04-29 Thread Steven Bethard
python-dev Summary for 2006-02-01 through 2006-02-15 .. contents:: [The HTML version of this Summary is available at http://www.python.org/dev/summary/2006-02-01_2006-02-15] = Announcements =

python-dev Summary for 2006-02-16 through 2006-02-28

2006-04-29 Thread Steven Bethard
python-dev Summary for 2006-02-16 through 2006-02-28 .. contents:: [The HTML version of this Summary is available at http://www.python.org/dev/summary/2006-02-16_2006-02-28] = Announcements = ---

Re: Non-web-based templating system

2006-04-29 Thread qscomputing
Actually, that looks even better that EmPy for what I need. I will try out these suggestions and then see what seems best. Thanks very much. -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-web-based templating system

2006-04-29 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: Actually, that looks even better that EmPy for what I need. :-( -- Erik Max Francis [EMAIL PROTECTED] http://www.alcyone.com/max/ San Jose, CA, USA 37 20 N 121 53 W AIM erikmaxfrancis All bad poetry springs from genuine feeling. -- Oscar Wilde --

Re: Using a browser as a GUI: which Python package

2006-04-29 Thread André
Problem solved using CherryPy. See http://aroberge.blogspot.com/2006/04/cherrypy-is-great.html for the details. -- http://mail.python.org/mailman/listinfo/python-list

Re: (was Re: Xah's Edu Corner: Criticism vs Constructive Criticism)

2006-04-29 Thread Tagore Smith
John Bokma wrote: Tagore Smith [EMAIL PROTECTED] wrote: Try sending mail to abuse at (any of my) desmesne(s). You won't get a response- in fact, no-one will read your mail. Then you come close to being RFC ignorant IMO. Couldn't be bothered to check it out. I don't care much about the

Re: (was Re: Xah's Edu Corner: Criticism vs Constructive Criticism)

2006-04-29 Thread John Bokma
Tagore Smith [EMAIL PROTECTED] wrote: John Bokma wrote: [ .. ] An excessive crosspost is hardly ever on topic. Now you are just being dishonest. In what way? No- if it were you would no longer have internet access. Try me. -- John MexIT:

Re: MinGW and Python

2006-04-29 Thread Ross Ridge
Martin v. Löwis wrote: How would you build for MSVCRT.DLL using MSVC 7 or 8? You don't have the header files for that library... You should be able to use the header files that come with these compilers. Things like sizes, field offsets, or member function names don't change between versions

Re:

2006-04-29 Thread Dr.Ruud
Tagore Smith schreef: [addressing John Bokma] your objection seems to be less about the crossposting, and more about the content. Why do you think that? -- Affijn, Ruud Gewoon is een tijger. -- http://mail.python.org/mailman/listinfo/python-list

Re: python-dev Summary for 2006-02-16 through 2006-02-28

2006-04-29 Thread Manlio Perillo
Steven Bethard ha scritto: python-dev Summary for 2006-02-16 through 2006-02-28 .. contents:: [...] Translating the Python documentation Facundo Batista had

Re: not quite 1252

2006-04-29 Thread Anton Vredegoor
Martin v. Löwis wrote: Well, if the document is UTF-8, you should decode it as UTF-8, of course. Thanks. This and: http://en.wikipedia.org/wiki/UTF-8 solved my problem with understanding the encoding. Anton proof that I understand it now (please anyone, prove me wrong if you can): from

PyQt 4.0beta1 Released

2006-04-29 Thread Phil Thompson
Riverbank Computing is pleased to announce the release of PyQt v4.0beta1 available from http://www.riverbankcomputing.co.uk/pyqt/. PyQt is a comprehensive set of Qt bindings for the Python programming language and supports the same platforms as Qt (Windows, Linux and MacOS/X). Like Qt, PyQt is

Re: ANN: Leo 4.4 rc1 released

2006-04-29 Thread Fulvio
Alle 22:58, venerdì 28 aprile 2006, Edward K. Ream ha scritto: Many new commands, including Small question. Has it way of using macro or programmable input? I mean this because for linux there arent many text editors with macro (recording/playing back) nor any with script commands. Thank

Python member of function

2006-04-29 Thread brianlum
Hi, I was wondering if anyone knew of a built in Python function that will check if an item is a member of a list, i.e., if item i is a member of list l. I read of a function in but I can't seem to get that to work and finding pages for python in does not reveal very many relevant sources.

Re: Python member of function

2006-04-29 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: I was wondering if anyone knew of a built in Python function that will check if an item is a member of a list, i.e., if item i is a member of list l. I read of a function in but I can't seem to get that to work and finding pages for python in does not reveal very

Re: Python member of function

2006-04-29 Thread Rene Pijlman
[EMAIL PROTECTED]: I was wondering if anyone knew of a built in Python function that will check if an item is a member of a list, i.e., if item i is a member of list l. 1 in [1,3,4] True 2 in [1,3,4] False -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Python member of function

2006-04-29 Thread brianlum
Thanks, I was using in incorrectly. Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

midi input

2006-04-29 Thread Will Hurt
hiya, can you tell me of a python module available for linux which allows me to access midi i/o data. ie i want to get hold of raw midi input coming in from an external controller. ive managed to get the controller configured under alsa-midi. if possible could you also give me some example code

Re: ANN: Leo 4.4 rc1 released

2006-04-29 Thread Fredrik Lundh
Fulvio wrote: I mean this because for linux there arent many text editors with macro (recording/playing back) nor any with script commands. umm. what about the big ones: emacs vim ? they both have extensive support for macros and scripting, and can both be scripted in Python. and if you're

Re: PyQt 4.0beta1 Released

2006-04-29 Thread Skink
Phil Thompson wrote: Riverbank Computing is pleased to announce the release of PyQt v4.0beta1 available from http://www.riverbankcomputing.co.uk/pyqt/. PyQt is a comprehensive set of Qt bindings for the Python programming language and supports the same platforms as Qt (Windows, Linux and

[ANN] ConfigObj 4.3.1 validate 0.2.2

2006-04-29 Thread Fuzzyman
`ConfigObj 4.3.1 http://www.voidspace.org.uk/python/configobj.html`_ and `validate 0.2.2 http://www.voidspace.org.uk/python/validate.html`_ are now available. These are both minor bugfix/feature enhancement releases. What is New in ConfigObj ? Changes since **ConfigObj** 4.3.0 : * Added

Re: PyQt 4.0beta1 Released

2006-04-29 Thread Phil Thompson
On Saturday 29 April 2006 1:27 pm, Skink wrote: Phil Thompson wrote: Riverbank Computing is pleased to announce the release of PyQt v4.0beta1 available from http://www.riverbankcomputing.co.uk/pyqt/. PyQt is a comprehensive set of Qt bindings for the Python programming language and

Re: Recommendations for a PostgreSQL db adapter, please?

2006-04-29 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Keen Anthony wrote: Hello, I am currently using psycopg 2 as my db adapter for a mod_python PostgreSQL web app. It's works fine, and I haven't any complaints. I would appreciate some input on what other pythonistas like in an adapter. There

Re: Re:

2006-04-29 Thread Matt Garrish
Bill Atkins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] John Bokma [EMAIL PROTECTED] writes: Isn't it crazy that one person is allowed to create such a huge mess everytime he posts? Isn't it crazy that one person willfully creates such a mess every time Xah posts? Shush!

Re: best way to determine sequence ordering?

2006-04-29 Thread nikie
Steven Bethard wrote: nikie wrote: Steven Bethard wrote: John Salerno wrote: If I want to make a list of four items, e.g. L = ['C', 'A', 'D', 'B'], and then figure out if a certain element precedes another element, what would be the best way to do that? Looking at the built-in

Need help removing list elements.

2006-04-29 Thread nuffnough
This is python 2.4.3 on WinXP under PythonWin. I have a config file with many blank lines and many other lines that I don't need. read the file in, splitlines to make a list, then run a loop that looks like this: config_file = open(lines.txt, rb) returned_lines =

Re: Recommendations for a PostgreSQL db adapter, please?

2006-04-29 Thread Tim Churches
Gerhard Häring wrote: Keen Anthony wrote: Hello, I am currently using psycopg 2 as my db adapter for a mod_python PostgreSQL web app. It's works fine, and I haven't any complaints. I would appreciate some input on what other pythonistas like in an adapter. There were several different

Re: Need help removing list elements.

2006-04-29 Thread jwelby
This looks like a job for list comprehensions: returned_lines= ['Name: John, Value: 12','We don't want this one.','Name: Eric, Value: 24'] [x for x in returned_lines if ('Name' in x and 'Value' in x)] ['Name: John, Value: 12', 'Name: Eric, Value: 24'] List comprehensions are great. If you

Re: Need help removing list elements.

2006-04-29 Thread jwelby
Ooops! Looking at your example a bit closer, change the 'and' in the list comprehension I posted to 'or', and it should do what you want. -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help removing list elements.

2006-04-29 Thread Max Erickson
[EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: But this gives me IndexError: list out of range You are making the list shorter as you are iterating. By the time your index is at the end of the original list, it isn't that long any more. Creating a new list and appending the elements you

Re: Recommendations for a PostgreSQL db adapter, please?

2006-04-29 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tim Churches wrote: Gerhard Häring wrote: [...] Considering pyPgSQL, psycopg1, PyGreSQL and psycopg2 - psycopg2 is a good choice. Hmmm, Gerhard, you are listed as one of two developers for pyPgSQL on SourceForge (

Re: can i set up a mysql db connection as a class ?

2006-04-29 Thread Ed Leafe
On Apr 27, 2006, at 8:15 PM, [EMAIL PROTECTED] wrote: my question is, is there a way i can set up a global connection so that when the program loads, it connects once, then stays connected ? maybe i could assign instances of the cursor ? We do something like this in Dabo. We define

Re: wxPython, wxcombobox opening

2006-04-29 Thread Philippe Martin
Hi, I do not have the answer but am very interested in the issue. I tried this: l_ev = wx.MouseEvent(wx.wxEVT_LEFT_DOWN) l_ev.SetEventObject(self.GetCombo()) self.GetEventHandler().ProcessEvent(l_ev) Which did send the event to the combo (which is in a pannel in my case) .. but that is

RE: (was Re: Xah's Edu Corner: Criticism vs Constructive Criticism)

2006-04-29 Thread bruce
but you know... one could simply hit the delete/skip button when you see a msg you don't like!!! or email/spam filters... or you can spend more time complaining.. in life, you gotta' learn to pick your battles... peace.. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

Re: Using Databases in Python

2006-04-29 Thread Steve Holden
Dennis Lee Bieber wrote: On Fri, 28 Apr 2006 21:29:32 +0100, Steve Holden [EMAIL PROTECTED] declaimed the following in comp.lang.python: Dennis Lee Bieber wrote: Given that his web-site implies that he does these for a living, it may not be a publicly available item. Nah, he's a

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-29 Thread Steve Holden
Lawrence D'Oliveiro wrote: In article [EMAIL PROTECTED], bruno at modulix [EMAIL PROTECTED] wrote: Lawrence D'Oliveiro wrote: In article [EMAIL PROTECTED], bruno at modulix [EMAIL PROTECTED] wrote: Lawrence D'Oliveiro wrote: (snip) I think you're taking Python's OO-ness too

http://blog.wokkow.com/user1/xinyegong/index.shtml

2006-04-29 Thread penshe
http://blog.wokkow.com/user1/xinyegong/index.shtml -- http://mail.python.org/mailman/listinfo/python-list

http://blog.wokkow.com/user1/xinyegong/index.shtml

2006-04-29 Thread penshe
http://blog.wokkow.com/user1/xinyegong/index.shtml -- http://mail.python.org/mailman/listinfo/python-list

http://blog.wokkow.com/user1/xinyegong/index.shtml

2006-04-29 Thread penshe
http://blog.wokkow.com/user1/xinyegong/index.shtml -- http://mail.python.org/mailman/listinfo/python-list

How to get computer name

2006-04-29 Thread pitarda
How do I get the computer name in python? I've been looking over the internet, and couldn't find anything. Thanks! Bud -- http://mail.python.org/mailman/listinfo/python-list

self modifying code

2006-04-29 Thread Robin Becker
When young I was warned repeatedly by more knowledgeable folk that self modifying code was dangerous. Is the following idiom dangerous or unpythonic? def func(a): global func, data data = somethingcomplexandcostly() def func(a): return simple(data,a) return func(a)

Re: How to get computer name

2006-04-29 Thread Tim Heaney
pitarda [EMAIL PROTECTED] writes: How do I get the computer name in python? You can use the os module to get it from your environment. import os os.getenv('HOSTNAME') 'calvin.watterson' Depending on your operating system, the environment variable you need might have a different name.

Re: How to get computer name

2006-04-29 Thread pitarda
Thanks! :) Though,... I think once I saw something like: getComputerByName but can't find it anymore,... :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Re:

2006-04-29 Thread John Bokma
Matt Garrish [EMAIL PROTECTED] wrote: Don't waste your time with the Bokma. He wants everyone to follow the posting rules that annoy Bokma the least, but he never follows them himself. Wow Matt, did it hurt that bad boy? Grow up, you're smart enough to see what Xah is doing. If not, ask

Re: Hooking things up in GUI application

2006-04-29 Thread Florian Diesch
Ryan Ginstrom [EMAIL PROTECTED] wrote: Behalf Of sturlamolden If you use PyGTK (it also runs on Windows), you can design the GUI with GLADE and then use libglade to import the gui as an xml-resource. Yes, I've tried something similar with wxGlade. Nice, but it doesn't seem to remove the

Re: self modifying code

2006-04-29 Thread nikie
Robin Becker schrieb: When young I was warned repeatedly by more knowledgeable folk that self modifying code was dangerous. Is the following idiom dangerous or unpythonic? def func(a): global func, data data = somethingcomplexandcostly() def func(a): return

Re: self modifying code

2006-04-29 Thread Peter Otten
Robin Becker wrote: When young I was warned repeatedly by more knowledgeable folk that self modifying code was dangerous. Is the following idiom dangerous or unpythonic? def func(a): global func, data data = somethingcomplexandcostly() def func(a): return

Re: Re:

2006-04-29 Thread John Bokma
John Bokma [EMAIL PROTECTED] wrote: Matt Garrish [EMAIL PROTECTED] wrote: Don't waste your time with the Bokma. He wants everyone to follow the posting rules that annoy Bokma the least, but he never follows them himself. Wow Matt, did it hurt that bad boy? Grow up, you're smart

Re: How to get computer name

2006-04-29 Thread Richard Townsend
On 29 Apr 2006 10:04:39 -0700, pitarda wrote: Thanks! :) Though,... I think once I saw something like: getComputerByName but can't find it anymore,... :) import socket print socket.gethostname() blade print socket.gethostbyname('blade') # will print IP address -- Richard --

Re: self modifying code

2006-04-29 Thread Robin Becker
Peter Otten wrote: def func(a): global func, data data = somethingcomplexandcostly() def func(a): return simple(data,a) return func(a) at the cost of just one object identity test whereas your func() implementation will do the heavy-lifting

opposite function to split?

2006-04-29 Thread randomtalk
hello everyone! I can't seem to find a function that combines a list of items into a string with a seperator between the individual elements.. Is there such a method that does the opposite of sting.split? thanks alot! -- http://mail.python.org/mailman/listinfo/python-list

Re: opposite function to split?

2006-04-29 Thread Robin Becker
[EMAIL PROTECTED] wrote: hello everyone! I can't seem to find a function that combines a list of items into a string with a seperator between the individual elements.. Is there such a method that does the opposite of sting.split? thanks alot! join is your answer ','.join(['a','b','c']) ==

Re: self modifying code

2006-04-29 Thread John J. Lee
Robin Becker [EMAIL PROTECTED] writes: When young I was warned repeatedly by more knowledgeable folk that self modifying code was dangerous. Is the following idiom dangerous or unpythonic? def func(a): global func, data data = somethingcomplexandcostly() def func(a):

Re: Using a browser as a GUI: which Python package

2006-04-29 Thread John J. Lee
André [EMAIL PROTECTED] writes: [...] I would like to use a browser (e.g. Firefox) as a simple GUI framework. Note that this is to be done on a single user machine, so the question of sandboxing is not really relevant here. [...] My ultimate goal would be to port the main features of two

Re: Urllib2 / add_password method

2006-04-29 Thread John J. Lee
mrstephengross [EMAIL PROTECTED] writes: I'm working on learning how to use urllib2 to use a proxy server. I've looked through the postings on this group, and it's been helpful. I have not, however, found complete documentation on the add_password() functions. Here's what I've got so far:

Re: self modifying code

2006-04-29 Thread Robin Becker
John J. Lee wrote: 1. I don't think most people would call that self-modifying code. I won't try defining that term precisely because I know you'll just pick holes in my definition ;-) Don't really disagree about the rewriting code, but the function does re-define itself. 2. The

Re: A QFB agent: how to catch C-level crashes and last Python stack ?

2006-04-29 Thread robert
Thomas Heller wrote: robert wrote: When employing complex UI libs (wx, win32ui, ..) and other extension libs, nice only Python stack traces remain a myth. Currently I'm hunting again a rare C-level crash bug of a Python based Windows app with rare user reports - and still in the dark (I

Re: [wwwsearch-general] Re: Urllib2 / add_password method

2006-04-29 Thread John J Lee
On Sat, 29 Apr 2006, John J. Lee wrote: mrstephengross [EMAIL PROTECTED] writes: I'm working on learning how to use urllib2 to use a proxy server. I've looked through the postings on this group, and it's been helpful. I have not, however, found complete documentation on the add_password()

Re: Simple DAV server?

2006-04-29 Thread robert
Ivan Voras wrote: Kyler Laird wrote: Ivan's been working on a problem I've been experiencing with Windows XP (failure to launch). He sent a new version my way today. I'm going to test it tomorrow when I've got some XP users available. If it works I'm going to work on putting my changes

Re: urllib.urlopen() with pages that requires cookies.

2006-04-29 Thread John J. Lee
mwt [EMAIL PROTECTED] writes: Fredrik Lundh wrote: [...] use urllib2 and cookielib. here's an outline: import urllib2, cookielib # set things up jar = cookielib.CookieJar() handler = urllib2.HTTPCookieProcessor(jar) opener = urllib2.build_opener(handler)

Re: (was Re: Xah's Edu Corner: Criticism vs Constructive Criticism)

2006-04-29 Thread Terry Reedy
Tagore Smith [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The only thing really wrong with Xah's post is that it was crossposted to several groups. I think the content of repeatedly slandering people as criminals, because of technical disagreements, is even more abusive. tjr

Can we create an_object = object() and add attribute like for a class?

2006-04-29 Thread Pierre Rouleau
Hi all, Is there any reason that under Python you cannot instantiate the object class and create any attributes like you would be able for a normal class? Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more

Re: (was Re: Xah's Edu Corner: Criticism vs Constructive Criticism)

2006-04-29 Thread James Stroud
bruce wrote: but you know... one could simply hit the delete/skip button when you see a msg you don't like!!! or email/spam filters... or you can spend more time complaining.. in life, you gotta' learn to pick your battles... peace.. Bruce: You may want to check your mail reader to

Re: Xah's Edu Corner: What Languages to Hate

2006-04-29 Thread Timo Stamm
John Bokma schrieb: quote I have warned this user that excessive offtopic cross-posting is not allowed,[...] /quote I just wrote to the abuse department at dreamhost, telling them that your accusations are highly exaggerated. Timo -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: What Languages to Hate

2006-04-29 Thread John Bokma
Timo Stamm [EMAIL PROTECTED] wrote: I just wrote to the abuse department at dreamhost, telling them that your accusations are highly exaggerated. I included Xah's post, on which they based their reply. Maybe use your weekend to do some research? -- John

Re: Using Databases in Python

2006-04-29 Thread Petr Jakes
Thank you very much, Steve. Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: Criticism vs Constructive Criticism

2006-04-29 Thread Chris Rathman
Good thing there's absolutely nothing happening in the world of functional programming... -- http://mail.python.org/mailman/listinfo/python-list

Why does bufsize=1 not work in subprocess.Popen ?

2006-04-29 Thread I. Myself
I read in the docs that bufsize=1 causes line buffering. (for subprocess.Popen) The following tiny program launches an executable file and then receives its output. That works, but I want to receive each line as it is ouput, not all of the lines at termination, which is what is happening.

Re: Need help removing list elements.

2006-04-29 Thread John Machin
On 30/04/2006 12:22 AM, Max Erickson wrote: [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: But this gives me IndexError: list out of range You are making the list shorter as you are iterating. By the time your index is at the end of the original list, it isn't that long any more.

Re: Using Databases in Python

2006-04-29 Thread Steve Holden
Petr Jakes wrote: Thank you very much, Steve. Happy to oblige. You did me a favor, as I had promised the students I would put the notes up on the net. Must remember to include them in the permanent site build process now :-) regards Steve -- Steve Holden +44 150 684 7255 +1 800 494

Re: Why does bufsize=1 not work in subprocess.Popen ?

2006-04-29 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], I. Myself wrote: I read in the docs that bufsize=1 causes line buffering. (for subprocess.Popen) The following tiny program launches an executable file and then receives its output. That works, but I want to receive each line as it is ouput, not all of the lines

Re: Can we create an_object = object() and add attribute like for a class?

2006-04-29 Thread Alex Martelli
Pierre Rouleau [EMAIL PROTECTED] wrote: Hi all, Is there any reason that under Python you cannot instantiate the object class and create any attributes like you would be able for a normal class? Yep: instances of type object do not have a __dict__ and therefore there is no place to put any

Re: self modifying code

2006-04-29 Thread Ben C
On 2006-04-29, Robin Becker [EMAIL PROTECTED] wrote: When young I was warned repeatedly by more knowledgeable folk that self modifying code was dangerous. Is the following idiom dangerous or unpythonic? def func(a): global func, data data = somethingcomplexandcostly() def

Re: best way to determine sequence ordering?

2006-04-29 Thread Steven Bethard
nikie wrote: Steven Bethard wrote: nikie wrote: Steven Bethard wrote: John Salerno wrote: If I want to make a list of four items, e.g. L = ['C', 'A', 'D', 'B'], and then figure out if a certain element precedes another element, what would be the best way to do that? Looking at the

Re: Why does bufsize=1 not work in subprocess.Popen ?

2006-04-29 Thread I. Myself
Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], I. Myself wrote: I read in the docs that bufsize=1 causes line buffering. (for subprocess.Popen) The following tiny program launches an executable file and then receives its output. That works, but I want to receive each line as

resume picking items from a previous list

2006-04-29 Thread kpp9c
I have a several list of songs that i pick from, lets, say that there are 10 songs in each list and there are 2 lists. For a time i pick from my songs, but i only play a few of the songs in that list... now my wife, Jessica Alba, comes home, and i start playing from Jessica's list of songs. After

Re: self modifying code

2006-04-29 Thread Steven Bethard
John J. Lee wrote: Robin Becker [EMAIL PROTECTED] writes: When young I was warned repeatedly by more knowledgeable folk that self modifying code was dangerous. Is the following idiom dangerous or unpythonic? def func(a): global func, data data = somethingcomplexandcostly()

Re: Can we create an_object = object() and add attribute like for a class?

2006-04-29 Thread Pierre Rouleau
Alex Martelli wrote: Pierre Rouleau [EMAIL PROTECTED] wrote: Hi all, Is there any reason that under Python you cannot instantiate the object class and create any attributes like you would be able for a normal class? Yep: instances of type object do not have a __dict__ and therefore

Re: time conversions [hh:mm:ss.ms - sec(.ms)

2006-04-29 Thread kpp9c
timedelta looks to be just the ticket! bravo, thank you... i guess this must be pretty new to Python. Nice... more batteries included stuff... cheers, -kevin-- -- http://mail.python.org/mailman/listinfo/python-list

Re: Can we create an_object = object() and add attribute like for a class?

2006-04-29 Thread Alex Martelli
Pierre Rouleau [EMAIL PROTECTED] wrote: ... I can understand the design decision not to give object a __dict__, but I wonder if i'd be a good idea to have a class that derives from object and has a __dict__ to be in the standard library. I posted the original question because I run into

Re: Generate a sequence of random numbers that sum up to 1?

2006-04-29 Thread Paul Rubin
Anthony Liu [EMAIL PROTECTED] writes: OK, I actually just want to manually create Hidden Markov Models by randomly generating the initial state probabilities PI, OK, this sounds like you actually want to divide the unit interval up into pieces of varying sizes. Example (untested): n = 10

Re: midi input

2006-04-29 Thread kpp9c
http://www.mxm.dk/products/public/pythonmidi mxm rocks! i used to use it this to create midi files so i know it works... but now it has grown to big for my small brain, have no clue how to actually use it... i keep hoping for a small tutorial and some more docs, this partially due to the

Re: String Exceptions (PEP 352)

2006-04-29 Thread Paul Rubin
bruno at modulix [EMAIL PROTECTED] writes: What's wrong with: assert foo and bar and i 10, \ if foo and bar i must not be greater than 10 It doesn't necessarily do anything. With optimization enable, assert is a no-op. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can we create an_object = object() and add attribute like fora class?

2006-04-29 Thread Fredrik Lundh
Pierre Rouleau wrote: I can understand the design decision not to give object a __dict__, but I wonder if i'd be a good idea to have a class that derives from object and has a __dict__ to be in the standard library. so you can replace one line of code in some of your programs with an import

Re: best way to determine sequence ordering?

2006-04-29 Thread Justin Azoff
John Salerno wrote: If I want to make a list of four items, e.g. L = ['C', 'A', 'D', 'B'], and then figure out if a certain element precedes another element, what would be the best way to do that? Looking at the built-in list functions, I thought I could do something like: if L.index('A')

Re: best way to determine sequence ordering?

2006-04-29 Thread nikie
Steven Bethard wrote: nikie wrote: Steven Bethard wrote: nikie wrote: Steven Bethard wrote: John Salerno wrote: If I want to make a list of four items, e.g. L = ['C', 'A', 'D', 'B'], and then figure out if a certain element precedes another element, what would be the best way

Re: best way to determine sequence ordering?

2006-04-29 Thread Steven Bethard
nikie wrote: That's what this thread was all about. Now, I don't really see what you are trying to say: Are you still trying to convince the OP that he should write a Python function like one of those you suggested, for performance reasons? Sure, if it really matters. Code it in C, and you

Re: best way to determine sequence ordering?

2006-04-29 Thread Steven Bethard
Steven Bethard wrote: John Salerno wrote: If I want to make a list of four items, e.g. L = ['C', 'A', 'D', 'B'], and then figure out if a certain element precedes another element, what would be the best way to do that? Looking at the built-in list functions, I thought I could do something

Re: best way to determine sequence ordering?

2006-04-29 Thread Edward Elliott
Steven Bethard wrote: Ok, lets get comparable functions by writing them both in Python: First of all, your functions aren't quite comparable. The first index takes the value to locate as a variable, while the second has both values hard-coded as literals. Changing the second one to index2(L,

Re: best way to determine sequence ordering?

2006-04-29 Thread Steven Bethard
Edward Elliott wrote: Remember kids: 1. Numbers can show anything 2. Know your data set 3. Premature optimizations are evil Amen. =) STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: Can we create an_object = object() and add attribute like fora class?

2006-04-29 Thread Pierre Rouleau
Fredrik Lundh wrote: Pierre Rouleau wrote: I can understand the design decision not to give object a __dict__, but I wonder if i'd be a good idea to have a class that derives from object and has a __dict__ to be in the standard library. so you can replace one line of code in some of

Re: best way to determine sequence ordering?

2006-04-29 Thread Steven Bethard
John Salerno wrote: If I want to make a list of four items, e.g. L = ['C', 'A', 'D', 'B'], and then figure out if a certain element precedes another element, what would be the best way to do that? Looking at the built-in list functions, I thought I could do something like: if

Re: Can we create an_object = object() and add attribute like fora class?

2006-04-29 Thread Alex Martelli
Pierre Rouleau [EMAIL PROTECTED] wrote: Fredrik Lundh wrote: Pierre Rouleau wrote: I can understand the design decision not to give object a __dict__, but I wonder if i'd be a good idea to have a class that derives from object and has a __dict__ to be in the standard library.

Re: resume picking items from a previous list

2006-04-29 Thread James Stroud
kpp9c wrote: I have a several list of songs that i pick from, lets, say that there are 10 songs in each list and there are 2 lists. For a time i pick from my songs, but i only play a few of the songs in that list... now my wife, Jessica Alba, comes home, and i start playing from Jessica's

how not use memmove when insert a object in the list

2006-04-29 Thread kyo guan
Hi : python list object like a stl vector, if insert a object in the front or the middle of it, all the object after the insert point need to move backward. look at this code ( in python 2.4.3) static int ins1(PyListObject *self, int where, PyObject *v) { int i, n =

Re: resume picking items from a previous list

2006-04-29 Thread James Stroud
James Stroud wrote: kpp9c wrote: I have a several list of songs that i pick from, lets, say that there are 10 songs in each list and there are 2 lists. For a time i pick from my songs, but i only play a few of the songs in that list... now my wife, Jessica Alba, comes home, and i start

  1   2   >