Re: Python code and C code in the same module?

2004-11-30 Thread Fredrik Lundh
Steven Bethard wrote: > I'd like to merge a module written in C with a module written in Python so > that the user can > access objects from either module by importing the single, merged module. > > Specifically, I'm looking at the collections module, which is written in C, > and my Bunch objec

Re: Random number generation from functions

2004-11-30 Thread Robert Kern
drs wrote: Is there any way to generate random numbers based on arbitrary real valued functions? I am looking for something like random.gauss() but with natural log and exponential functions. scipy[1] has a large collection of "standard" univariate pdfs, including normal, exponential, gamma, and t

Re: python API wrapper for C++ API

2004-11-30 Thread Josiah Carlson
"Mark Doberenz" <[EMAIL PROTECTED]> wrote: > I'm fairly new at Python, but I've got a project I really want to do. > > I'm working with a real-time 3D program called Deep Creator, and it has > a C++ API written for it. I'm wondering what it would take to create a > Python wrapper that would all

Re: python API wrapper for C++ API

2004-11-30 Thread Fredrik Lundh
Mark Doberenz wrote: > I'm working with a real-time 3D program called Deep Creator, and it has > a C++ API written for it. I'm wondering what it would take to create a > Python wrapper that would allow me to write Python programs that would > call the C++ API. start here: http://www.python.org/

Re: pre-PEP generic objects

2004-11-30 Thread Fredrik Lundh
Steven Bethard wrote: > Currently, if a Python programmer makes this design decision, they are > forced to declare a new class, and then build instances of this class. FORCED to create a new class, and FORCED to create instances of their own class instead of your class? without this, Python must

Re: Question of Optionparse

2004-11-30 Thread Peter Otten
Pekka Niiranen wrote: > How can I STOP Optionparse to process boolean > value as parameter. See this: > > >>> parser = optparse.OptionParser() > >>> parser.add_option("-x",dest='xxx', action="store_true",help="xxx") > >>> parser.add_option("-r",dest='root',help="directory",type="string") > >>

Re: Protecting Python source

2004-11-30 Thread Marco Aschwanden
+1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Get Special Folders (ie Desktop location)

2004-11-30 Thread Colin Steadman
I'm just starting out writing Python scripts (in PSP), and need to find the location of Windows special folders such as 'My Documents' and 'Desktop' so that I can save files in the right place. Is there any method I can use in Python to get these? If I were doing this in VBScript it'd be: Dim

Python on Nokia Phones ?

2004-11-30 Thread Mark Doukidis
Is it DEAD ? An exciting prospect when I first heard of Nokia's proposal. I thought there would be a few more postings here since the idea first surfaced around Jan 2004. Maybe I missed something. Can anyone on the pilot program make a comment ? Please give me reason to hope ? Mark -- http://m

RE: Get Special Folders (ie Desktop location)

2004-11-30 Thread Tim Golden
[EMAIL PROTECTED] | I'm just starting out writing Python scripts (in PSP), and need to | find the location of Windows special folders such as 'My Documents' | and 'Desktop' so that I can save files in the right place. Is there | any method I can use in Python to get these? | | If I were doing thi

comment out more than 1 line at once?

2004-11-30 Thread Riko Wichmann
Dear all, is there a way in Python to comment out blocks of code without putting a # in front of each line? Somethings like C's /* block of code here is commented out */ Thanks, Riko -- http://mail.python.org/mailman/listinfo/python-list

Re: Protecting Python source

2004-11-30 Thread Peter Maas
Grant Edwards schrieb: On 2004-11-29, Peter Maas <[EMAIL PROTECTED]> wrote: If the "reverse engineering" argument boils down to "protecting source doesn't make sense" then why does Microsoft try so hard to protect its sources? To avoid embarassment. :) This cannot be the whole truth otherwise the

Class methods in Python/C?

2004-11-30 Thread Craig Ringer
Hi folks I've been doing some looking around, but have been unable to find out how to implement class methods on Python objects written in C. "Why are you using C?" you ask? Yeah, so do I. However, I need to provide bindings for an application that Python is embedded into, and thanks to Qt the bi

Re: comment out more than 1 line at once?

2004-11-30 Thread Aaron Bingham
Riko Wichmann wrote: Dear all, is there a way in Python to comment out blocks of code without putting a # in front of each line? Somethings like C's /* block of code here is commented out */ No. Why do you want this? Any good programmer's editor will have a comment/uncomment feature to mak

Re: pre-PEP generic objects

2004-11-30 Thread Peter Otten
Steven Bethard wrote: > def __eq__(self, other): > """x.__eq__(y) <==> x == y""" > return (isinstance(other, self.__class__) > and self.__dict__ == other.__dict__) This results in an asymmetry: >>> from bunch import Bunch >>> class B(Bunch): pass ... >>> B().__eq__(Bunch()) F

Python Embedding and pep-0263

2004-11-30 Thread Peter Jakubik
Hi I am embedding Python 2.3.3 in C++ under Win2k. I am using in my App only Python DLL and empty site.py (so that User doesn't have to install Python). The Python Scripts contains Non-ASCII characters and i get DeprecationWarning pep-0263. How can i set Python File encoding from C-Code before Scri

RE: comment out more than 1 line at once?

2004-11-30 Thread Marc Boeren
> Riko Wichmann wrote: > > > Dear all, > > > > is there a way in Python to comment out blocks of code > without putting > > a # in front of each line? Somethings like C's > > > > /* > > block of code here is commented out > > */ Well, you could fake it by doing """ block of code h

Re: Few things

2004-11-30 Thread bearophile
Thank you for the comments and answers, and sorry for my answering delay... Josiah Carlson: >Decorators can do this without additional syntax. Think @accepts and @returns.< The purpose of those pre-post is to write something simile and very *clean* that states what inputs and outputs must be. Th

Re: Python Design Patterns

2004-11-30 Thread Dave Cook
On 2004-11-29, Tony Ha <[EMAIL PROTECTED]> wrote: > I wonder, can any Python guru out there translate the Java examples in the Should be a good exercise, and not just for gurus ;}. > book into Python examples, or write a similar book in Python, perhaps I've also wished for a design patterns bo

Re: Python GTK import error

2004-11-30 Thread Dave Cook
On 2004-11-23, Qianqian Fang <[EMAIL PROTECTED]> wrote: > ImportError: /usr/lib/libgtk-x11-2.0.so.0: undefined symbol: Try setting LD_LIBRARY_PATH: export LD_LIBRARY_PATH=/usr/local/lib or wherever the .so is. If this works, add that dir to /etc/ld.so.conf and run (as root) ldconfig -v Dav

Re: documentation for PyArg_ParseTupleAndKeywords

2004-11-30 Thread Pierre Barbier de Reuille
Steven Bethard a écrit : I'm just starting to play around with the Python source. (Specifically, I'm looking at adding a key argument to max/min like sorted has.) Can anyone direct me to the documentation on how PyArg_ParseTupleAndKeywords, etc. work? In particular, I can't figure out how th

DB problem while trying to use Shelve

2004-11-30 Thread Roland Hedberg
Hi! Want to use shelve in a program I'm writing, but I encounter a problem. This is the tail of the traceback I get back: File "/sw/lib/python2.3/shelve.py", line 231, in open return DbfilenameShelf(filename, flag, protocol, writeback, binary) File "/sw/lib/python2.3/shelve.py", line 212, i

Re: comment out more than 1 line at once?

2004-11-30 Thread Bernhard Herzog
Riko Wichmann <[EMAIL PROTECTED]> writes: > I'm using emacs (with python-mode) to do most of my editing. [...] > Maybe I just don't know to comment out whole blocks using editor > commands. comment-dwim (usually bound to M-; ) comments out the region if it's active, or, if the region is already c

Restricted Execution on the cheap

2004-11-30 Thread David Pokorny
Hi, Suppose that one wants to set up a machine to accept python code from, say, arbitrary email, and run it safely. Would the following (somewhat draconian) precautions be sufficient? [assume the Python code is in hack.py] grep exechack.py ==> nothing grep evalhack.py ==> nothing etc... f

Re: pyserial with binary data

2004-11-30 Thread Guillaume Weymeskirch
Hi, I've got the same problem. Errno 11 is because too much data, sending is in progress. Fix is easy: assign a non zero value to the writeTimeout property of your serial objet. Then the write method will wait up to this time for sending data. Hope that's help Guillaume -- http://mail.python.o

Re: comment out more than 1 line at once?

2004-11-30 Thread Uwe Grauer
Riko Wichmann wrote: I'm using emacs (with python-mode) to do most of my editing. also tried IDLE from python already, which is nice but an old dog doesn't like to learn new tricks :) Maybe I just don't know to comment out whole blocks using editor commands. Probably the trick Marc mentions in

Problem with tkinter mainloop

2004-11-30 Thread k2riddim
Hello, I'm a beginner with Python and Tkinter development. My application parse links in an html file. And I use Tkinter to implement a GUI. This GUI has a button to launch the parse treatment, and a status bar to show the state of the treatment. I know that because of the mainloop, my tkinter appl

Re: comment out more than 1 line at once?

2004-11-30 Thread Riko Wichmann
I'm using emacs (with python-mode) to do most of my editing. also tried IDLE from python already, which is nice but an old dog doesn't like to learn new tricks :) Maybe I just don't know to comment out whole blocks using editor commands. Probably the trick Marc mentions in the following post wi

Re: Python Design Patterns

2004-11-30 Thread Tony Ha
Hello Dave, Thanks for pointing me to the Cookbook website. Tony Ha. "Dave Cook" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2004-11-29, Tony Ha <[EMAIL PROTECTED]> wrote: > > > I wonder, can any Python guru out there translate the Java examples in the > > Should be a g

Re: pre-PEP generic objects

2004-11-30 Thread Nick Craig-Wood
Steven Bethard <[EMAIL PROTECTED]> wrote: > I promised I'd put together a PEP for a 'generic object' data type for > Python 2.5 that allows one to replace __getitem__ style access with > dotted-attribute style access (without declaring another class). Any > comments would be appreciated! T

Re: Closing files

2004-11-30 Thread Nick Coghlan
Daniel Dittmar wrote: - that suggest a different solution; like declarations on local variables that say "call destructor when object goes out of scope" You may be interested in PEP 310 (reliable acquisition/release pairs): http://www.python.org/peps/pep-0310.html (Although if that idea gets ado

Re: The use of :

2004-11-30 Thread Nick Coghlan
BJörn Lindqvist wrote: Because it contains more non-significant symbols (, ), { and } that "steal" the programmers attention. But consider def f(x, y, z) print x, y, z to def f(x, y, z): print x, y, z IMHO, the colon-less variant is more readable than the one with the colon. Except that i

Re: comment out more than 1 line at once?

2004-11-30 Thread Riko Wichmann
Ha! have just discover C-c # myself (sometimes it helps to actually look at the emacs menus, even if you are used to using the key-bindings :) Better yet works "Meta-;" as Bernhard suggested, because it comments and un-comments marked line! Thanks for all the helpful tips! - Riko Riko,

Re: Problem with tkinter mainloop

2004-11-30 Thread Eric Brunel
k2riddim wrote: Hello, I'm a beginner with Python and Tkinter development. My application parse links in an html file. And I use Tkinter to implement a GUI. This GUI has a button to launch the parse treatment, and a status bar to show the state of the treatment. I know that because of the mainloop,

recombination variations

2004-11-30 Thread David Siedband
The problem I'm solving is to take a sequence like 'ATSGS' and make all the DNA sequences it represents. The A, T, and G are fine but the S represents C or G. I want to take this input: [ [ 'A' ] , [ 'T' ] , [ 'C' , 'G' ], [ 'G' ] , [ 'C' , 'G' ] ] and make the list: [ 'ATCGC' , 'ATCGG' , 'ATG

Re: comment out more than 1 line at once?

2004-11-30 Thread Dave Cook
On 2004-11-30, Uwe Grauer <[EMAIL PROTECTED]> wrote: > if you are using emacs, try C-c # to comment out a block of code. > Unfortunally Uncomment is not bound to a key by default. Uncomment is C-u C-c #, at least in xemacs. Rectangle delete sometimes works in a pinch (C-x r k, once you've marked

Re: documentation for PyArg_ParseTupleAndKeywords

2004-11-30 Thread John Machin
Steven Bethard <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > I'm just starting to play around with the Python source. (Specifically, > I'm looking at adding a key argument to max/min like sorted has.) Can > anyone direct me to the documentation on how > PyArg_ParseTupleAnd

Re: slicing, mapping types, ellipsis etc.

2004-11-30 Thread Nick Coghlan
Jerry Sievers wrote: Fellow Pythonists; I am totally puzzled on the use of slicing on mapping types and It's generally not supported (since slices are designed to work with the numerical indices of a sequence, not the arbitrary keys of a mapping). The results of d.keys(), d.values() & d.items() c

Re: Python on Nokia Phones ?

2004-11-30 Thread Ville Vainio
> "Mark" == Mark Doukidis <[EMAIL PROTECTED]> writes: Mark> An exciting prospect when I first heard of Nokia's proposal. Mark> I thought there would be a few more postings here since the Mark> idea first surfaced around Jan 2004. Do realize that giants like Nokia move slow and ma

Video Catalogue

2004-11-30 Thread Rodney Dangerfield
Greetz! Recently I started creating a CGI application for my gf that she would use for indexing and keeping track of her video collection. I am relatively new to python so I started with the basics. I figured out how to extract the form field values in a script and how to save to a file. My ques

Re: [OT] Re: SysLogHandler is drivin me nuts PEBCAC

2004-11-30 Thread Vinay Sajip
Jan Dries <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Slightly OT, but regarding the title, shouldn't it be PEBKAC, since it's > keyboard and not ceyboard? > PEBCAC: Problem Exists Between Chair And Computer -- http://mail.python.org/mailman/listinfo/python-list

Re: Restricted Execution on the cheap

2004-11-30 Thread Duncan Booth
David Pokorny wrote: > Suppose that one wants to set up a machine to accept python code from, > say, arbitrary email, and run it safely. Would the following > (somewhat draconian) precautions be sufficient? > [assume the Python code is in hack.py] > > grep exechack.py ==> nothing > grep eval

Re: Python Huffman encoding

2004-11-30 Thread Guyon Morée
Wow Paul! thanks a lot for your comments! I learned a lot already only by reading them, I will implement them and see what the speed gains are. Keep an eye on my blog, I will post an update on it soon! thanks, guyon ps. love this group "Paul McGuire" <[EMAIL PROTECTED]> wrote in message > h

Re: [OT] Re: SysLogHandler is drivin me nuts PEBCAC

2004-11-30 Thread Jan Dries
[Jan Dries] > Slightly OT, but regarding the title, shouldn't it be PEBKAC, > since it's > keyboard and not ceyboard? [Vinay Sajip] > PEBCAC: Problem Exists Between Chair And Computer Interesting. I thought it was "Problem Exists Between Keyboard And Chair". But this makes sensee too, of cours

RELEASED Python 2.4 (final)

2004-11-30 Thread Anthony Baxter
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4. Python 2.4 is a final, stable release, and we can recommend that Python users upgrade to this version. Python 2.4 is the result of almost 18 month's worth of work on top of Python

Re: pre-PEP generic objects

2004-11-30 Thread Nick Coghlan
The proposed use cases sound more appropriate for a "named tuple" than any sort of dictionary. (This may have been mentioned in previous discussions. I wasn't keeping track of those, though) Notice that I've used 'fromPairs' rather than 'fromMapping', since consistent order matters for a tuple.

Re: asynchat and threading

2004-11-30 Thread Anthony Baxter
On Mon, 29 Nov 2004 23:24:54 -0500, Caleb Hattingh <[EMAIL PROTECTED]> wrote: > I heartily support something like this, but alas I have not the time to > help out with it. I like the Enthought python distribution because it > installs several packages in one shot. A pity there isn't a similar thi

Re: Class methods in Python/C?

2004-11-30 Thread Nick Coghlan
Craig Ringer wrote: Hi folks I've been doing some looking around, but have been unable to find out how to implement class methods on Python objects written in C. "Why are you using C?" you ask? Yeah, so do I. However, I need to provide bindings for an application that Python is embedded into, and t

Re: UML and OO design tool with Python support

2004-11-30 Thread mep
Any free UML modelling tools that generate python code? -- Best Regards, Wang Kebo http://www.huihoo.org/~mep "Paul McGuire" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I just found out that my favorite UML modeling tool, Enterprise Architect, > has just released a new vers

Re: slicing, mapping types, ellipsis etc.

2004-11-30 Thread Kent Johnson
Nick Coghlan wrote: Jerry Sievers wrote: Fellow Pythonists; I am totally puzzled on the use of slicing on mapping types and It's generally not supported (since slices are designed to work with the numerical indices of a sequence, not the arbitrary keys of a mapping). Section 5.3.3 of the Language

weird behaviour of "0 in [] is False"

2004-11-30 Thread Sylvain Thenault
Hi there ! Can someone explain me the following behaviour ? >>> l = [] >>> 0 in (l is False) Traceback (most recent call last): File "", line 1, in ? TypeError: iterable argument required >>> (0 in l) is False True >>> 0 in l is False False This is really obscur to me... -- Sylvain Thénault

Re: Restricted Execution on the cheap

2004-11-30 Thread Nick Coghlan
David Pokorny wrote: Hi, Suppose that one wants to set up a machine to accept python code from, say, arbitrary email, and run it safely. Would the following (somewhat draconian) precautions be sufficient? In short, no. Python's introspection capabilities kill you. There are too many ways to spell

Re: python API wrapper for C++ API

2004-11-30 Thread Philippe C. Martin
Hi, How about first using a C to C++ wrapper: *** #ifdef __cplusplus extern "C" { /* I really dislike this - iwj. */ #endif void * init (void) { return new myobj() } 3D_fun1 (void * p_obj) { My_OBJ * l_obj = (My_OBJ *)

Re: Python code and C code in the same module?

2004-11-30 Thread Nick Coghlan
Fredrik Lundh wrote: if you insist on doing it the other way around, This paragraph should actually continue ". . .you clearly have too much free time" };> Cheers, Nick. -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 2.4 (final)

2004-11-30 Thread Dave Merrill
Newb question: Is it possible/recommended to have multiple versions of Python installed simultaneously? Earlier, I installed 2.4rc1, and a number of things in my 2.3.3 install stopped working. Are there known techniques for managing multiple versions? Thanks, Dave Merrill -- http://mail.pytho

dynamical linking problem

2004-11-30 Thread wab104
I compiled Python on one Linux box and copied it to another Linux box. This causes an import problem: >>> import urllib Traceback (most recent call last): File "", line 1, in ? File "/edl3/wb104/analysis/python2.2/lib/python2.2/urllib.py", line 26, in ? import socket File "/edl3/wb104/a

Bookmark CGI in Python

2004-11-30 Thread Michael Foord
Anyone written an online bookmarks manager in Python ? I can knock a simple one together... but wondered if anyone else had already done it ? I can't find one with google - but htere are *loads* in perl and PHP, so I suspect thayt someoen must have written one witrh python. One that uses XBEL woul

Re: weird behaviour of "0 in [] is False"

2004-11-30 Thread Diez B. Roggisch
l = [] 0 in (l is False) > Traceback (most recent call last): > File "", line 1, in ? > TypeError: iterable argument required that should be clear - 0 in False can't work. (0 in l) is False > True 0 in l is False > False It seems to stem from a behaviour python exhibits in

Syntax for extracting multiple items from a dictionary

2004-11-30 Thread shark
row = {"fname" : "Frank", "lname" : "Jones", "city" : "Hoboken", "state" : "Alaska"} cols = ("city", "state") Is there a best-practices way to ask for an object containing only the keys named in cols out of row? In other words, to get this: {"city" : "Hoboken", "state" : "Alaska"} Thanks, shark

Re: recombination variations

2004-11-30 Thread Dennis Benzinger
David Siedband wrote: > [...] > Is there a better way to do this? > [...] Take a look at Biopython: http://biopython.org/ Your problem may be solved there already. -- http://mail.python.org/mailman/listinfo/python-list

Re: weird behaviour of "0 in [] is False"

2004-11-30 Thread Duncan Booth
Sylvain Thenault wrote: > Hi there ! > > Can someone explain me the following behaviour ? > l = [] 0 in (l is False) > Traceback (most recent call last): > File "", line 1, in ? > TypeError: iterable argument required (0 in l) is False > True 0 in l is False > False > > >

Re: RELEASED Python 2.4 (final)

2004-11-30 Thread Stefan Behnel
Dave Merrill schrieb: Newb question: Is it possible/recommended to have multiple versions of Python installed simultaneously? Earlier, I installed 2.4rc1, and a number of things in my 2.3.3 install stopped working. Are there known techniques for managing multiple versions? Short answer: depends on

Re: pdb with emacs

2004-11-30 Thread Heike C. Zimmerer
"Yuri Shtil" <[EMAIL PROTECTED]> writes: > I am trying to learn python and use the gud/pdb from emacs. The > functionality that I am used to under gud/gdb and gud/perldb is missing, or > I don't know how to make it work. > Specifically: when I start pdb on a script file, the source does not show i

Re: MySQLdb problem with mod_python, please help

2004-11-30 Thread Damjan
> MySQLdb is working fine at command line, however when I tried to use > it with mod_python, it give me a "server not initialized" error. Maybe its this problem? http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp -- damjan -- http://mail.python.org/mailman/listinfo/python-list

Re: weird behaviour of "0 in [] is False"

2004-11-30 Thread Sylvain Thenault
On Tue, 30 Nov 2004 14:18:30 +0100, Diez B. Roggisch wrote: > l = [] > 0 in (l is False) >> Traceback (most recent call last): >> File "", line 1, in ? >> TypeError: iterable argument required > > that should be clear - 0 in False can't work. yes, I forget to mention that it was the th

Re: comment out more than 1 line at once?

2004-11-30 Thread Roy Smith
Riko Wichmann <[EMAIL PROTECTED]> wrote: > I'm using emacs (with python-mode) to do most of my editing. also tried > IDLE from python already, which is nice but an old dog doesn't like to > learn new tricks :) Emacs is great for stuff like this. There's probably other ways to do it, but what I

Re: RELEASED Python 2.4 (final)

2004-11-30 Thread Anthony Baxter
On Tue, 30 Nov 2004 08:05:55 -0500, Dave Merrill <[EMAIL PROTECTED]> wrote: > Newb question: Is it possible/recommended to have multiple versions of > Python installed simultaneously? Earlier, I installed 2.4rc1, and a number > of things in my 2.3.3 install stopped working. Are there known techniq

Re: Class methods in Python/C?

2004-11-30 Thread Jp Calderone
On Tue, 30 Nov 2004 22:39:15 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >Craig Ringer wrote: > > Hi folks > > > > I've been doing some looking around, but have been unable to find out > > how to implement class methods on Python objects written in C. "Why are > > you using C?" you ask? > > >

Re: RELEASED Python 2.4 (final)

2004-11-30 Thread Dave Merrill
Should have been more specific. As I recall, after I installed 2.4rc1 I installed the latest versions of wxWindows and SPE IDE into it. The 2.4 copy of SPE died silently when started, which I can accept as a incompatible versions. What was strange to me was that at that point, the 2.3.3 copy of S

Re: RELEASED Python 2.4 (final)

2004-11-30 Thread Anthony Baxter
On Tue, 30 Nov 2004 08:53:25 -0500, Dave Merrill <[EMAIL PROTECTED]> wrote: > Should have been more specific. > > As I recall, after I installed 2.4rc1 I installed the latest versions of > wxWindows and SPE IDE into it. The 2.4 copy of SPE died silently when > started, which I can accept as a inco

Re: slicing, mapping types, ellipsis etc.

2004-11-30 Thread Nick Coghlan
Kent Johnson wrote: Maybe instead of referring to mappings it should say "The primary must implement __getitem__(), which is called with a value that is constructed from the slice list, as follows." In the section you mention, 'mapping' is equivalent to 'has __getitem__ defined', and I'd be surp

Re: RELEASED Python 2.4 (final)

2004-11-30 Thread Dave Merrill
Used the packaged Windows (win2k) installs of Python and all components I described. Not a C guy, no compiler, minimal knowledge about them. Dave Merrill "Anthony Baxter" wrote: > > Newb question: Is it possible/recommended to have multiple versions of > > Python installed simultaneously? Earlie

Re: comment out more than 1 line at once?

2004-11-30 Thread Jerry Sievers
Uwe Grauer <[EMAIL PROTECTED]> writes: > Riko, > > if you are using emacs, try C-c # to comment out a block of code. > Unfortunally Uncomment is not bound to a key by default. > Do a key-binding for it by yourself. In Emacs, you can have the comment-region command do uncomment by typing C-u firs

private attributes in __slots__ and pickle

2004-11-30 Thread i_hate
Hello, I've just discovered the hard way that classes declaring private variables (beginning with two underscore) can not be pickled ; double underscored attributes are just not returned by __reduce__. That's very annoying. Objects should be serializable transparently so why such obstacles ? --

Re: private attributes in __slots__ and pickle

2004-11-30 Thread i_hate
[EMAIL PROTECTED] wrote: > Hello, > I've just discovered the hard way that classes declaring private variables > (beginning with two underscore) can not be pickled ; double underscored I meant "declaring private attributes in __slots__" ; sorry. > attributes are just not returned by __reduce__.

Re: Syntax for extracting multiple items from a dictionary

2004-11-30 Thread Leif K-Brooks
shark wrote: row = {"fname" : "Frank", "lname" : "Jones", "city" : "Hoboken", "state" : "Alaska"} cols = ("city", "state") Is there a best-practices way to ask for an object containing only the keys named in cols out of row? In other words, to get this: {"city" : "Hoboken", "state" : "Alaska"} Why

Re: Syntax for extracting multiple items from a dictionary

2004-11-30 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "shark" <[EMAIL PROTECTED]> wrote: > row = {"fname" : "Frank", "lname" : "Jones", "city" : "Hoboken", "state" : > "Alaska"} > cols = ("city", "state") > > Is there a best-practices way to ask for an object containing only the keys > named in cols out of row? In ot

Re[2]: weird behaviour of "0 in [] is False"

2004-11-30 Thread Laszlo Zsolt Nagy
>> (0 in l) is False >>> True This gives me the same exception. >>> 0 in 1 Traceback (most recent call last): File "", line 1, in ? TypeError: iterable argument required Did you really try these examples? Best, Laci mailto:[EMAIL PROTECTED] web:http://designasign.biz -- http://ma

Re[3]: weird behaviour of "0 in [] is False"

2004-11-30 Thread Laszlo Zsolt Nagy
Tuesday, November 30, 2004, 3:15:27 PM, you wrote: >>> (0 in l) is False True > This gives me the same exception. 0 in 1 > Traceback (most recent call last): > File "", line 1, in ? > TypeError: iterable argument required Sorry, It was 0 in l, not 0 in 1. :-) My fault. > Best,

Re: Syntax for extracting multiple items from a dictionary

2004-11-30 Thread Stefan Behnel
shark schrieb: row = {"fname" : "Frank", "lname" : "Jones", "city" : "Hoboken", "state" : "Alaska"} cols = ("city", "state") Is there a best-practices way to ask for an object containing only the keys named in cols out of row? In other words, to get this: {"city" : "Hoboken", "state" : "Alaska"} U

Re: Re[2]: weird behaviour of "0 in [] is False"

2004-11-30 Thread Richard Brodie
"Laszlo Zsolt Nagy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Did you really try these examples? >>> l is 1 False -- http://mail.python.org/mailman/listinfo/python-list

Re: slicing, mapping types, ellipsis etc.

2004-11-30 Thread Kent Johnson
Nick Coghlan wrote: Kent Johnson wrote: Maybe instead of referring to mappings it should say "The primary must implement __getitem__(), which is called with a value that is constructed from the slice list, as follows." In the section you mention, 'mapping' is equivalent to 'has __getitem__ defi

Re: pre-PEP generic objects

2004-11-30 Thread Carlos Ribeiro
On Tue, 30 Nov 2004 22:30:21 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: > The proposed use cases sound more appropriate for a "named tuple" than any > sort > of dictionary. (This may have been mentioned in previous discussions. I wasn't > keeping track of those, though) I agree with it. I was

Re: py.test anyone?

2004-11-30 Thread holger krekel
Hi Stephen, [Stephen Boulet Mon, Nov 22, 2004 at 11:14:57AM -0600] > Have people been using py.test? I was hoping to try it out but was > running into subversion problems (behind a corporate firewall, though > there is a windows registry hack for that which didn't work for me). you may try to

Re: Problem with tkinter mainloop

2004-11-30 Thread k2riddim
Many thanks, You're right this wasn't my code, this was just what I can remember, because my application is at home, and I'm at work. Be sure I'll follow your advices concerning posting rules in this group ! Eric Brunel <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > k2riddim wr

Re: ANNOUNCE: Ice 2.0 released

2004-11-30 Thread Anand Hariharan
Marc Laukien <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > I'm sure this is a wonderful thing, but your announcement gives absolutely > > no clue as to what Ice is or what it is used for. > > > > Please include an executive summary when you make an announcement like > > this

Re: Protecting Python source

2004-11-30 Thread Gustavo Córdova Avila
Peter Maas wrote: Grant Edwards schrieb: On 2004-11-29, Peter Maas <[EMAIL PROTECTED]> wrote: If the "reverse engineering" argument boils down to "protecting source doesn't make sense" then why does Microsoft try so hard to protect its sources? To avoid embarassment. :) This cannot be the whole tr

Re: comment out more than 1 line at once?

2004-11-30 Thread Gustavo Córdova Avila
Riko Wichmann wrote: Dear all, is there a way in Python to comment out blocks of code without putting a # in front of each line? Somethings like C's /* block of code here is commented out */ Thanks, Riko I haven't seen the "other" way to block-comment multiple lines of code: triple-quoted

From xemacs-beta mailing list

2004-11-30 Thread Skip Montanaro
Stephen Turnbull had this to say to a correspondent on the xemacs-beta mailing list this morning. I think it would be just as accurate if you replaced "XEmacs" with "Python". Many of the things you request are prima facie reasonable, and we'll certainly consider them in the light of what

Re: Numeric: 'where' function conditions

2004-11-30 Thread Jorl Shefner
In article <[EMAIL PROTECTED]>, Robert Kern <[EMAIL PROTECTED]> wrote: > > Right. "3 < data" creates an array of 0s and 1s where the condition is > false and true, respectively. You don't need where() at all. > > Try > > mask = logical_and(3 < data, data <= 7) Great. That's exactly what I n

Re: RELEASED Python 2.4 (final)

2004-11-30 Thread Harry George
"Dave Merrill" <[EMAIL PROTECTED]> writes: > Newb question: Is it possible/recommended to have multiple versions of > Python installed simultaneously? Earlier, I installed 2.4rc1, and a number > of things in my 2.3.3 install stopped working. Are there known techniques > for managing multiple vers

SOAPpy/ZSI/Twisted SOAP over stdin/stdout?

2004-11-30 Thread Harry George
Normally the SOAP Servers are designed to take control of a port and run their own sockets via inheritance from SocktServer. But under inetd and xinetd, the port is controlled elsewhere and the service just gets the stdin/stdout. I need to configure (or tweak) one of the SOAP servers to use that c

Re: Question on sorting

2004-11-30 Thread Eddie Corns
wes weston <[EMAIL PROTECTED]> writes: >Lad wrote: >> Hi, >> I have a file of records of 4 fields each. >> Each field is separated by a semicolon. That is >> >> Filed1;Ffield2;Field3;Field4 >> >> But there may be also empty records such as >> >> (only semicolons). >> >> For sorting I used

Re: weird behaviour of "0 in [] is False"

2004-11-30 Thread Paul Robson
Sylvain Thenault wrote: l = [] 0 in (l is False) (l is False) is not a tuple or list, it's a boolean value. > Traceback (most recent call last): > File "", line 1, in ? > TypeError: iterable argument required (0 in l) is False > True 0 in l is False becuase l is empty, so it's Fa

RE: python API wrapper for C++ API

2004-11-30 Thread Mark Doberenz
Thanks Josiah and everyone else who's replied to this already. I'm taking a look at the web site Fredrik posted and I think it's going to help me a lot. I think I only need to be able to call C++ from Python. The main thing I'm confused about is how to make it so the Python program will directly

Struggling with struct.unpack() and "p" format specifier

2004-11-30 Thread Geoffrey
Hope someone can help. I am trying to read data from a file binary file and then unpack the data into python variables. Some of the data is store like this; xbuffer: '\x00\x00\xb9\x02\x13EXCLUDE_CREDIT_CARD' # the above was printed using repr(xbuffer). # Note that int(0x13) = 19 which is exactl

Re: SOAPpy/ZSI/Twisted SOAP over stdin/stdout?

2004-11-30 Thread Jp Calderone
On Tue, 30 Nov 2004 14:25:50 GMT, Harry George <[EMAIL PROTECTED]> wrote: >Normally the SOAP Servers are designed to take control of a port and > run their own sockets via inheritance from SocktServer. > > But under inetd and xinetd, the port is controlled elsewhere and the > service just gets the

module imports and memory usage

2004-11-30 Thread Brad Tilley
When memory usage is a concern, is it better to do: from X import Y or import X Also, is there a way to load and unload modules as they are needed. I have some scripts that sleep for extended periods during a while loop and I need to be as memory friendly as possible. I can post a detailed scrip

Re: Protecting Python source

2004-11-30 Thread Peter Hansen
Gustavo CÃrdova Avila wrote: Peter Maas wrote: Grant Edwards schrieb: On 2004-11-29, Peter Maas <[EMAIL PROTECTED]> wrote: If the "reverse engineering" argument boils down to "protecting source doesn't make sense" then why does Microsoft try so hard to protect its sources? To avoid embarassment.

Re: Get Special Folders (ie Desktop location)

2004-11-30 Thread Peter Hansen
Colin Steadman wrote: I'm just starting out writing Python scripts (in PSP), and need to find the location of Windows special folders such as 'My Documents' and 'Desktop' so that I can save files in the right place. Is there any method I can use in Python to get these? If I were doing this in VBSc

  1   2   3   >