Re: os.wait() losing child?

2007-07-13 Thread Hrvoje Niksic
Jason Zheng <[EMAIL PROTECTED]> writes: > Hrvoje Niksic wrote: >>> greg wrote: >> Actually, it's not that bad. _cleanup only polls the instances that >> are no longer referenced by user code, but still running. If you hang >> on to Popen instances, they won't be added to _active, and __init__ >>

Re: Function parameter type safety?

2007-07-13 Thread Bruno Desthuilliers
Robert Dailey a écrit : > Hi, > > Is there a way to force a specific parameter in a function to be a > specific type? No, and that's considered a GoodThing(tm). > For example, say the first parameter in a function of > mine is required to be a string. If the user passes in an integer, I > want

Question about PyDict_SetItemString

2007-07-13 Thread lgx
Does PyDict_SetItemString(pDict,"key",PyString_FromString("value")) cause memory leak? >From Google results, I find some source code write like that. But some code write like below: obj = PyString_FromString("value"); PyDict_SetItemString(pDict,"key",obj); Py_DECREF(obj); So, which one is corre

Re: Question about PyDict_SetItemString

2007-07-13 Thread Stefan Behnel
lgx schrieb: > Does PyDict_SetItemString(pDict,"key",PyString_FromString("value")) > cause memory leak? You shouldn't use that at all. If you look at the sources, what SetItemString does is: create a Python string from the char* and call PyDict_SetItem() to put the new string in. So it is actually

Re: How to create new files?

2007-07-13 Thread Hrvoje Niksic
Robert Dailey <[EMAIL PROTECTED]> writes: > class filestream: > def __init__( self, filename ): > self.m_file = open( filename, "rwb" ) [...] > So far, I've found that unlike with the C++ version of fopen(), the > Python 'open()' call does not create the file for you when opene

how to call bluebit...

2007-07-13 Thread 78ncp
helo... i'm so glad can join to this website... i want to ask.. how to import bluebit matrik calculator that result of singular value decomposition (SVD) in python programming.. thank's for your answer. -- View this message in context: http://www.nabble.com/how-to-call-bluebit...-tf4072919.

Re: Class decorators do not inherit properly

2007-07-13 Thread Bruno Desthuilliers
Chris Fonnesbeck a écrit : > I have a class that does MCMC sampling (Python 2.5) that uses decorators > -- one in particular called _add_to_post that appends the output of the > decorated method to a class attribute. > However, when I > subclass this base class, the decorator no longer works: >

Re: Class decorators do not inherit properly

2007-07-13 Thread Bruno Desthuilliers
Lee Harr a écrit : >> Traceback (most recent call last): >> File "/Users/chris/Projects/CMR/closed.py", line 132, in >> class M0(MetropolisHastings): >> File "/Users/chris/Projects/CMR/closed.py", line 173, in M0 >> @_add_to_post >> NameError: name '_add_to_post' is not defined >> >> y

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-13 Thread Paul Rubin
Ben Finney <[EMAIL PROTECTED]> writes: > This is interesting. Do you have any references we can read about this > assertion -- specifically, that "GOTO" was not well loved (I assume > "by the programming community at large") even by around 1966? Dijkstra's famous 1968 "GOTO considered harmful"

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-13 Thread Ben Finney
John Nagle <[EMAIL PROTECTED]> writes: > Donn Cave wrote: > > In its day, goto was of course very well loved. > > No, it wasn't. By 1966 or so, "GOTO" was starting to look like a > bad idea. It was a huge hassle for debugging. This is interesting. Do you have any references we can read about th

Re: How to create new files?

2007-07-13 Thread Bruno Desthuilliers
Robert Dailey a écrit : > Hi, > > I'm trying to create a Python equivalent of the C++ "ifstream" class, > with slight behavior changes. > > Basically, I want to have a "filestream" object that will allow you to > overload the '<<' and '>>' operators to stream out and stream in data, > respectivel

Re: Fastest way to convert a byte of integer into a list

2007-07-13 Thread Paul McGuire
On Jul 12, 5:34 pm, Godzilla <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to find a way to convert an integer (8-bits long for > starters) and converting them to a list, e.g.: > > num = 255 > numList = [1,1,1,1,1,1,1,1] > > with the first element of the list being the least significant, so >

Re: Getting values out of a CSV

2007-07-13 Thread Daniel
>> > Note that every time you see [x for x in ...] with no condition, you >> can >> > write list(...) instead - more clear, and faster. >> > >> > data = list(csv.reader(open('some.csv', 'rb'))) >> >> Faster? No. List Comprehensions are faster. > > [EMAIL PROTECTED] pdfps $ python -m timeit -c 'da

Re: Fast powerset function

2007-07-13 Thread Carsten Haese
On 13 Jul 2007 02:25:59 -0700, Paul Rubin wrote > Antoon Pardon <[EMAIL PROTECTED]> writes: > > On 7/12/07, Arash Arfaee <[EMAIL PROTECTED]> wrote: > > > I need a powerset generator function. It's really slow with recursion. > > > Does > > > anybody have any idea or code(!!) to do it in an accepta

Re: MaildirMessage

2007-07-13 Thread Steve Holden
Ben Finney wrote: > "Gabriel Genellina" <[EMAIL PROTECTED]> writes: > >> msg is an instance of MaildirMessage (subclass of Message) - it has >> no specific iterator, so "for m in msg" tries to use the sequence >> protocol, starting at 0; that is, tries to get msg[0]. Message >> objects support the

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-07-13 Thread Steve Holden
Twisted wrote: [on 7/7/07]: I don't know, but it sure as hell isn't emacs. Then, more recently: > On Jul 12, 7:10 pm, Miles Bader <[EMAIL PROTECTED]> wrote: >> Twisted <[EMAIL PROTECTED]> writes: >>> I won't dignify your insulting twaddle and random ad-hominem verbiage >>> with any more response

Re: scripts into wxPython

2007-07-13 Thread kyosohma
On Jul 13, 7:39 am, justme <[EMAIL PROTECTED]> wrote: > Hello > > I've been happily scripting away for the last few years (Matlab, now > Python) and all has been fine. Now I find myself scripting up code for > clients, but they all want a nice GUI. I've had a tinker with wxPython > and it all seems

Re: Getting values out of a CSV

2007-07-13 Thread Marc 'BlackJack' Rintsch
On Fri, 13 Jul 2007 15:05:29 +0300, Daniel wrote: >>> > Note that every time you see [x for x in ...] with no condition, you >>> can >>> > write list(...) instead - more clear, and faster. >>> > >>> > data = list(csv.reader(open('some.csv', 'rb'))) >>> >>> Faster? No. List Comprehensions are fas

Re: web page text extractor

2007-07-13 Thread kublai
On Jul 13, 5:44 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jul 12, 4:42 am, kublai <[EMAIL PROTECTED]> wrote: > > > Hello, > > > For a project, I need to develop a corpus of online news stories. I'm > > looking for an application that, given the url of a web page, "copies" > > the rendered t

Re: The Modernization of Emacs: terminology buffer and

2007-07-13 Thread Gabor Urban
Hullo, I was just wondering if this thread was whithering out.. I gues not for a good time. A short summary in the hope for the last posting in this topic. Some provocative posting caused or Twister brother to send a large amount of doubtful info. It seems, he had some very bad experience w

pytz giving incorrect offset and timezone

2007-07-13 Thread Sanjay
Hi All, I am facing some strange problem in pytz. The timezone "Asia/Calcutta" is actually IST, which is GMT + 5:30. But while using pytz, it is being recognized as HMT (GMT + 5:53). While I digged into the oslan database, I see the following: # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Ca

Writing a Python manual for Poser 7. Advice required re copyright/license

2007-07-13 Thread PhilC
Hi Folks, I'm attempting to write a comprehensive manual explaining how to write Python scripts for the Poser 7 application. All the example scripts, explanatory paragraphs and screen shots will naturally be all my own work. My difficulty is in knowing how I may present the large amount of tabulat

Re: how to call bluebit...

2007-07-13 Thread Daniel Nogradi
> how to import bluebit matrik calculator that result of singular value > decomposition (SVD) in python programming.. I'm not really sure I understand you but you might want to check out scipy: http://scipy.org/ HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Assignments to __class_ broken in Python 2.5?

2007-07-13 Thread samwyse
(Yes, I probably should have said CPython in my subject, not Python. Sorry.) On Jul 13, 12:56 am, samwyse <[EMAIL PROTECTED]> wrote: > OK, in classobject.h, we find this: > > #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) > > That seems straightforward enough. And the relevant messag

Re: variable naming query

2007-07-13 Thread Neil Cerutti
On 2007-07-12, Ben Finney <[EMAIL PROTECTED]> wrote: >> self.__myvariable > > Indicates to the reader that the attribute '__myvariable' is > not available by that name outside the object, and name > mangling is automatically done to discourage its use from > outside the object. >From _Python Refer

Re: diferent answers with isalpha()

2007-07-13 Thread nuno
On Jul 13, 6:07 am, Jyotirmoy Bhattacharya <[EMAIL PROTECTED]> wrote: > On Jul 13, 5:05 am, [EMAIL PROTECTED] wrote: > > > In Idle when I do print 'á'.isalpha() I get True. When I make and > > execute a script file with the same code I get False. > > > Why do I have diferent answers ? > > Non-ASCII

Re: bool behavior in Python 3000?

2007-07-13 Thread Bruno Desthuilliers
Miles a écrit : > On Jul 12, 8:37 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: >> I do not like that bool(False-True) is True. > > I've never seen the "A-B" used to represent "A and not B", nor have I > seen any other operator used for that purpose in boolean algebra, > though my experience is limite

Re: bool behavior in Python 3000?

2007-07-13 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) > It makes more sense to explicitly cast bools to ints s/cast bools to ints/build ints from bools/ AFAICT, there's no such thing as typecast in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting values out of a CSV

2007-07-13 Thread Michael Hoffman
Daniel wrote: > On Fri, 13 Jul 2007 08:51:25 +0300, Gabriel Genellina > <[EMAIL PROTECTED]> wrote: > >> Note that every time you see [x for x in ...] with no condition, you >> can write list(...) instead - more clear, and faster. > > Faster? No. List Comprehensions are faster. Why do you think

Re: web page text extractor

2007-07-13 Thread Paul McGuire
On Jul 12, 4:42 am, kublai <[EMAIL PROTECTED]> wrote: > Hello, > > For a project, I need to develop a corpus of online news stories. I'm > looking for an application that, given the url of a web page, "copies" > the rendered text of the web page (not the source HTNL text), opens a > text editor (N

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-13 Thread Diez B. Roggisch
John Nagle schrieb: > Chris Mellon wrote: >> You can't prove a program to be correct, in the sense that it's proven >> to do what it's supposed to do and only what it's supposed to do. > > Actually, you can prove quite a bit about programs with the right > tools. > For example, proving that a

Re: Tool for finding external dependencies

2007-07-13 Thread syt
On Jul 9, 3:39 am, Rob Cakebread <[EMAIL PROTECTED]> wrote: > Hi, > > I need to find external dependencies for modules (not Python standard > library imports). > > Currently I usepylintand manually scan the output, which is very > nice, or usepylint's--ext-import-graph option to create a .dot file

Re: Fast powerset function

2007-07-13 Thread Antoon Pardon
On 7/12/07, Arash Arfaee <[EMAIL PROTECTED]> wrote: > I need a powerset generator function. It's really slow with recursion. Does > anybody have any idea or code(!!) to do it in an acceptable time? > Thanks My idea would be the following. 1) Turn your set into a list: lst 2) let lng be the numbe

Re: Class decorators do not inherit properly

2007-07-13 Thread Diez B. Roggisch
Chris Fonnesbeck schrieb: > I have a class that does MCMC sampling (Python 2.5) that uses decorators > -- one in particular called _add_to_post that appends the output of the > decorated method to a class attribute. However, when I > subclass this base class, the decorator no longer works: > >

Re: Question about PyDict_SetItemString

2007-07-13 Thread Stefan Behnel
lgx schrieb: > Does PyDict_SetItemString(pDict,"key",PyString_FromString("value")) > cause memory leak? > >>From Google results, I find some source code write like that. But some > code write like below: > > obj = PyString_FromString("value"); > PyDict_SetItemString(pDict,"key",obj); > Py_DECREF

Re: how to install pygame package?

2007-07-13 Thread Daniel Nogradi
> Im working in red hat linux 9.0. I've downloaded the pygame package > but i dont know how to install it. If anybody has the time to detail > the steps sequentially... thanx! > > P.S. I've downloaded both the tar and the rpm packages... First you can try the rpm package: su (give the root passwo

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-13 Thread Antoon Pardon
On 2007-07-13, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > "Donn Cave" <[EMAIL PROTECTED]> wrote: > >>In its day, goto was of course very well loved. > > Does anybody know for sure if it is in fact possible to > design a language completely free from conditional jumps? I think you have to be m

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-13 Thread Marc 'BlackJack' Rintsch
On Fri, 13 Jul 2007 08:37:00 +0200, Hendrik van Rooyen wrote: > "Donn Cave" <[EMAIL PROTECTED]> wrote: > >>In its day, goto was of course very well loved. > > Does anybody know for sure if it is in fact possible to > design a language completely free from conditional jumps? GOTO is unconditiona

Re: Fast powerset function

2007-07-13 Thread Paul Rubin
Antoon Pardon <[EMAIL PROTECTED]> writes: > On 7/12/07, Arash Arfaee <[EMAIL PROTECTED]> wrote: > > I need a powerset generator function. It's really slow with recursion. Does > > anybody have any idea or code(!!) to do it in an acceptable time? > My idea would be the following. ... > 3) let n rang

Re: Getting values out of a CSV

2007-07-13 Thread Kelvie Wong
On 7/12/07, Daniel <[EMAIL PROTECTED]> wrote: > On Fri, 13 Jul 2007 08:51:25 +0300, Gabriel Genellina > <[EMAIL PROTECTED]> wrote: > >> data = [row for row in csv.reader(open('some.csv', 'rb')) > > > > Note that every time you see [x for x in ...] with no condition, you can > > write list(...) inst

Re: Function parameter type safety?

2007-07-13 Thread Dave Baum
In article <[EMAIL PROTECTED]>, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a way to force a specific parameter in a function to be a > specific type? For example, say the first parameter in a function of > mine is required to be a string. If the user passes in an integer, I > wa

Re: patching pylint.el

2007-07-13 Thread syt
On Jul 9, 4:13 pm, lgfang <[EMAIL PROTECTED]> wrote: > Hi, > > I think this is a bug ofpylint.el. But I failed finding a way to > submit the bug neither in its official site nor in google. So I post > it here wishing it may be useful for some buddies. > > The bug is that it uses "compile-internal

Re: Function parameter type safety?

2007-07-13 Thread Robert Dailey
Good replies. I'm in the process of learning Python. I'm a native C++ programmer, so you can see how the question relates. There's a lot of cool things C++ allowed you to do with type-checking, such as function overloading. With templates + type checking, I can create a STD version of ifstream/ of

Re: Question about PyDict_SetItemString

2007-07-13 Thread Hrvoje Niksic
lgx <[EMAIL PROTECTED]> writes: >From Google results, I find some source code write like that. But >some code write like below: > > obj = PyString_FromString("value"); > PyDict_SetItemString(pDict,"key",obj); > Py_DECREF(obj); > > So, which one is correct? The latter is correct. While PyDict_Ge

Re: MaildirMessage

2007-07-13 Thread Tzury
> Which is a bug in the 'email.message' module, in my view. If it's > attempting to support a mapping protocol, it should allow iteration > the same way standard Python mappings do: by iterating over the keys. I thought it is a bug as well, but who am I a python newbie to say so. I found inspect.g

Re: Fast powerset function

2007-07-13 Thread Carsten Haese
On Fri, 2007-07-13 at 08:15 -0400, I wrote: > [...] > def recursive_powerset(s): > if not s: yield set() > for x in s: > s2 = s - set([x]) > for subset in recursive_powerset(s2): > yield subset > for subset in recursive_powerset(s2): > yield s

scripts into wxPython

2007-07-13 Thread justme
Hello I've been happily scripting away for the last few years (Matlab, now Python) and all has been fine. Now I find myself scripting up code for clients, but they all want a nice GUI. I've had a tinker with wxPython and it all seems standard enough but I was wondering if anyone has any comments a

Re: How to create new files?

2007-07-13 Thread Robert Dailey
On Jul 13, 3:04 am, Bruno Desthuilliers wrote: > Robert Dailey a écrit : > > > Hi, > > > I'm trying to create a Python equivalent of the C++ "ifstream" class, > > with slight behavior changes. > > > Basically, I want to have a "filestream" object that will allow you to > > overload the '<<' and '>

Re: How to create new files?

2007-07-13 Thread ahlongxp
On Jul 13, 5:14 am, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to create a Python equivalent of the C++ "ifstream" class, > with slight behavior changes. > > Basically, I want to have a "filestream" object that will allow you to > overload the '<<' and '>>' operators to stream ou

Re: bool behavior in Python 3000?

2007-07-13 Thread ahlongxp
On Jul 11, 5:36 am, Bjoern Schliessmann wrote: > Is there any type named "bool" in standard Python? check this out. >>> doespythonrock = True >>> print type(doespythonrock) >>> -- ahlongxp Software College,Northeastern University,China [EMAIL PROTECTED] http://www.herofit.cn -- http://mail

Re: os.wait() losing child?

2007-07-13 Thread Jason Zheng
Hrvoje Niksic wrote: > Jason Zheng <[EMAIL PROTECTED]> writes: > >> Hrvoje Niksic wrote: greg wrote: >>> Actually, it's not that bad. _cleanup only polls the instances that >>> are no longer referenced by user code, but still running. If you hang >>> on to Popen instances, they won't be add

Re: access to the namespace of a function from within its invocation

2007-07-13 Thread Bruno Desthuilliers
Poor Yorick a écrit : > In the example below, the attribute "data" is added to a function > object. "me" can be used to get the function when it is invoked using > an identifier that matches the "co_name" attribute of function's code > object. Can anyone conjure an example of accessing fun2.da

Re: Function parameter type safety?

2007-07-13 Thread Michele Simionato
On Jul 13, 4:53 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Good replies. > > I'm in the process of learning Python. I'm a native C++ programmer, so > you can see how the question relates. There's a lot of cool things C++ > allowed you to do with type-checking, such as function overloading. Thi

Re: How to create new files?

2007-07-13 Thread Bruno Desthuilliers
Robert Dailey a écrit : > On Jul 13, 3:04 am, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: (snip) > Thanks for the variable naming tips. Is it normal for Python > programmers to create class members with a _ prefixed? This is the convention to denote implementation attributes. This won't of cou

permission denied in shutil.copyfile

2007-07-13 Thread Ahmed, Shakir
Is there any way to copy a file from src to dst if the dst is exclusively open by other users. I am using src = 'c:\mydata\data\*.mdb' dst = 'v:\data\all\*.mdb' shutil.copyfile(src,dst) but getting error message permission denied. Any help is highly appreciated. Thanks sh -- http://mail.py

Tibco Rendezvous

2007-07-13 Thread rdahlstrom
Has anyone found or written a Tibco Rendezvous (tibrv) module for Python? I've only found some really old ones with German documentation and not updated since some time around 2000. -- http://mail.python.org/mailman/listinfo/python-list

Re: web page text extractor

2007-07-13 Thread rdahlstrom
To maintain paragraphs, replace any p or br tags with your favorite operating system's crlf. On Jul 13, 8:57 am, kublai <[EMAIL PROTECTED]> wrote: > On Jul 13, 5:44 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > > > On Jul 12, 4:42 am, kublai <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > Fo

Can a low-level programmer learn OOP?

2007-07-13 Thread Chris Carlen
Hi: From what I've read of OOP, I don't get it. I have also found some articles profoundly critical of OOP. I tend to relate to these articles. However, those articles were no more objective than the descriptions of OOP I've read in making a case. Ie., what objective data/studies/research

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Chris Carlen
Gabriel Genellina wrote: > En Thu, 12 Jul 2007 21:51:08 -0300, Chris Carlen > <[EMAIL PROTECTED]> escribió: >> http://hetland.org/writing/instant-python.html >> I don't understand Hetland's terminology though, when he is speaking of >> "binding" and "reference." Actually, Hetland's entire first

sys.exit versus termination of source code

2007-07-13 Thread Carl DHalluin
Hi, I am playing with the atexit module but I don't find a way to see the difference between a script calling sys.exit() and the interpreting arriving at the end of the source code file. This has a semantic difference for my applications. Is there a way to determine in an exithandler (that i

Re: Getting values out of a CSV

2007-07-13 Thread Daniel
On Fri, 13 Jul 2007 16:18:38 +0300, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> $ python -m timeit -c 'import csv; data = >> list(csv.reader(open("some.csv", >> "rb")))' >> 1 loops, best of 3: 44 usec per loop >> $ python -m timeit -c 'import csv; data = [row for row in >> csv.re

Re: Circular import problem

2007-07-13 Thread bvdp
> Seehttp://effbot.org/zone/import-confusion.htm > Try to move the circular references later in the code (maybe inside a > function, when it is required), or much better, refactor it so there is no > circularity. > > -- > Gabriel Genellina Yes, thanks. I'd read that page before posting. Helpful.

how to implementation latent semantic indexing in python..

2007-07-13 Thread 78ncp
hi... how to implementation algorithm latent semantic indexing in python programming...?? thank's for daniel who answered my question before.. -- View this message in context: http://www.nabble.com/how-to-implementation-latent-semantic-indexing-in-python..-tf4075439.html#a11582773 Sent from th

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Marc 'BlackJack' Rintsch
On Fri, 13 Jul 2007 09:06:44 -0700, Chris Carlen wrote: > Perhaps the only thing that may have clicked regarding OOP is that in > certain cases I might prefer a higher-level approach to tasks which > involve dynamic memory allocation. If I don't need the execution > efficiency of C, then OOP m

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wildemar Wildenburger
Chris Carlen wrote: > Let's go back the statement: > > x = [1,2,3] > > Do we then say: "[1,2,3] is x" or is it the other way around: "x is > [1,2,3]" ??? > This will yield 'False', because 'is' checks for *identity* not equality. In your case you assign a list the name 'x' and then check (via

Re: Problem with Python's "robots.txt" file parser in module robotparser

2007-07-13 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, John Nagle <[EMAIL PROTECTED]> wrote: >I asked over at Webmaster World, and over there, they recommend against > using redirects on robots.txt files, because they questioned whether all of > the major search engines understand that. Does a redirect for > "foo

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Chris Carlen
Ben Finney wrote: > Chris Carlen <[EMAIL PROTECTED]> writes: > > def change(some_list): > some_list[1] = 4 > > x = [1,2,3] > change(x) > print x # Prints out [1,4,3] > --- > def nochange(x): > x = 0 > > y = 1 > nochange(y) > print y # Prints out 1 > >>I don't understand Hetland's

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wildemar Wildenburger
Wildemar Wildenburger wrote: > x = [1, 2, 3] > y = [1, 2, 3] > id(x), id(y) > x == y > x is y > Ooops! Make that: x = [1, 2, 3] y = [1, 2, 3] id(x); id(y) x == y x is y (had to be a semicolon there) -- http://mail.python.org/mailman/listinfo/python-list

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread John Nagle
Chris Carlen wrote: > Hi: > > From what I've read of OOP, I don't get it. I have also found some > articles profoundly critical of OOP. I tend to relate to these articles. > > However, those articles were no more objective than the descriptions of > OOP I've read in making a case. Ie., what

Re: Re-raising exceptions with modified message

2007-07-13 Thread samwyse
On Jul 13, 12:45 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > samwyse wrote: > > TypeError: __class__ must be set to a class > > > Excpt ceratinly appears to be a class. Does anyone smarter than me > > know what's going on here? > > Not that I want to appear smarter, but I think the proble

Re: os.wait() losing child?

2007-07-13 Thread Hrvoje Niksic
Jason Zheng <[EMAIL PROTECTED]> writes: >>> Nope it still doesn't work. I'm running python 2.4.4, tho. >> That explains it, then, and also why greg's code didn't work. You >> still have the option to try to run 2.5's subprocess.py under 2.4. > Is it more convenient to just inherit the Popen class

renaming an open file in nt like unix?

2007-07-13 Thread aaron . watters
Hi. I'm writing an archival system which I'd like to be portable to Windows. The system relies on the property of Unix which allows a process to keep a file open even if another process renames it while it is open. Neither process sees any anomaly or error. Do the NT file systems support this f

Re: patching pylint.el

2007-07-13 Thread lgfang
> "syt" == syt <[EMAIL PROTECTED]> writes: syt> fyi, pylint related bug should be reported on the python- syt> [EMAIL PROTECTED] mailing list. I've opened a ticket for syt> your bug/patch: http://www.logilab.org/bug/eid/4026 Thank you, Sylvain Fanglungang (fang.lungang at gmail)

Re: renaming an open file in nt like unix?

2007-07-13 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > Hi. I'm writing an archival system which I'd like to be portable > to Windows. > > The system relies on the property of Unix which allows a > process to keep a file open even if another process renames > it while it is open. Neither process sees any anomaly or > erro

CTypes FAQs - buffer memmove offsetof uchar ((void *) -1) etc.

2007-07-13 Thread p . lavarre
http://wiki.python.org/moin/ctypes now tries to answer: '''FAQ: How do I copy bytes to Python from a ctypes.Structure?''' '''FAQ: How do I copy bytes to a ctypes.Structure from Python?''' '''FAQ: Why should I fear using ctypes.memmove?''' '''FAQ: How do I change the byte length of a ctypes.Structu

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Chris Mellon
On 7/13/07, Chris Carlen <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: > > Chris Carlen <[EMAIL PROTECTED]> writes: > > That's not how Python works. Every value is an object; the assignment > > operator binds a name to an object. This is more like writing the name > > on a sticky-note, and sticki

Re: Fast powerset function

2007-07-13 Thread Jyotirmoy Bhattacharya
On Jul 13, 6:34 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > def recursive_powerset(s): > if not s: yield set() > for x in s: > s2 = s - set([x]) > for subset in recursive_powerset(s2): > yield subset > yield subset.union(set([x])) > Your recursive_

RE: Tibco Rendezvous

2007-07-13 Thread Kip Lehman
Circa summer 2003, at a company I previously worked at, a co-worker and I had an occasion to see if we could get Python and TIBCO Rendezvous working together. The SWIG-based tibrv mechanism was insufficient, buggy and was problematic in terms of keeping up with Python releases. We resorted to u

NoneType object not iterable

2007-07-13 Thread tom
Hi! My code is > db = {} > > def display(): > keyList = db.keys() > sortedList = keyList.sort() > for name in sortedList: > line = 'Name: %s, Number: %s' % (name, db[name]) > print line.replace('\r', '') And it gives following error: > for name in sortedList: >

Re: Fast powerset function

2007-07-13 Thread Carsten Haese
On Fri, 2007-07-13 at 17:38 +, Jyotirmoy Bhattacharya wrote: > On Jul 13, 6:34 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > > def recursive_powerset(s): > > if not s: yield set() > > for x in s: > > s2 = s - set([x]) > > for subset in recursive_powerset(s2): > >

Re: NoneType object not iterable

2007-07-13 Thread Stargaming
[EMAIL PROTECTED] schrieb: > Hi! > My code is > > > db = {} > > > >> def display(): >> keyList = db.keys() >> sortedList = keyList.sort() >> for name in sortedList: >> line = 'Name: %s, Number: %s' % (name, db[name]) >> print line.replace('\r', '') > > > And it giv

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Simon Hibbs
Chris, I can fully relate to your post. I trained as a programmer in the 80s when OOP was an accademic novelty, and didn't learn OOP untill around 2002. However now I find myself naturaly thinking in OOP terms, although I'm by no means an expert - I'm a sysadmin that writes the occasional utility.

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Simon Hibbs
Sorry, here's the tutorial link: http://hetland.org/writing/instant-python.html Simon Hibbs -- http://mail.python.org/mailman/listinfo/python-list

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Chris Carlen
John Nagle wrote: > Chris Carlen wrote:[edit] >> Hence, being a hardware designer rather than a computer scientist, I >> am conditioned to think like a machine. I think this is the main >> reason why OOP has always repelled me. > > Why? When pointers were first explined to me, I went "Ok."

Re: NoneType object not iterable

2007-07-13 Thread Bjoern Schliessmann
Daniel wrote: > db is out of scope, you have to pass it to the function: What's wrong about module attributes? Regards, Björn -- BOFH excuse #418: Sysadmins busy fighting SPAM. -- http://mail.python.org/mailman/listinfo/python-list

Re: 2**2**2**2**2 wrong? Bug?

2007-07-13 Thread Wayne Brehaut
On Mon, 09 Jul 2007 23:51:25 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >On Jul 9, 11:42?pm, Paul McGuire <[EMAIL PROTECTED]> wrote: >> On Jul 9, 11:21 pm, "Jim Langston" <[EMAIL PROTECTED]> wrote:> In Python 2.5 >> on intel, the statement >> > 2**2**2**2**2 >> > evaluates to>>> 2**2**

Re: Fast powerset function

2007-07-13 Thread Evan Klitzke
On 7/12/07, Arash Arfaee <[EMAIL PROTECTED]> wrote: > I need a powerset generator function. It's really slow with recursion. Does > anybody have any idea or code(!!) to do it in an acceptable time? > Thanks > -Arash Here's a much simpler (and faster) solution I got from a coworker: s = range(18)

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wayne Brehaut
On Fri, 13 Jul 2007 18:49:06 +0200, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: >Wildemar Wildenburger wrote: >> x = [1, 2, 3] >> y = [1, 2, 3] >> id(x), id(y) >> x == y >> x is y >> >Ooops! > >Make that: > >x = [1, 2, 3] >y = [1, 2, 3] >id(x); id(y) >x == y >x is y > >(had to be a semicol

Re: NoneType object not iterable

2007-07-13 Thread Daniel
On Fri, 13 Jul 2007 20:44:13 +0300, <[EMAIL PROTECTED]> wrote: > > Hi! > My code is > > > db = {} > > >> def display(): >> keyList = db.keys() >> sortedList = keyList.sort() >> for name in sortedList: >> line = 'Name: %s, Number: %s' % (name, db[name]) >> print line.r

Re: NoneType object not iterable

2007-07-13 Thread Daniel
On Fri, 13 Jul 2007 21:13:20 +0300, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > > Daniel wrote: > >> db is out of scope, you have to pass it to the function: > > What's wrong about module attributes? > I made a mistake -- http://mail.python.org/mailman/listinfo/python-list

Re: NoneType object not iterable

2007-07-13 Thread Paul Rubin
Stargaming <[EMAIL PROTECTED]> writes: > It does not turn into something. The `sort()` method just works "in > place", i. e. it will mutate the list it has been called with. It > returns None (because there is no other sensible return value). > > For you, that means: You don't have to distinguish

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Steve Holden
Chris Mellon wrote: > On 7/13/07, Chris Carlen <[EMAIL PROTECTED]> wrote: >> Ben Finney wrote: >>> Chris Carlen <[EMAIL PROTECTED]> writes: > >>> That's not how Python works. Every value is an object; the assignment >>> operator binds a name to an object. This is more like writing the name >>> on

A Python newbie ask a simple question

2007-07-13 Thread xing93111
what does the statement "choice = raw_input(prompt)[0]" mean? I don't know why there is a '[0]' in the statement. Thank you very much -- http://mail.python.org/mailman/listinfo/python-list

Re: renaming an open file in nt like unix?

2007-07-13 Thread Steve Holden
Thomas Heller wrote: > [EMAIL PROTECTED] schrieb: >> Hi. I'm writing an archival system which I'd like to be portable >> to Windows. >> >> The system relies on the property of Unix which allows a >> process to keep a file open even if another process renames >> it while it is open. Neither proces

Re: sys.exit versus termination of source code

2007-07-13 Thread Steve Holden
Carl DHalluin wrote: > Hi, > > > > I am playing with the atexit module but I don’t find a way to see the > difference > > between a script calling sys.exit() and the interpreting > arriving at the end > > of the source code file. This has a semantic difference for my applications. > > Is t

Re: A Python newbie ask a simple question

2007-07-13 Thread Jeff McNeil
The raw_input built-in returns a string. The '[0]' subscript returns the first character in the user supplied response as strings support indexing. [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> mystr = "asdf" >>>

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-13 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > Ben Finney <[EMAIL PROTECTED]> writes: > > This is interesting. Do you have any references we can read about this > > assertion -- specifically, that "GOTO" was not well loved (I assume > > "by the programming communit

Re: 2**2**2**2**2 wrong? Bug?

2007-07-13 Thread Paul McGuire
On Jul 13, 1:20 pm, Wayne Brehaut <[EMAIL PROTECTED]> wrote: > On Mon, 09 Jul 2007 23:51:25 -0700, "[EMAIL PROTECTED]" > > > > > > <[EMAIL PROTECTED]> wrote: > >On Jul 9, 11:42?pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > >> On Jul 9, 11:21 pm, "Jim Langston" <[EMAIL PROTECTED]> wrote:> In Python

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Evan Klitzke
On 7/13/07, John Nagle <[EMAIL PROTECTED]> wrote: > You can sometimes get better performance in C++ than in C, because C++ > has "inline". Inline expansion happens before optimization, so you > can have abstractions that cost nothing. This is a bit off topic, but inline is a keyword in C sin

Numpy array index handling

2007-07-13 Thread phishboh
Being a Matlab user wanting to switch to Python/SciPy, I'd like to know how the following Matlab code would be written in Python: % First, just some artificial data N = 100 ; input = sign(randn(1, N)) ; a = (1 : N) ; % This is what I'd like to do; % for indices where the input has a certain va

  1   2   >