[perl-python] 20050120 find functions in modules

2005-01-19 Thread Xah Lee
© # -*- coding: utf-8 -*- © # Python © © # once a module is loaded © # import mymodule © # one can find all the names it © # export with dir() © © import sys © print dir(sys) © © # without argument it gives the names © # you've defined © print dir() © © # to find a list of built-in names © # import

Re: delay and force in Python

2005-01-19 Thread Bengt Richter
On Wed, 19 Jan 2005 23:53:28 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: [...] >> Something else: this crashes with a "maximum recursion reached" >> . print stream_enumerate_interval(1,998) >> >> while this does not crash >> . print stream_enumerate_interval(1,900) >> this means Python has a ma

Re: iteritems() and enumerate()

2005-01-19 Thread Fredrik Lundh
Xah Lee wrote: > Python has iteritems() and enumerate() to be used in for loops. > > can anyone tell me what these are by themselves, if anything? iteritems() is a dictionary method, which returns a lazily constructed sequence of all (key, value) pairs in the dictionary. enumerate(seq) is a func

Re: iteritems() and enumerate()

2005-01-19 Thread Erik Max Francis
Xah Lee wrote: Python has iteritems() and enumerate() to be used in for loops. can anyone tell me what these are by themselves, if anything? are they just for idiom? thanks. You would be funnier if you weren't so incompetent. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ S

Re: Zen of Python

2005-01-19 Thread Fredrik Lundh
Timothy Fitz wrote: > While I agree that the Zen of Python is an amazingly concise list of > truisms, I do not see any meaning in: > > Flat is better than nested. Python's not Pascal. -- http://mail.python.org/mailman/listinfo/python-list

iteritems() and enumerate()

2005-01-19 Thread Xah Lee
Python has iteritems() and enumerate() to be used in for loops. can anyone tell me what these are by themselves, if anything? are they just for idiom? thanks. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree cannot parse UTF-8 Unicode?

2005-01-19 Thread Fredrik Lundh
Erik Bethke wrote: > 2) You are right in that the print of the file read works just fine. but what does it look like? I saved a raw copy of your original mail, fixed the quoted-printable encoding, and got an UTF-8 encoded file that works just fine. the thing you've been parsing, and that you've

Re: Solutions for data storage?

2005-01-19 Thread Leif K-Brooks
Robert Brewer wrote: Try svn://casadeamor.com/dejavu/trunk if you want a truly Pythonic query syntax. Wait a couple of days, and I'll have version 1.3 ready and online at http://www.aminus.org/rbre/python -- lots of changes from 1.2.6 which is there now, but at least you can read old docs online no

Re: Zen of Python

2005-01-19 Thread Jan Dries
Luke Skywalker <[EMAIL PROTECTED]> schreef: > On Wed, 19 Jan 2005 14:13:47 -0500, Timothy Fitz > > While I agree that the Zen of Python is an amazingly concise list > > of truisms, I do not see any meaning in: > > For those interested, here's the list: > http://www.python.org/doc/Humor.html#zen

Re: rotor replacement

2005-01-19 Thread Paul Rubin
[EMAIL PROTECTED] (Bengt Richter) writes: > Isn't the SSL dependent on OS or at least shared lib support? Firefox has its own implementation. IE uses wininet which is built Windows. I'm not aware of any no-crypto version of Windows but even if there is one, the US version is running, like, every

Re: Zen of Python

2005-01-19 Thread Luke Skywalker
On Wed, 19 Jan 2005 14:13:47 -0500, Timothy Fitz <[EMAIL PROTECTED]> wrote: >While I agree that the Zen of Python is an amazingly concise list of >truisms, I do not see any meaning in: (snip) For those interested, here's the list: http://www.python.org/doc/Humor.html#zen Luke. -- http://mail.py

Re: rotor replacement

2005-01-19 Thread Bengt Richter
On 19 Jan 2005 17:09:19 -0800, Paul Rubin wrote: >Robin Becker <[EMAIL PROTECTED]> writes: >> > Presumably he is talking about crypo-export rules. In the past strong >> > cryptography has been treated as munitions, and as such exporting it >> > (especially from the USA)

Re: list item's position

2005-01-19 Thread John Machin
On Wed, 19 Jan 2005 22:02:51 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote: > >See Mark's post, if you "need to know the index of something" this is >the perfect case for enumerate (assuming you have at least Python 2.3): But the OP (despite what he says) _doesn't_ need to know the index of th

Re: list item's position

2005-01-19 Thread Stephen Thorne
On Wed, 19 Jan 2005 22:04:44 -0500, Bob Smith <[EMAIL PROTECTED]> wrote: > Hi, > > I have a Python list. I can't figure out how to find an element's > numeric value (0,1,2,3...) in the list. Here's an example of what I'm doing: > > for bar in bars: > if 'str_1' in bar and 'str_2' in bar: >

Re: FTPLIB & FTPS or SFTP?

2005-01-19 Thread Roger Binns
"Peter A. Schott" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > have a handful of partners who use FTPS or SFTP and I need to pull/push files > to/from them. For SFTP, run don't walk, over to http://www.lag.net/paramiko/ Paramiko is a pure Python(*) implementation of SSH and all

Re: Zen of Python

2005-01-19 Thread Paul Rubin
Tim Peters <[EMAIL PROTECTED]> writes: > > Huh? [1,2,[3,4,5],[6,7]],8 is a perfectly valid Python list. > > You're claiming not to know any relevant difference between Python > lists and Lisp lists? Heh. Python doesn't provide syntactic sugar for [1,[2,[3,[4,[] if that's what you me

Re: list item's position

2005-01-19 Thread Steven Bethard
Bill Mill wrote: 2 solutions: In [98]: bars = ["str", "foobaz", "barbaz", "foobar"] In [99]: for bar in bars: : if 'bar' in bar and 'baz' in bar: : print bar : print bars.index(bar) : barbaz 2 In [100]: for i in range(len(bars)): .: if 'bar

Re: Zen of Python

2005-01-19 Thread Tim Peters
[Paul Rubin] > Huh? [1,2,[3,4,5],[6,7]],8 is a perfectly valid Python list. You're claiming not to know any relevant difference between Python lists and Lisp lists? Heh. > And you can break out of a containing loop from a nested loop > with try/raise. Heh heh. Yes, you can. I've neve

Re: Zen of Python

2005-01-19 Thread Paul Rubin
Tim Peters <[EMAIL PROTECTED]> writes: > Python's basic list type is a flat vector instead of a > recursively-defined S-expression, and that there's no direct way to > break out of a containing loop from a nested loop. Huh? [1,2,[3,4,5],[6,7]],8 is a perfectly valid Python list. And you c

Re: FTPLIB & FTPS or SFTP?

2005-01-19 Thread srijit
To the best of my knowledge ftplib does not support SFTP or FTPS. I hope Paramiko (http://www.lag.net/paramiko/) serves your purpose. Paramiko supports POSIX, Windows and MacOSX Regards, /Srijit Peter A. Schott wrote: > Does the ftplib support SFTP or FTPS? Is that part of a different module? W

Re: Zen of Python

2005-01-19 Thread Tim Peters
[Carl Banks] >> The gist of "Flat is better than nested" is "be as nested as >> you have to be, no more," because being too nested is just a >> mess. [Timothy Fitz] > Which I agree with, and which makes sense. However your > "gist" is a different meaning. It's not that "Flat is better than > neste

Re: list item's position

2005-01-19 Thread Sean
Not sure if this is what you are looking for but... >>> li = ['this','is','a','list','of','strings'] >>> li = [l for l in li if li.index(l) >= li.index('a')] >>> li ['a', 'list', 'of', 'strings'] >>> -- Sean Berry ~ Internet Systems Programmer BuildingOnline Inc. The Building Industry's Web De

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread Craig Ringer
On Wed, 2005-01-19 at 09:04 -0800, [EMAIL PROTECTED] wrote: > Rick Muller wrote: > >I was wondering whether anyone could recommend a good C++ book, with > >"good" being defined from the perspective of a Python programmer. > > The STL and the template feature of C++ gives the programmer some of > t

Re: Automatic Windows printer creation?

2005-01-19 Thread Roger Upole
You can probably do it through WMI. (class is Win32_Printer) WMI works well with win32com, and there's also a wrapper module http://tgolden.sc.sabren.com/python/wmi.html for simplified access. I imagine getting all the device parameters and port configuration right will be messy, though.

Re: python/cgi/html bug

2005-01-19 Thread Dfenestr8
On Wed, 19 Jan 2005 12:15:18 -0800, Paul Rubin wrote: > Dfenestr8 <[EMAIL PROTECTED]> writes: >> No glaring security holes that you noticed? Other than being able to >> hide things in html tags? > > Looks like you can also embed arbitrary javascript (I just tried it). I > haven't looked at the sc

Re: list item's position

2005-01-19 Thread Bill Mill
2 solutions: In [98]: bars = ["str", "foobaz", "barbaz", "foobar"] In [99]: for bar in bars: : if 'bar' in bar and 'baz' in bar: : print bar : print bars.index(bar) : barbaz 2 In [100]: for i in range(len(bars)): .: if 'bar' in bars[i] a

Re: list item's position

2005-01-19 Thread Mark McEahern
Bob Smith wrote: Hi, I have a Python list. I can't figure out how to find an element's numeric value (0,1,2,3...) in the list. Here's an example of what I'm doing: Use enumerate() (new in Python 2.3, IIRC). Otherwise: for i in range(len(sequence)): item = sequence[i] ... for bar in bars:

Pyzine #6 MIDI article

2005-01-19 Thread spiffy
Would anyone here who has the Python and MIDI article from Pyzine #6 be willing to share it with me? -- http://mail.python.org/mailman/listinfo/python-list

list item's position

2005-01-19 Thread Bob Smith
Hi, I have a Python list. I can't figure out how to find an element's numeric value (0,1,2,3...) in the list. Here's an example of what I'm doing: for bar in bars: if 'str_1' in bar and 'str_2' in bar: print bar This finds the right bar, but not its list position. The reason I need to f

Re: Zen of Python

2005-01-19 Thread Jack Diederich
On Wed, Jan 19, 2005 at 09:28:13PM -0500, Peter Hansen wrote: > Jeff Shannon wrote: > >Timothy Fitz wrote: > >>Which I agree with, and which makes sense. However your "gist" is a > >>different meaning. It's not that "Flat is better than nested" it's > >>that "Too flat is bad and too flat is nested

Re: safest way to kill a thread

2005-01-19 Thread martinnitram
Thank for all helping and sorry that i overlooked the previous message. Peter Hansen wrote: > [EMAIL PROTECTED] wrote: > > Should the 'daemonic' flag at setDaemon() function set to 1/TRUE or > > 0/FALSE to do such action? > > First of all, it's "True" and "False" in Python, not TRUE > and FALSE. >

Re: Zen of Python

2005-01-19 Thread Peter Hansen
Jeff Shannon wrote: Timothy Fitz wrote: Which I agree with, and which makes sense. However your "gist" is a different meaning. It's not that "Flat is better than nested" it's that "Too flat is bad and too flat is nested so be as nested (or as flat) as you have to be and no more." Perhaps Tim Peters

Re: Python and Excel

2005-01-19 Thread Charlie Taylor
If it helps, I started a similar project a few years ago on SourceForge when I was just learning python called python2xlw. I haven't supported it for quite a while, however, I still use it a lot in my own work. I needed to create Excel files with scatter charts in them for a web interface so

Re: Zen of Python

2005-01-19 Thread Jeff Shannon
Timothy Fitz wrote: On 19 Jan 2005 15:24:10 -0800, Carl Banks <[EMAIL PROTECTED]> wrote: The gist of "Flat is better than nested" is "be as nested as you have to be, no more," because being too nested is just a mess. Which I agree with, and which makes sense. However your "gist" is a different mean

Re: ElementTree cannot parse UTF-8 Unicode?

2005-01-19 Thread Jeremy Bowers
On Wed, 19 Jan 2005 16:35:23 -0800, Erik Bethke wrote: > So it seems to me, that ElementTree is just not expecting to run into the > Korean characters for it is at column 16 that these begin. Am I > formatting the XML properly? You should post the file somewhere on the web. (I wouldn't expect Us

Re: rotor replacement

2005-01-19 Thread Paul Rubin
Robin Becker <[EMAIL PROTECTED]> writes: > > Presumably he is talking about crypo-export rules. In the past strong > > cryptography has been treated as munitions, and as such exporting it > > (especially from the USA) could have got you into very serious > > trouble. > > well since rotor is a ger

Re: Zen of Python

2005-01-19 Thread Carl Banks
Timothy Fitz wrote: > On 19 Jan 2005 15:24:10 -0800, Carl Banks <[EMAIL PROTECTED]> wrote: > > The gist of "Flat is better than nested" is "be as nested as you have > > to be, no more," because being too nested is just a mess. > > Which I agree with, and which makes sense. However your "gist" is a

Re: Zen of Python

2005-01-19 Thread Robert Kern
Timothy Fitz wrote: On 19 Jan 2005 15:24:10 -0800, Carl Banks <[EMAIL PROTECTED]> wrote: The gist of "Flat is better than nested" is "be as nested as you have to be, no more," because being too nested is just a mess. Which I agree with, and which makes sense. However your "gist" is a different mea

Re: Zen of Python

2005-01-19 Thread Carl Banks
Timothy Fitz wrote: > While I agree that the Zen of Python is an amazingly concise list of > truisms, I do not see any meaning in: > > Flat is better than nested. > > I strive for balance between flat and nested. Does anyone have a good > example of where this is applied? (specifically to python,

Re: Zen of Python

2005-01-19 Thread Timothy Fitz
On 19 Jan 2005 15:24:10 -0800, Carl Banks <[EMAIL PROTECTED]> wrote: > The gist of "Flat is better than nested" is "be as nested as you have > to be, no more," because being too nested is just a mess. Which I agree with, and which makes sense. However your "gist" is a different meaning. It's not t

Re: ElementTree cannot parse UTF-8 Unicode?

2005-01-19 Thread Erik Bethke
Hello Fredrik, 1) The exact error is in line 1160 of self._parser.Parse(data, 0 ): xml.parsers.expat.ExpatError: not well-formed (invalid token): line 3, column 16 2) You are right in that the print of the file read works just fine. 3) You are also right in that the digitally encoded unicode als

Re: rotor replacement

2005-01-19 Thread Robin Becker
Robin Becker wrote: Presumably he is talking about crypo-export rules. In the past strong cryptography has been treated as munitions, and as such exporting it (especially from the USA) could have got you into very serious trouble. So Python is an American Language and must obey American Law. Luck

Re: getting a class attribute using a keyword argument

2005-01-19 Thread John Hsu
Guy Robinson wrote: Hello, I have a list of class instances. I wish to get the appropriate class attribute in each class instance depending on a SINGLE keyword in the calling class. How do I get the calling method to correctly recognise the keyword as a keyword and not a class attribute? See ex

Re: rotor replacement

2005-01-19 Thread Robin Becker
Nick Craig-Wood wrote: Robin Becker <[EMAIL PROTECTED]> wrote: Paul Rubin wrote: "Reed L. O'Brien" <[EMAIL PROTECTED]> writes: I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike bu

Re: Python and Excel

2005-01-19 Thread howardrh
Please consider this reply as one vote for posting your python Excel interface/software on the Vaults of Pamassus Web Site. Located at http://www.vex.net/parnassus/ -- http://mail.python.org/mailman/listinfo/python-list

Re: xml parsing escape characters

2005-01-19 Thread "Martin v. Löwis"
Luis P. Mendes wrote: I get the following result: http://www..";> ~ Most likely, this result is correct, and your document really does contain I don't get any elements. But, if I access the same url via a browser, the result in the browser window is something like

Re: Python and Excel

2005-01-19 Thread Simon John
Hmm, sounds interesting, I've always resorted to using CSV (or even HTML!) when exporting to Excel. As far as how to open it up, have a look at creating a project on www.sourceforge.net or just zip it up and bung it on your own website if you have one. I've got the feeling there are also Python-sp

Re: Zen of Python

2005-01-19 Thread Carl Banks
Skip Montanaro wrote: > Bill> The example that occurs to me is that "import smtplib" is better > Bill> than "import stdlib.inet.services.smtp". > > Sure. There is a balance to be achieved however. "import std.smtplib" > might be better than "import smtplib", simply because making the standar

Re: a question

2005-01-19 Thread Will Stuyvesant
Andrew Koenig wrote: > how about writing this instead? > > ('this is a ' > 'long string') Yes, nice. And to make that possible we have to write ('one-string-item',) instead of ('one-string-item') if we want a tuple with one string inside. Sometimes that feels like a wart to me, but now

Re: python/cgi/html bug

2005-01-19 Thread Paul Rubin
Dfenestr8 <[EMAIL PROTECTED]> writes: > No glaring security holes that you noticed? Other than being able to hide > things in html tags? Looks like you can also embed arbitrary javascript (I just tried it). I haven't looked at the script itself yet. -- http://mail.python.org/mailman/listinfo/pyth

Re: delay and force in Python

2005-01-19 Thread infidel
It took me a while to figure out what the "translated" code was trying to do. Here's a quick example that I think accomplishes the same thing: >>> for i, n in enumerate(x for x in xrange(998) if x % 2 == 0): ... if i == 1: ... print n ... 2 -- http://mail.python.org

xml parsing escape characters

2005-01-19 Thread Luis P. Mendes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I only know a little bit of xml and I'm trying to parse a xml document in order to save its elements in a file (dictionaries inside a list). When I access a url from python 2.3.3 running in Linux with the following lines: resposta = urllib.u

shelve to DB conversion?

2005-01-19 Thread Aahz
I'd like to hear some experiences about converting a shelf with pickles to database with pickles, particularly if someone has handy code for proxying shelve code. We're using PostgreSQL if that makes any difference. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "1

Re: rotor replacement

2005-01-19 Thread Paul Rubin
Scott David Daniels <[EMAIL PROTECTED]> writes: > I understand this to be true. Since I am trying to address encryption > in the zipfile module, and I know you actually follow a bit of the > encryption stuff, can you answer a question or two for me? Sure, I can try, so go ahead. There's more cry

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread Scott David Daniels
John Hunter wrote: "Philippe" == Philippe C Martin <[EMAIL PROTECTED]> writes: Philippe> I suggest you google 'C++ tutorial' Regards, Stroustup's "The C++ Programming Language" is the best C++ book I've read. It is at a fairly high level, and I already had read several C++ books before readin

FTPLIB & FTPS or SFTP?

2005-01-19 Thread Peter A.Schott
Does the ftplib support SFTP or FTPS? Is that part of a different module? We have a handful of partners who use FTPS or SFTP and I need to pull/push files to/from them. Thank you for all of your help. -Pete Schott -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread Andrew Koenig
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The 4th edition of the well-known "C++ Primer", with Moo as a new > co-author, will soon be published. It is a > more comprehensive and much longer book. It is also organized more traditionally than "Accelerated C++." "Accelerated C

Re: Dictionary keys (again) (was Re: lambda)

2005-01-19 Thread David Eppstein
In article <[EMAIL PROTECTED]>, Nick Coghlan <[EMAIL PROTECTED]> wrote: > For a 'mutable key' to make sense, the following: > > lst = [] > dct = {l: "Hi!"} > print dct[[]] > print dct[lst] > lst.append(1) > print dct[[1]] > print dct[lst] > > Should print: > Hi > Hi > Hi > Hi Yes, and what sho

Re: Accessing MDB files on Windows

2005-01-19 Thread Jorge Luiz Godoy Filho
Jorge Luiz Godoy Filho, Quarta 19 Janeiro 2005 15:17, wrote: > Hmmm... I see. I'm trying to avoid having to install external modules > at > my client's server. Should I use, given that both DAO and ODBC are > available with the win32all extensions, DAO or ODBC? > > Or would ADO give me so muc

Re: finding/replacing a long binary pattern in a .bin file

2005-01-19 Thread yaipa
John, Thanks for reminding me of the mmap module. The following worked as expected. # import mmap source_data = open("source_file.bin", 'rb').read() search_data = open("search_data.bin", 'rb').read() replace_data = open("replace_data.bin",

Re: Zen of Python

2005-01-19 Thread Steve Holden
Peter Hansen wrote: Timothy Fitz wrote: While I agree that the Zen of Python is an amazingly concise list of truisms, I do not see any meaning in: Flat is better than nested. [incrdeibly secret PSU facts blurted out] And with that out of the way, one is left with "there's a balance along the flat/n

ANN: Free Trac/Subversion hosting at Python-Hosting.com

2005-01-19 Thread Remi Delon
Hello everyone, To celebrate its second anniversary, Python-Hosting.com is happy to announce that it is now offering free Trac/Subversion hosting. This offer is limited to open-source, python projects. Trac and Subversion make a great combination for project management. More information about Tra

Re: Dictionary keys (again) (was Re: lambda)

2005-01-19 Thread Steven Bethard
Nick Coghlan wrote: For a 'mutable key' to make sense, the following: lst = [] dct = {l: "Hi!"} print dct[[]] print dct[lst] lst.append(1) print dct[[1]] print dct[lst] Should print: Hi Hi Hi Hi And here's an implementation that does so: py> class sillydict(dict): ... def __getitem__(self, key)

Re: finding/replacing a long binary pattern in a .bin file

2005-01-19 Thread yaipa
Bengt, Thanks for the input, sorry, your diff threw me the first time I looked at it, but then I went back and tried it later. Yes it works fine and I've tucked it away for later use. For this particular Use Case String.replace seems to get the job done in short order and the tool needs to be ma

Re: finding/replacing a long binary pattern in a .bin file

2005-01-19 Thread yaipa
Thanks Francois, It worked as expected. --- source_data = open("source_data.bin", 'rb').read() search_data = open("search_data.bin", 'rb').read() replace_data = open("replace_data.bin", 'rb').read() outFile = open("

Re: generator expressions: performance anomaly?

2005-01-19 Thread Raymond Hettinger
[Steve Holden] > Since it doesn't yet optimize 2+5 to a constant-folded 7 you should > realize that you are suggesting a large increase in the compiler's > analytical powers. FWIW, limited constant folding is already in CVS for Py2.5. Raymond Hettinger -- http://mail.python.org/mailman/listi

Re: Has apparent 2.4b1 bug been fixed? flatten in Lib\compiler\ast.py overloads 'list' name

2005-01-19 Thread Steve Holden
Larry Bates wrote: You have name clashing between Python's built in list function and the variable called list that you pass into the function. Change the passed in variable name to something else. I believe Bengt was merely seeking confirmation that this was indeed a bug in a distributed library

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > I was wondering whether anyone could recommend a good C++ book, with > "good" being defined from the perspective of a Python programmer. I > realize that there isn't a book titled "C++ for Python Programmers", > but has anyone found one that they th

Re: delay and force in Python

2005-01-19 Thread Will Stuyvesant
Yes you are right, if you just want to carry an expression around then lambda does it; but delay was not intended as a top-level function. Perhaps you think that my silly stream implementation in the original post builds the whole list, but it does not: >>> o = stream_enumerate_interval(11,121)

Re: a question

2005-01-19 Thread Andrew Koenig
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The error you get is NOT a syntax error: > > >>> cmd = '%s format %s \ > ... over %d lines' % ('my', 'string', 2) > >>> cmd > 'my format string over 2 lines' > >>> > > The interpreter is probably complaining because

Re: Dictionary keys (again) (was Re: lambda)

2005-01-19 Thread Steven Bethard
David Eppstein wrote: In article <[EMAIL PROTECTED]>, Nick Coghlan <[EMAIL PROTECTED]> wrote: For a 'mutable key' to make sense, the following: lst = [] dct = {l: "Hi!"} print dct[[]] print dct[lst] lst.append(1) print dct[[1]] print dct[lst] Should print: Hi Hi Hi Hi Yes, and what should the fo

Re: simultaneous multiple requests to very simple database

2005-01-19 Thread Jeremy Sanders
On Tue, 18 Jan 2005 11:26:46 -0500, Eric S. Johansson wrote: > So the solutions that come to mind are some form of dictionary in shared > memory with locking semaphore scoreboard or a multithreaded process > containing a single database (Python native dictionary, metakit, gdbm??) > and have all of

Re: How to fill available screen size then scroll

2005-01-19 Thread Mudcat
bump -- http://mail.python.org/mailman/listinfo/python-list

Re: simultaneous multiple requests to very simple database

2005-01-19 Thread Olaf Zetanien
On Tue, 18 Jan 2005 12:57:21 -0500, Eric S. Johansson <[EMAIL PROTECTED]> wrote: Robert Brewer wrote: Eric S. Johansson wrote: I have an application where I need a very simple database, effectively a very large dictionary. The very large dictionary must be accessed from multiple processes sim

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread Thomas Bartkus
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm picking up C++ again after years of using almost nothing but > Python. I'm frankly enjoying the experience, and it's certainly > deepening my appreciation of Python (which you can read however you > like). > Gad! After Python, how c

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread beliavsky
Rick Muller wrote: >I was wondering whether anyone could recommend a good C++ book, with >"good" being defined from the perspective of a Python programmer. The STL and the template feature of C++ gives the programmer some of the functionality of Python (using templates instead of duck typing, vect

Re: Accessing MDB files on Windows

2005-01-19 Thread Jorge Luiz Godoy Filho
Jorge Luiz Godoy Filho, Quarta 19 Janeiro 2005 14:25, wrote: > Thanks! I'm looking at it. Worked like a charm! And just now I noticed who's the author of the recipe ;-) Thanks! -- Godoy. <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: a question

2005-01-19 Thread Steve Holden
Will Stuyvesant wrote: Andrew Koenig wrote: how about writing this instead? ('this is a ' 'long string') Yes, nice. And to make that possible we have to write ('one-string-item',) instead of ('one-string-item') if we want a tuple with one string inside. Sometimes that feels like a wart to

Re: Solutions for data storage?

2005-01-19 Thread Pat
Posting using Google Groups messed up the formatting of those class definition examples. Assume that they contain the usual indentation of typical class definitions. ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing MDB files on Windows

2005-01-19 Thread Steve Holden
Jorge Luiz Godoy Filho wrote: Larry Bates, Quarta 19 Janeiro 2005 14:01, wrote: I'm assuming the application will be run on Windows. You're right. It will be run on Windows. I discarded some other platform due to the difficulty of supporting this file format. You can use ODBC or DAO. An DAO

Re: Accessing MDB files on Windows

2005-01-19 Thread Jorge Luiz Godoy Filho
Steve Holden, Quarta 19 Janeiro 2005 14:38, wrote: > Note that DAO is a very old library, and nowadays ADO would probably be > the preferred method in the Windows environment (can DAO even *use* > oledb providers?). ADO libraries are available - see > >http://www.markcarter.me.uk/computing/py

Re: python/cgi/html bug

2005-01-19 Thread Dfenestr8
On Wed, 19 Jan 2005 04:32:04 -0800, Fuzzyman wrote: > This looks very good. > I've been looking for a python messageboard CGI for a long time. > Thanx! No glaring security holes that you noticed? Other than being able to hide things in html tags? > If you wanted to add user accounts/login/admi

Re: Solutions for data storage?

2005-01-19 Thread Pat
Leif K-Brooks wrote: > I'm writing a relatively simple multi-user public Web application with > Python. It's a rewrite of a similar application which used PHP+MySQL > (not particularly clean code, either). My opinions on various Web > frameworks tends to vary with the phase of the moon, but current

Re: a question

2005-01-19 Thread Steve Holden
Nader Emami wrote: L.S., I have a long command in Unix and I have to use os.system(cmd) statement. I do the following: cmd = '%s/mos user wmarch, cd /fa/wm/%s/%s, mkdir %s, put %s, chmod 644 %s' % (mosbin, jaar, filetype, filetype) status = os.system(cmd) This is not very clear, and I have

Re: Accessing MDB files on Windows

2005-01-19 Thread Larry Bates
I'm assuming the application will be run on Windows. You can use ODBC or DAO. An DAO solution that I wrote (and use) can be found at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303349 For ODBC you would just use the standard library module. Larry Bates Syscon, Inc. Jorge Luiz Godoy Fil

[ANN] XPN - X Python Newsreader 0.4.0 released

2005-01-19 Thread Nemesis
XPN is a multiplatform newsreader written in Python+GTK2. It is unicode compliant and has features like scoring/action rules, configurable attribution lines and random taglines, search facilities and filtered views, import/export newsrc ... You can find it on: http://xpn.altervista.org/index-en.h

Re: delay and force in Python

2005-01-19 Thread Dave Benjamin
Will Stuyvesant wrote: . def delay(exp): return lambda: exp If you look at the definition of "delay" in SICP, you'll notice that it's defined as "syntax sugar", in other words, a macro. Since Python does not have macros, you'll have to just use "lambda", because by defining "delay" as a function

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread John Hunter
> "Philippe" == Philippe C Martin <[EMAIL PROTECTED]> writes: Philippe> I suggest you google 'C++ tutorial' Regards, Stroustup's "The C++ Programming Language" is the best C++ book I've read. It is at a fairly high level, and I already had read several C++ books before reading it, so it

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread Philippe C. Martin
I suggest you google 'C++ tutorial' Regards, Philippe On Wed, 19 Jan 2005 04:08:16 -0800, [EMAIL PROTECTED] wrote: > I'm picking up C++ again after years of using almost nothing but > Python. I'm frankly enjoying the experience, and it's certainly > deepening my appreciation of Python (which

Re: simultaneous multiple requests to very simple database

2005-01-19 Thread Tim Jarman
Olaf Zetanien wrote: > > Use Firebird as sql backend. Is designed as you request (readers not lock > writers and writers not lock readers). Google for "firebird optimistic > lock". > > Off course, you have python driver: http://kinterbasdb.sf.net and can > deploy on windows and linux with a ver

Re: generator expressions: performance anomaly?

2005-01-19 Thread Antoon Pardon
Op 2005-01-19, Steve Holden schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: > >> Op 2005-01-18, Steve Holden schreef <[EMAIL PROTECTED]>: > [...] >> >> But you do have a point that I have a tendency to put salt on >> any snail. I'll try to restrain myself a bit more in the future. >> > Finall

RE: RuntimeError: dictionary changed size during iteration

2005-01-19 Thread Robert Brewer
Roman Suzi wrote: > I think, the behaviour below is misfeature: > > >>> [e for e in vars()] > Traceback (most recent call last): > File "", line 1, in ? > RuntimeError: dictionary changed size during iteration > >>> e = None > >>> [e for e in vars()] > ['e', '__builtins__', 'rlcompleter', '__fil

RE: Accessing MDB files on Windows

2005-01-19 Thread Robert Brewer
Jorge Luiz Godoy Filho wrote: > What is the best way to deal with MDB files? I was thinking on using > ODBC... I'll need to read and write some information to it. The load > won't be so high, but there might be a lot of data. > > Any advices? Will my approach work? I'm not a Windows guy... :

Re: Zen of Python

2005-01-19 Thread Mark McEahern
Timothy Fitz wrote: While I agree that the Zen of Python is an amazingly concise list of truisms, I do not see any meaning in: Flat is better than nested. I strive for balance between flat and nested. Does anyone have a good example of where this is applied? (specifically to python, or in general)

Re: a question

2005-01-19 Thread Bill Mill
You are correct, sir. Didn't know you could do that. Neato. Peace Bill Mill bill.mill at gmail.com On Wed, 19 Jan 2005 22:10:05 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > > You've got a couple problems. First, you need to end the string before > > putting a continuati

Re: a question

2005-01-19 Thread Fredrik Lundh
Bill Mill wrote: > You've got a couple problems. First, you need to end the string before > putting a continuation in. >>> "no\ ... pe" 'nope' >>> "however\ File "", line 1 "however\ ^ SyntaxError: EOL while scanning single-quoted string (in the second case, the ^ is trying t

Re: Has apparent 2.4b1 bug been fixed? flatten in Lib\compiler\ast.py overloads 'list' name

2005-01-19 Thread Larry Bates
You have name clashing between Python's built in list function and the variable called list that you pass into the function. Change the passed in variable name to something else. Larry Bates Try something like (not tested): def flatten(seq): l = [] for elt in seq: if isinstance(elt,

Re: RuntimeError: dictionary changed size during iteration

2005-01-19 Thread Jack Diederich
On Wed, Jan 19, 2005 at 11:45:15PM +0300, Roman Suzi wrote: > > I think, the behaviour below is misfeature: > > >>> [e for e in vars()] > Traceback (most recent call last): > File "", line 1, in ? > RuntimeError: dictionary changed size during iteration > >>> e = None > >>> [e for e in vars()]

RE: a question

2005-01-19 Thread Sells, Fred
I would use something like cmd = '%s/mos user wmarch, ' % mosbin cmd += 'cd /fa/wm/%s/%s, ' % (jaar, filetype) cmd += ... which reveals that you don't have enough args to satisfy all the %s's -Original Message- From: Nader Emami [mailto:[EMAIL PROTECTED] --snip-- I have a long command in U

Re: a question

2005-01-19 Thread Bill Mill
Nader, You've got a couple problems. First, you need to end the string before putting a continuation in. Secondly, you have 6 variables to be substituted and only provide 4. Here's some code, edited to show how to use continutations to join strings: >>> mosbin, jaar, filetype = (1,1,1) >>> cmd =

  1   2   >