Re: General question about Python design goals

2005-12-01 Thread bonono
Mike Meyer wrote: > I get all that, I really do. I would phrase it as "a tuple is a set of > attributes that happen to be named by integers." count doesn't make > sense on the attributes of an object - so it doesn't make sense on a > tuple. index doesn't make sense on the attributes of an object -

Re: One module cannot be found by the interpreter

2005-12-01 Thread Fredrik Lundh
Anthony Liu wrote: > I downloaded and built the python/c++ maxent package ( > http://homepages.inf.ed.ac.uk/s0450736/maxent_toolkit.html > ). > > I don't know what happened, the interpreter cannot > find the cmaxent module, whereas cmaxent.py is right > under the current directory. > > >>> from ma

Re: Python CGI

2005-12-01 Thread Tim Roberts
"jbrewer" <[EMAIL PROTECTED]> wrote: > >I need to update a CGI script I have been working on to perform >validation of input files. The basic idea is this: > >1.) HTML page is served >2.) User posts file and some other info >3.) Check file for necessary data >* If data is missing, then post a

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Mike Meyer wrote: > So why the $*@& (please excuse my Perl) does "for x in 1, 2, 3" work? because the syntax says so: http://docs.python.org/ref/for.html > Seriously. Why doesn't this have to be phrased as "for x in list((1, > 2, 3))", just like you have to write list((1, 2, 3)).count(1), e

Re: python speed

2005-12-01 Thread Leif K-Brooks
Krystian wrote: >>I would also like to see Half Life 2 in pure Python. > > or even quake1, do you think it could have any chances to run > smoothly? If can run at a reasonably speed, yes. -- http://mail.python.org/mailman/listinfo/python-list

Embedding Python in Borland Builder C++ (6.0)

2005-12-01 Thread Marco Aschwanden
Hi There almost no pages on how to embed Python in Borland Builder C++ (6.0). Any hints in this matter are very welcome... Thanks, Marco -- http://mail.python.org/mailman/listinfo/python-list

RE: How to get a network resource on a windows server

2005-12-01 Thread Tim Golden
[Frank.Lin] > I am working in windows environment and I > want copy some files from a remote share folder. > Now I want to let my script establish a > connection between NULL device name and a > shared resource then return a list of files > matching the given pattern and copy them > to local

Re: HTML parsing/scraping & python

2005-12-01 Thread Fuzzyman
The standard library module for fetching HTML is urllib2. The best module for scraping the HTML is BeautifulSoup. There is a project called mechanize, built by John Lee on top of urllib2 and other standard modules. It will emulate a browsers behaviour - including history, cookies, basic authenti

Re: Python CGI

2005-12-01 Thread Fuzzyman
That doesn't sound too difficult to do in a single script. As Tim has mentioned, you can always separate the code in two modules and just import the one needed for the action being performed. Your script just needs to output different HTML depending on the result - with a different form depending

Re: General question about Python design goals

2005-12-01 Thread Ed Singleton
On 29/11/05, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > on the other hand, it's also possible that there are perfectly usable ways > > to keep bikes and bike seats dry where Christoph works, but that he prefers > > not to use them because they're violating some design

Re: Death to tuples!

2005-12-01 Thread Antoon Pardon
On 2005-11-30, Duncan Booth <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >>> The left one is equivalent to: >>> >>> __anon = [] >>> def Foo(l): >>>... >>> >>> Foo(__anon) >>> Foo(__anon) >> >> So, why shouldn't: >> >>res = [] >>for i in range(10): >> res.append(i*i) >>

Re: General question about Python design goals

2005-12-01 Thread Christoph Zwerschke
Donn Cave schrieb: > As I'm sure everyone still reading has already heard, the natural usage > of a tuple is as a heterogenous sequence. I would like to explain this > using the concept of an "application type", by which I mean the set of > values that would be valid when applied to a particular c

Re: Death to tuples!

2005-12-01 Thread Antoon Pardon
On 2005-11-30, Christophe <[EMAIL PROTECTED]> wrote: > Antoon Pardon a écrit : >> On 2005-11-30, Duncan Booth <[EMAIL PROTECTED]> wrote: >> >>>Antoon Pardon wrote: >>> But lets just consider. Your above code could simply be rewritten as follows. res = list() for i in range

Re: mmm-mode, python-mode and doctest-mode?

2005-12-01 Thread bruno at modulix
John J Lee wrote: > Is it possible to get doctest-mode to work with mmm-mode and python-mode > nicely so that docstrings containing doctests are editable in doctest-mode? I don't know. (snip) > > Any tips appreciated! > Seems like comp.emacs could be a good place for this question -- bru

Re: an intriguing wifi http server mystery...please help

2005-12-01 Thread Irmen de Jong
[EMAIL PROTECTED] wrote: > Hi again Istvan, > > Good suggestion. > I have tried another server and it works flawlessly, regardless of the > computers being wireless or wired. Excellent. > However, i am still intrigued as to why the server is fast when both > computers are wireless and the desktop

Re: Why are there no ordered dictionaries?

2005-12-01 Thread Fuzzyman
Christoph Zwerschke wrote: > Hello Christoph, > I think re-ordering will be a very rare use case anyway and slicing even > more. As a use case, I think of something like mixing different > configuration files and default configuration parameters, while trying > to keep a certain order of paramet

FW: Python Query: How to i share variable between two processes without IPC.

2005-12-01 Thread Rijhwani, Mukesh
  Hi everyone,   Question: how do i share variable between two processes without IPC.   context: i have a process which is running and i want to update one of the variables use by this process with ANOTHER process. I understand there are various IPC mechanisms like shared memory, pipes, si

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Christoph Zwerschke wrote: > I understand what you want to say, but I would not use the terms > "homogenuous" or "heterogenous" since their more obvious meaning is that > all elements of a collection have the same type. http://www.google.com/search?q=duck+typing -- http://mail.python.org/m

Re: python speed

2005-12-01 Thread Fredrik Lundh
Mike Meyer wrote: > If you wire everything down, you can always hand-code assembler that > will be faster than HLL code but that doesn't mean that your hand-coded assembler will always be faster than an HLL implementation that addresses the same problem: http://mail.python.org/pipermail/python-a

Re: General question about Python design goals

2005-12-01 Thread Antoon Pardon
On 2005-12-01, Donn Cave <[EMAIL PROTECTED]> wrote: > Quoth [EMAIL PROTECTED]: >| Christoph Zwerschke wrote: > ... >|> Sorry, but I still do not get it. Why is it a feature if I cannot count >|> or find items in tuples? Why is it bad program style if I do this? So >|> far I haven't got any reasonab

Re: General question about Python design goals

2005-12-01 Thread Antoon Pardon
On 2005-12-01, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Mike Meyer wrote: > >> So why the $*@& (please excuse my Perl) does "for x in 1, 2, 3" work? > > because the syntax says so: > > http://docs.python.org/ref/for.html > >> Seriously. Why doesn't this have to be phrased as "for x in list((1

Re: Death to tuples!

2005-12-01 Thread Duncan Booth
Antoon Pardon wrote: > I know what happens, I would like to know, why they made this choice. > One could argue that the expression for the default argument belongs > to the code for the function and thus should be executed at call time. > Not at definion time. Just as other expressions in the func

Re: mmm-mode, python-mode and doctest-mode?

2005-12-01 Thread John J. Lee
bruno at modulix <[EMAIL PROTECTED]> writes: > John J Lee wrote: > > Is it possible to get doctest-mode to work with mmm-mode and python-mode > > nicely so that docstrings containing doctests are editable in doctest-mode? > > I don't know. > > (snip) > > > > Any tips appreciated! > > > > Seem

Re: Python as Guido Intended

2005-12-01 Thread Antoon Pardon
On 2005-11-30, Dave Hansen <[EMAIL PROTECTED]> wrote: > On 30 Nov 2005 10:57:04 GMT in comp.lang.python, Antoon Pardon ><[EMAIL PROTECTED]> wrote: > >>On 2005-11-29, Mike Meyer <[EMAIL PROTECTED]> wrote: >>> Antoon Pardon <[EMAIL PROTECTED]> writes: > You see, you can make languages more powerf

Re: Problem cmpiling M2Crypto

2005-12-01 Thread Thomas G. Apostolou
Dear friend Heikki Toivonen, thank you for replying to my quest... > C:\Program Files\Plone 2\Python\lib\distutils\extension.py:128: UserWarning: > Unknown Extension options: 'swig_opts' >>Hmm, I don't remember seeing that. But then again, I haven't compiled >>with the same setup as you either.

Re: Problem cmpiling M2Crypto

2005-12-01 Thread Fredrik Lundh
Thomas G. Apostolou wrote: >> C:\Program Files\Plone 2\Python\lib\distutils\extension.py:128: > UserWarning: >> Unknown Extension options: 'swig_opts' > >>>Hmm, I don't remember seeing that. But then again, I haven't compiled >>>with the same setup as you either. > > I am in a quest to find where

Re: General question about Python design goals

2005-12-01 Thread Christoph Zwerschke
I think this all boils down to the following: * In their most frequent use case where tuples are used as lightweight data structures keeping together heterogenous values (values with different types or meanings), index() and count() do not make much sense. I completely agree that his is the mos

Re: Python CGI

2005-12-01 Thread BJ Swope
Here's a snippet of code I use in a CGI I use... I check to see if the params has any data, if it does then return that data and some other data that comes from the params.  If params is empty, then draw a different page that says give me some data.     if len(params):     return params,inc_f

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-01 Thread [EMAIL PROTECTED]
The best way to compare Dao with Python in detail would be, join a SF project PLEAC, and provide solutions in Dao to those common programming problems listed in Perl Cookbook(by Tom Christiansen & Nathan Torkington, published by O'Reilly). The solutions in Python is there, when solutions in Dao wou

Re: FW: Python Query: How to i share variable between two processes without IPC.

2005-12-01 Thread skip
Mukesh> Question: how do i share variable between two processes without Mukesh> IPC. ... Mukesh> A similar thing is available in perl (check the mail attached). What makes you think the Perl code isn't using IPC? use IPC::Shareable; $handle = tie $buffer, 'IPC::Shareab

Re: Python as Guido Intended

2005-12-01 Thread Antoon Pardon
On 2005-11-30, Mike Meyer <[EMAIL PROTECTED]> wrote: > Antoon Pardon <[EMAIL PROTECTED]> writes: >> On 2005-11-29, Mike Meyer <[EMAIL PROTECTED]> wrote: >>> Antoon Pardon <[EMAIL PROTECTED]> writes: > You see, you can make languages more powerful by *removing* things > from it. You cas

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Christoph Zwerschke wrote: > It should be easy to imagine use cases now. > > Take for example, a chess game. You are storing the pieces in a > 64-tuple, where every piece has an integer value corresponding to its > value in the game (white positive, black negative). You can approximate > the value

Re: General question about Python design goals

2005-12-01 Thread Christoph Zwerschke
Chris Mellon schrieb: > First, remember that while your idea is obvious and practical and > straightforward to you, everybodys crummy idea is like that to them. > And while I'm not saying your idea is crummy, bear in mind that not > everyone is sharing your viewpoint. That's completely ok. What I

Re: New Ordered Dictionery to Criticise

2005-12-01 Thread Fuzzyman
Fuzzyman wrote: > Sorry for this hurried message - I've done a new implementation of out > ordered dict. This comes out of the discussion on this newsgroup (see > blog entry for link to archive of discussion). > > See the latest blog entry to get at it : > http://www.voidspace.org.uk/python/weblog

Re: How to get a network resource on a windows server

2005-12-01 Thread Frank.Lin
Hi TIm : The 3rd case fit me and all tips are useful ^_^ Thanks for you help! -- On Thu, 1 Dec 2005 08:49:42 -, Tim Golden wrote: >It's not entirely clear exactly what you're trying >to do. I'll present some (hopefully) useful tips >based on a bit of guesswork. I'm assuming you're >f

Re: Why are there no ordered dictionaries?

2005-12-01 Thread Fuzzyman
Hmmm... it would be interesting to see if these tests can be used with odict. The odict implementation now has full functionality by the way. Optimisations to follow and maybe a few *minor* changes. Fuzzyman http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listi

Re: General question about Python design goals

2005-12-01 Thread Christoph Zwerschke
Fredrik Lundh wrote: > Christoph Zwerschke wrote: > now, I'm no expert on data structures for chess games, but I find it hard to > believe that any chess game implementer would use a data structure that re- > quires linear searches for everything... Using linear arrays to represent chess boards is

Re: Why are there no ordered dictionaries?

2005-12-01 Thread Fuzzyman
> The semantics of assigning slices > to d.keys[i:j] and d.values[i:j] are kind of tricky when the size changes > and/or key names match or don't match in various ways, or the incoming > data represents collapsing redundant keys that are legal sequential assignment > overrides but change the size,

Re: UnicodeDecodeError

2005-12-01 Thread ash
Thanks Fredrik, i decoded both qu[i][0] and self.query to latin_1 (self.query.decode("latin_1")) and i am not getting the error now. If you dont mind, I have another question for you. I use wxPython for GUI development. When i use a string containing "&" character as a label for statictext, the "&

Re: FW: Python Query: How to i share variable between two processes without IPC.

2005-12-01 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > Mukesh> Question: how do i share variable between two processes without > Mukesh> IPC. Using some subtle application of quantum mechanics? ;-) Paul P.S. I suppose it depends on any definition of interprocess communication, but if the processes weren't to talk directly

Re: General question about Python design goals

2005-12-01 Thread Steve Holden
Antoon Pardon wrote: > On 2005-12-01, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >>Mike Meyer wrote: >> >> >>>So why the $*@& (please excuse my Perl) does "for x in 1, 2, 3" work? >> >>because the syntax says so: >> >>http://docs.python.org/ref/for.html >> >> >>>Seriously. Why doesn't this hav

Re: General question about Python design goals

2005-12-01 Thread Steve Holden
Christoph Zwerschke wrote: > I think this all boils down to the following: > > * In their most frequent use case where tuples are used as lightweight > data structures keeping together heterogenous values (values with > different types or meanings), index() and count() do not make much sense. >

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Christoph Zwerschke wrote: >> Christoph Zwerschke wrote: >> now, I'm no expert on data structures for chess games, but I find it hard to >> believe that any chess game implementer would use a data structure that re- >> quires linear searches for everything... > > Using linear arrays to represent c

Re: Python as Guido Intended

2005-12-01 Thread Ben Finney
Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2005-11-30, Mike Meyer <[EMAIL PROTECTED]> wrote: > > You'd be wrong. "Can" denotes a possibility, not a certainty. > > You didn't write: > Removing things can make a language more powerfull. > > You wrote: > You can make a language more powerfu

Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi
What started as a simple test if it is better to load uncompressed data directly from the harddisk or load compressed data and uncompress it (Windows XP SP 2, Pentium4 3.0 GHz system with 3 GByte RAM) seems to show that none of the in Python available compression libraries really works for large s

Re: Which License Should I Use?

2005-12-01 Thread Steven D'Aprano
On Tue, 29 Nov 2005 22:04:50 -0800, Paul Rubin wrote: >> Please note that merely putting the code under a GPL or other OSS licence >> is NOT sufficient -- they must agree to let you DISTRIBUTE the code. > > If it's under the GPL, they're not allowed to prevent you from > distributing it, if you h

Re: General question about Python design goals

2005-12-01 Thread Steve Holden
Mike Meyer wrote: > Paul Rubin writes: [...] > Did somebody actually use "Practicality beats purity" as an excuse for > not making list.count and string.count have the same arguments? If so, > I missed it. I certainly don't agree with that - count ought to work > right in

Re: General question about Python design goals

2005-12-01 Thread Chris Mellon
On 12/1/05, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > I think this all boils down to the following: > > * In their most frequent use case where tuples are used as lightweight > data structures keeping together heterogenous values (values with > different types or meanings), index() and count

Re: Database Module in a Web Application

2005-12-01 Thread Peter Hansen
mohammad babaei wrote: > I'm going to write my first web application in Python, > is it an good idea to write a database module that handles the > connection to database & executing queries ? No, it's not a good idea to "reinvent the wheel" if someone else has already done the work for you. All

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Fredrik Lundh
Claudio Grondi wrote: > What started as a simple test if it is better to load uncompressed data > directly from the harddisk or > load compressed data and uncompress it (Windows XP SP 2, Pentium4 3.0 GHz > system with 3 GByte RAM) > seems to show that none of the in Python available compression l

Re: Database Module in a Web Application

2005-12-01 Thread Fredrik Lundh
Peter Hansen wrote: > mohammad babaei wrote: > >> I'm going to write my first web application in Python, >> is it an good idea to write a database module that handles the >> connection to database & executing queries ? > > No, it's not a good idea to "reinvent the wheel" if someone else has > alre

need reading file in binary mode

2005-12-01 Thread Sergey P. Vazulia
this part of my code: f = file(work_dir + filename,'r') n = int(totalSize/recordLenth) i = 0 while i < n: buf = f.read(recordLenth); sometime (when find something like \0A\00\00 in data) returm less bytes then file have. Q: how-to read all data from bi

Re: A bug in struct module on the 64-bit platform?

2005-12-01 Thread jepler
I'm guessing that the expected behavior is >>> struct.calcsize('idi') 20 because the double should be aligned to an 8-byte boundary. This is the case on my linux/x86_64 machine: $ python -c 'import struct; print struct.calcsize("idi")' 20 I don't know much about 'itanium', but i'd b

Re: Problem cmpiling M2Crypto

2005-12-01 Thread Thomas G. Apostolou
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas G. Apostolou wrote: > > >> C:\Program Files\Plone 2\Python\lib\distutils\extension.py:128: > > UserWarning: > >> Unknown Extension options: 'swig_opts' > > > >>>Hmm, I don't remember seeing that. But then again, I

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread jepler
On this system (Linux 2.6.x, AMD64, 2 GB RAM, python2.4) I am able to construct a 1 GB string by repetition, as well as compress a 512MB string with gzip in one gulp. $ cat claudio.py s = '1234567890'*(1048576*50) import zlib c = zlib.compress(s) print len(c) open("/tmp/c

Automate webpage refresh

2005-12-01 Thread DarkBlue
I am trying to write a script (python2.3) which will be used with linux konqueror to retrive 2 webpages alternatively every 2 minutes. My question is how can I send alternative args (the url) to the same invocation of konqueror which I started with def pipedreams(program, *args): pid = o

Re: need reading file in binary mode

2005-12-01 Thread Sergey P. Vazulia
Problem solved. "Sergey P. Vazulia" <[EMAIL PROTECTED]> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:[EMAIL PROTECTED] > this part of my code: > > f = file(work_dir + filename,'rb') ^ > n = int(totalSize/recordLenth) >

[[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread Niels L Ellegaard
I just started learning python and I have been wondering. Is there a short pythonic way to find the element, x, of a list, mylist, that maximizes an expression f(x). In other words I am looking for a short version of the following: pair=[mylist[0],f(mylist[0])] for x in mylist[1:]: if f(x) >

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-01 Thread bearophileHUGS
>From "An Introduction to Dao": >So I realized the goodness of scripting languages, and spent about two weeks >to write some Perl scripts to retrieve informa- tion from GO and construct the >DAG. But that experience with Perl was not very nice, because of its >complicated syntax. Then I started

Re: sax.make_parser() segfaults

2005-12-01 Thread Bernhard Herzog
"Frank Millman" <[EMAIL PROTECTED]> writes: >> > If I call sax.make_parser() from the interpreter or from a stand-alone >> > program, it works fine on all machines, but in the following setup it >> > works correctly on MSW, but segfaults on both FC4 and RH9. [...] >> Progress report - I have narro

Re: General question about Python design goals

2005-12-01 Thread Christoph Zwerschke
Steve Holden wrote: > Christoph Zwerschke wrote: >> I completely agree that his is the most frequent case. Still there are >> cases where tuples are used to keep homogenous values together (for >> instance, RGB values, points in space, rows of a matrix). In these >> cases it would be principally

Re: for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread bearophileHUGS
If the elements of mylist can be compared (es. not complex values), then this can be a solution for you: from math import sin as f mylist = [float(2*i)/10 for i in xrange(10)] pairs = [(f(x), x) for x in mylist] ymax = max(pairs)[1] print pairs, "\n" print ymax You can also try this, for Py2.4: p

Re: python speed

2005-12-01 Thread Luis M. Gonzalez
Pypy is not the only promisory project we have for seeing Python running like compiled languages. Shed Skin is already a quite usable Python-to-C++ compiler which, in version 0.5.1, can actually compile many python scripts to fully optimized stand-alone executables. Next version will probably supp

Re: Which License Should I Use?

2005-12-01 Thread Chris Mellon
On 11/30/05, Robert Kern <[EMAIL PROTECTED]> wrote: > Paul Boddie wrote: > > Paul Rubin wrote: > > > >>That is the guy who claims it is impossible to release anything into > >>the public domain, other than by dying and then waiting 70 years. > > > > Is that an indirect reference to the following ar

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi
"Fredrik Lundh" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Claudio Grondi wrote: > > > What started as a simple test if it is better to load uncompressed data > > directly from the harddisk or > > load compressed data and uncompress it (Windows XP SP 2, Pentium4 3.0 GHz >

Re: General question about Python design goals

2005-12-01 Thread Aahz
[Since part of my post seems to have gotten lost in this thread, I figured I would repeat it] In article <[EMAIL PROTECTED]>, Aahz <[EMAIL PROTECTED]> wrote: >In article <[EMAIL PROTECTED]>, >Christoph Zwerschke <[EMAIL PROTECTED]> wrote: >> >>Or, another example, the index() method has start and

Re: Newbie: Python & Serial Port question

2005-12-01 Thread Grant Edwards
On 2005-11-30, Sanjay Arora <[EMAIL PROTECTED]> wrote: > Am a python newbie. Does python have a native way to communicate with a > PC serial port? Yes. Under Unix you can use os.open() os.read() os.write() and the termios module. > I found that pyserial needs java. No it doesn't. > I am using

Re: Newbie: Python & Serial Port question

2005-12-01 Thread Grant Edwards
On 2005-12-01, Kinsley Turner <[EMAIL PROTECTED]> wrote: >> Am a python newbie. Does python have a native way to communicate with a >> PC serial port? I found that pyserial needs java. > You can't just open the serial port like a file? Yes. > Perhaps you'd need to set the correct port parameter

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread bonono
Niels L Ellegaard wrote: > I just started learning python and I have been wondering. Is there a > short pythonic way to find the element, x, of a list, mylist, that > maximizes an expression f(x). > > In other words I am looking for a short version of the following: > > pair=[mylist[0],f(mylist[0]

Re: General question about Python design goals

2005-12-01 Thread Christoph Zwerschke
Fredrik Lundh wrote: >>>Christoph Zwerschke wrote: >>Using linear arrays to represent chess boards is pretty common in >>computer chess. Often, the array is made larger than 64 elements to make >>sure moves do not go off the board but hit unbeatable pseudo pieces >>standing around the borders. But

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread Duncan Booth
wrote: >> In other words I am looking for a short version of the following: >> >> pair=[mylist[0],f(mylist[0])] >> for x in mylist[1:]: >> if f(x) > pair[1]: >>pair=[x,f(x)] > > this is already very short, what else you want? May be this : > > max(((f(x), x) for x in mylist)) >

Re: sax.make_parser() segfaults

2005-12-01 Thread Frank Millman
Bernhard Herzog wrote: > "Frank Millman" <[EMAIL PROTECTED]> writes: > > >> > If I call sax.make_parser() from the interpreter or from a stand-alone > >> > program, it works fine on all machines, but in the following setup it > >> > works correctly on MSW, but segfaults on both FC4 and RH9. > [...

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-01 Thread [EMAIL PROTECTED]
> Maybe trying Python requires less time :-) Yes. Maybe if I tried python instead of perl, probably there would be no Dao language :). However there is one thing I don't like in python, that is, scoping by indentation. But it would not annoy me so much that make me decide to implement a new langua

Re: General question about Python design goals

2005-12-01 Thread Rick Wotnaz
"Donn Cave" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: [...] > Tuples and lists really are intended to serve two fundamentally > different purposes. We might guess that just from the fact that > both are included in Python, in fact we hear it from Guido van > Rossum, and one might ad

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread bonono
Duncan Booth wrote: > wrote: > > >> In other words I am looking for a short version of the following: > >> > >> pair=[mylist[0],f(mylist[0])] > >> for x in mylist[1:]: > >> if f(x) > pair[1]: > >>pair=[x,f(x)] > > > > this is already very short, what else you want? May be this : >

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Gerald Klix
Did you consider the mmap library? Perhaps it is possible to avoid to hold these big stings in memory. BTW: AFAIK it is not possible in 32bit windows for an ordinary programm to allocate more than 2 GB. That restriction comes from the jurrasic MIPS-Processors, that reserved the upper 2 GB for the

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Christoph Zwerschke wrote: > I think it is telling that you have to resort to a debate about > bitboards vs. arrays in order to dismiss my simple use case for > index() and count() as "unreal". kook. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Louie-1.0b2 - Signal dispatching mechanism

2005-12-01 Thread Thomas Heller
[EMAIL PROTECTED] writes: > Louie 1.0b2 is available: > > > > Louie provides Python programmers with a straightforward way to > dispatch signals between objects in a wide variety of contexts. It is > based on PyDispatcher_, which in turn was based on a hig

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Christophe
Gerald Klix a écrit : > Did you consider the mmap library? > Perhaps it is possible to avoid to hold these big stings in memory. > BTW: AFAIK it is not possible in 32bit windows for an ordinary programm > to allocate more than 2 GB. That restriction comes from the jurrasic > MIPS-Processors, that

Re: General question about Python design goals

2005-12-01 Thread Christoph Zwerschke
Aahz wrote: > This is one of those little things that happens in language evolution; > not everything gets done right the first time. But Python is developed > by volunteers: if you want this fixed, the first step is to submit a bug > report on SF (or go ahead and submit a patch if you have the e

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Rick Wotnaz wrote: > I'm sure Antoon wouldn't object if lists were to be allowed as > dictionary keys, which would eliminate the multiple castings for > that situation. I wouldn't, either. so what algorithm do you suggest for the new dictionary im- plementation? -- http://mail.python.org/ma

RE: Making immutable instances

2005-12-01 Thread Rick Wotnaz
"Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Was it *really* necessary to send 4 separate emails to reply to > four sections of the same email? > > Good netiquette is to intersperse your comments with quoted > sections in a single email. > > Tim Delaney Good

Re: General question about Python design goals

2005-12-01 Thread Rick Wotnaz
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Rick Wotnaz wrote: > >> I'm sure Antoon wouldn't object if lists were to be allowed as >> dictionary keys, which would eliminate the multiple castings for >> that situation. I wouldn't, either. > > so what algorithm do you s

Re: General question about Python design goals

2005-12-01 Thread Alex Martelli
Steve Holden <[EMAIL PROTECTED]> wrote: ... > Presumably because it's necessary to extract the individual values > (though os.stat results recently became addressable by attribute name as > well as by index, and this is an indication of the originally intended > purpose of tuples). Yep -- "tim

DCOracle2/python/zope

2005-12-01 Thread Marcel Hartmann
Hi, I have problems to get ZOracleDA run in Zope - I cannot found a solution wheter in Zope Groups nor searching google and I think it's a python problem. The connection in python - without zope - functions without problems and the missing library (see errors later) is obviously found. Is it

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Fredrik Lundh
Christophe wrote: > > Did you consider the mmap library? > > Perhaps it is possible to avoid to hold these big stings in memory. > > BTW: AFAIK it is not possible in 32bit windows for an ordinary programm > > to allocate more than 2 GB. That restriction comes from the jurrasic > > MIPS-Processors,

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi
I was also able to create a 1GB string on a different system (Linux 2.4.x, 32-bit Dual Intel Xeon, 8GB RAM, python 2.2). $ python -c 'print len("m" * 1024*1024*1024)' 1073741824 I agree with another poster that you may be hitting Windows limitations rather than Python ones, but I am certainly not f

SCU3 Python package 0.2 released: wxPython support added

2005-12-01 Thread Philippe C. Martin
Dear all, I have released SCU3Python.u3p (www.snakecard.com/src) . It includes: - SCU3 0.1: a python wrapper for the U3 SDK (www.u3.com) - Python 2.4.2 - wxPython 2.6 (ansi) - A hello-World-style basic wxPython application which shows how to retrieve the U3 information (ex: current virtual disks

ANN: SPE 0.8.0.b Python IDE (new: Mac support, doc viewer and workspaces)

2005-12-01 Thread SPE - Stani's Python Editor
:**What's new?**: SPE 'Kay release' 0.8.0.b This release is a major step forward for all platforms, especially for MacOS X. It offers you basic project management through workspaces (thanks to Thurston Stone), an improved sidebar and pydoc viewer. This is the first release which is also develop

Re: General question about Python design goals

2005-12-01 Thread Christoph Zwerschke
Fredrik Lundh wrote: > Christoph Zwerschke wrote: > >>I think it is telling that you have to resort to a debate about >>bitboards vs. arrays in order to dismiss my simple use case for >>index() and count() as "unreal". > > kook. Thanks. Just to clarify: I was referring to the weakness of the ar

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Rick Wotnaz wrote: > > Rick Wotnaz wrote: > > > >> I'm sure Antoon wouldn't object if lists were to be allowed as > >> dictionary keys, which would eliminate the multiple castings for > >> that situation. I wouldn't, either. > > > > so what algorithm do you suggest for the new dictionary im- > > p

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > thanks. I don't know what max can or cannot compare. Just the same things that you can compare with, say, < . I believe in 2.5 max and min will also accept a key= argument (like sorted etc) to tweak what to compare, so max(thelist, key=f) should then work (but

Re: After migrating from debian to ubuntu, tkinter "hello world" doesn't work

2005-12-01 Thread mortuno
yes, but everybody using ubuntu tells me it works fine for them. The problem must be something very specific to my laptop and x window. I am using need "855resolution" , I'd like to know if it works for somedy else with ubuntu and 855resolution. thanks for your interest -- http://mail.python.o

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Alex Martelli wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: >... > > Presumably because it's necessary to extract the individual values > > (though os.stat results recently became addressable by attribute name as > > well as by index, and this is an indication of the originally intended > >

Re: After migrating from debian to ubuntu, tkinter "hello world" doesn't work

2005-12-01 Thread mortuno
thank you very much, but now I don't think it is a problem of dependencies -- http://mail.python.org/mailman/listinfo/python-list

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread bonono
Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: >... > > thanks. I don't know what max can or cannot compare. > > Just the same things that you can compare with, say, < . > > I believe in 2.5 max and min will also accept a key= argument (like > sorted etc) to tweak what to compare, so max(th

Re: Problem cmpiling M2Crypto

2005-12-01 Thread Fredrik Lundh
Thomas G. Apostolou wrote: > I still get the error: > "SWIG/_m2crypto.c(80) : fatal error C1083: Cannot open include file: > 'Python.h': No such file or directory > error: command '"C:\Program Files\Microsoft Visual Studio\VC98\BIN\cl.exe"' > failed with exit status 2" > > witch is -as Heikki Toiv

Re: Automate webpage refresh

2005-12-01 Thread Carl Friedrich Bolz
Hi! DarkBlue wrote: > I am trying to write a script (python2.3) which will be used > with linux konqueror to retrive 2 webpages alternatively every 2 minutes. > > My question is how can I send alternative args (the url) > to the same invocation of konqueror which I started with This can be done

Re: Death to tuples!

2005-12-01 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > I know what happens, I would like to know, why they made this choice. > One could argue that the expression for the default argument belongs > to the code for the function and thus should be executed at call time. > Not at definion time. Just as other exp

Re: an intriguing wifi http server mystery...please help

2005-12-01 Thread jojoba
> Just a guess: could it be that your server is doing reverse-dns lookups? > (i.e. it does socket.gethostbyaddr to get names by ip addresses, > perhaps for logging or whatnot) > This call is expensive. Sometimes this call takes ages to complete, > if you have a broken DNS config. Interesting...

  1   2   3   >