Re: Making immutable instances

2005-11-23 Thread Giovanni Bajo
Mike Meyer wrote: > Note that this property of __slots__ is an implementation detail. You > can't rely on it working in the future. I don't "rely" on it. I just want to catch bugs in my code. > I'm curious as to why you care if people add attributes to your > "immutable" class. Personally, I con

Re: [OT] Enough! [was: wxPython Licence vs GPL]

2005-11-23 Thread Robert Kern
Steven D'Aprano wrote: > Robert Kern wrote: > >>Take your off-topic argument off-list. > > You don't think questions of the legality of when and > how you can write and distribute Python programs are of > interest to Python developers? The OP's question certainly was on-topic. The argument ove

Re: wxPython Licence vs GPL

2005-11-23 Thread [EMAIL PROTECTED]
Steve Holden wrote: > Whether or not some fragments of code remain unchanged at the end of > your project, if you start out with a piece of source code lifted from > wxPython then what you have created is definitely a "derivative work" > and, as such, you must take into account the wxPython licens

Re: ANNOUNCE: Mod_python 3.2.5 Beta

2005-11-23 Thread grahamd
Damjan wrote: > > The Apache Software Foundation and The Apache HTTP Server Project are > > pleased to announce the 3.2.5 Beta release mod_python. > http://www.modpython.org/live/mod_python-3.2.5b/doc-html/hand-pub-alg-auth.html > > says "Since functions cannot be assigned attributes,..." > > But t

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Steven D'Aprano
Peter Hansen wrote: > Definitely not. I believe it's currently guaranteed that the order of > the items in dict.keys() and dict.values() will match (i.e. the index of > any key in its list will be the same as the index of the corresponding > value in its list). This property is almost certain

Re: [OT] Enough! [was: wxPython Licence vs GPL]

2005-11-23 Thread Steven D'Aprano
Robert Kern wrote: > Take your off-topic argument off-list. You don't think questions of the legality of when and how you can write and distribute Python programs are of interest to Python developers? Fair enough I suppose. Who cares what the licences say, we're all just going to break them an

Re: wxPython Licence vs GPL

2005-11-23 Thread Steven D'Aprano
Ed Jensen wrote: > Paul Boddie <[EMAIL PROTECTED]> wrote: > >>It's interesting that you bring this tired thought experiment up in the >>context of the original remark: "Its license is far more "free" than >>GPL is." If we were focusing on the "vox pop" interpretation of the >>word "free", that re

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > performance is of course another aspect; if you *need* two parallel > lists, creating a list full of tuples just to pull them apart and throw > them all away isn't exactly the most efficient way to do things. > > (if performance didn't matter at all, we could get rid most di

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Fredrik Lundh
Mike Meyer wrote: > Backwards compatability. The guarantee on the order of keys() and > values() predates items() (and iteritems()). according to the SVN repository, the type originally had "keys" and "has_key" only. "values" and "items" were both added in the same checkin (may 1993). performan

Re: Python as Guido Intended

2005-11-23 Thread [EMAIL PROTECTED]
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > Mike Meyer wrote: > > > >>"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > >> > Maybe Python attracts people who share that belief. After all, TRTFTJ > is implies TSBOOWTDI, and vice versa. > >>> > >>>I was not talking about the believe,

Re: Python as Guido Intended

2005-11-23 Thread [EMAIL PROTECTED]
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > Mike Meyer wrote: > [...] > > > >>By the results of the vote, most people wanted ternary. The use > >>cases for it are well know. From what I recall, the debate was over > >>which of the many proposals should be adopted. > > > > That is not the im

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Steve Holden
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > [...] >>Maybe there are also other reasons to promise this property that I'm not >>aware of. Certainly it seems like this property is useful and not hard >>to provide for "non-perverse" implementations, much like the > > Thanks, but we don't n

Re: Python as Guido Intended

2005-11-23 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Mike Meyer wrote: > >>"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >> Maybe Python attracts people who share that belief. After all, TRTFTJ is implies TSBOOWTDI, and vice versa. >>> >>>I was not talking about the believe, I was talking about the way you >>>pr

Re: Python as Guido Intended

2005-11-23 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Mike Meyer wrote: [...] > >>By the results of the vote, most people wanted ternary. The use >>cases for it are well know. From what I recall, the debate was over >>which of the many proposals should be adopted. > > That is not the impression I get on here. The impressio

python2.4.2 test_fpformat and test_locale failed on IRIX6.5

2005-11-23 Thread Xiao Jianfeng
Hello, I am trying to install python2.4.2 on IRIX6.5, but test_fpformat and test_locale failed when I ran "smake test". The following is the detailed error message: prompt:\> ./python ./Lib/t

Re: Unicode in MIMEText

2005-11-23 Thread Steve Holden
Damjan wrote: >>Why doesn't this work: >> >>from email.MIMEText import MIMEText >>msg = MIMEText(u'\u043a\u0438\u0440\u0438\u043b\u0438\u0446\u0430') >>msg.set_charset('utf-8') >>msg.as_string() > > ... > >>UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: >>ordinal not i

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread [EMAIL PROTECTED]
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > [EMAIL PROTECTED] wrote: > > [...] > >>Maybe there are also other reasons to promise this property that I'm not > >>aware of. Certainly it seems like this property is useful and not hard > >>to provide for "non-perverse" implementations, much lik

Re: Using Cron to run a python program

2005-11-23 Thread Steve Holden
Carsten Haese wrote: > On 23 Nov 2005 16:23:11 -0800, vagrantbrad wrote > >>I'm using python 2.4 running on Fedora Core 4. I have written a python >>program called ipscan.py that checks the external ip address of my >>cable internet connection, and on change, will update the dns records >>at my d

Re: Making immutable instances

2005-11-23 Thread Mike
"Ben Finney" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Howdy all, > > How can a (user-defined) class ensure that its instances are > immutable, like an int or a tuple, without inheriting from those > types? > > What caveats should be observed in making immutable instances? IM

Re: return in loop for ?

2005-11-23 Thread [EMAIL PROTECTED]
Steve Holden wrote: > Yomgui: I am not a language lawyer, but I think you can feel safe > returning from inside a loop. Just as a matter of interest, how else > would you propose to implement the functionality Mike showed: > > > >>>def f(): > > > > ... for i in range(20): > > ... if i > 10: re

Re: return in loop for ?

2005-11-23 Thread Steve Holden
Mike Meyer wrote: > yomgui <[EMAIL PROTECTED]> writes: > >>Mike Meyer wrote: >> >>>yomgui <[EMAIL PROTECTED]> writes: >>> is it legal to return inside a for loop or am I obliged to break out of the loop before returning ? >>> >>>Try it and see: >> >>it is not because it does work on an imp

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Please don't take it as a challenge, it was not. If it was, it was > about the need for the guarantee, not about you not giving me the > answer I want. But it is really wondering why ? If you really want to know merely the *need* for the guarantee, as in why was this ev

Re: Making immutable instances

2005-11-23 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > A substantial fraction of the time, people asking "how do I stop the > users of my code from doing X" proceed by screaming "but they could > still do X if they hopped on their left foot in a moonless midnight > while sprinkling bat's blood!" as a response to any suggestion.

Re: Mixed types and variants

2005-11-23 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: ... > - Maybe someone here can suggest some other variant type, or some other > solution. Pyrex? Pyrex is mostly like Python with the possibility of C types. It handles mixed types just like Python, and the C code it produces is sort

Re: defining the behavior of zip(it, it)

2005-11-23 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > cookbook recipies of which there are already several good > collections, but shorter things like, copy(sequence) is spelled > "sequence[:]". No way: >>> from collections import deque >>> d=deque([1,2,3]) >>> d[:] Traceback (most recent call last): File "", li

Re: about sort and dictionary

2005-11-23 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Neil Hodgson <[EMAIL PROTECTED]> wrote: >> Ruby uses '!' not for mutation but to indicate surprising or >> destructive mutation. If it was placed on all mutators, code would be >> full of '!'s. '!' is less common on methods that modify the receiver

Re: Making immutable instances

2005-11-23 Thread Alex Martelli
Ben Finney <[EMAIL PROTECTED]> wrote: ... > > Of course, these restrictions can be easily worked around by a > > sufficiently determined attacker... but if you have to think of the > > user of your code as an attacker, you've got worse problems than > > this trifling one. > > I've probably stum

Re: Making immutable instances

2005-11-23 Thread Alex Martelli
Ben Finney <[EMAIL PROTECTED]> wrote: ... > > Remember that your redefined __setattr__ IS "in place" even when > > you're initializing your istance, so remember to delegate attribute > > setting to the superclass (the other special methods mentioned above > > are less likely to byte you). > > S

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread [EMAIL PROTECTED]
Mike Meyer wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > Which is also my initial puzzle, items() and iteritems() already gives > > you the tuples, why such gurantee or the others ? Doesn't that violate > > the general idiom that if we can do certain thing in one way, there > > bett

Re: Why are there no ordered dictionaries?

2005-11-23 Thread Alex Martelli
Christoph Zwerschke <[EMAIL PROTECTED]> wrote: ... > d.ksort() = d.sortkeys() > d.asort() = d.sortvalues() > > d.sort() could default to one of them (not sure which one). Define JUST d.sort, you can trivially implement the other as d.sort(key=d.get). Alex -- http://mail.python.org/mailman/l

Re: Making immutable instances

2005-11-23 Thread Ben Finney
Alex Martelli <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> wrote: > > How can a (user-defined) class ensure that its instances are > > immutable, like an int or a tuple, without inheriting from those > > types? > > [...] > Of course, these restrictions can be easily worked around by

Re: Python as Guido Intended

2005-11-23 Thread [EMAIL PROTECTED]
Mike Meyer wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > >> Maybe Python attracts people who share that belief. After all, TRTFTJ > >> is implies TSBOOWTDI, and vice versa. > > I was not talking about the believe, I was talking about the way you > > presented it. You are setting up a

Re: Making immutable instances

2005-11-23 Thread Ben Finney
Alex Martelli <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> wrote: > > How can a (user-defined) class ensure that its instances are > > immutable, like an int or a tuple, without inheriting from those > > types? > > You can make a good start by defining __setattr__, __delattr__ (and

Re: Python as Guido Intended

2005-11-23 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >> Maybe Python attracts people who share that belief. After all, TRTFTJ >> is implies TSBOOWTDI, and vice versa. > I was not talking about the believe, I was talking about the way you > presented it. You are setting up an "imaginary" me, which is no

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Which is also my initial puzzle, items() and iteritems() already gives > you the tuples, why such gurantee or the others ? Doesn't that violate > the general idiom that if we can do certain thing in one way, there > better be one and only one way.

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread [EMAIL PROTECTED]
Peter Hansen wrote: > [EMAIL PROTECTED] wrote: > > Which is also my initial puzzle, items() and iteritems() already gives > > you the tuples, why such gurantee or the others ? Doesn't that violate > > the general idiom that if we can do certain thing in one way, there > > better be one and only on

Re: (newbie) N-uples from list of lists

2005-11-23 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > > An example of recursion elimination in Python can be found at > > > > > Thanks, so it seems that it is only doing the "stacking" oneself rather > than relies on the recurs

Re: Python as Guido Intended

2005-11-23 Thread [EMAIL PROTECTED]
Mike Meyer wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > >> You're the one that wants to use the hammer to do whatever it is, not > >> me. I don't believe in silver bullets. Python is good at what it > >> does. If I need a different tool, I use a different tool, rather than > >> try a

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Which is also my initial puzzle, items() and iteritems() already gives > you the tuples, why such gurantee or the others ? Doesn't that violate > the general idiom that if we can do certain thing in one way, there > better be one and only one way. > > Are there other usa

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > One reason might be Practicality. The zip() versions handily beat the > listcomp versions on a 10kitem dict. (python2.4) > > $ timeit.py -s 'd = dict.fromkeys(range(1))' '[(v, k) for (k, v) in > d.iteritems()]' > 100 loops, best of 3: 5.05 msec per loop > $ timeit.

Re: Python as Guido Intended

2005-11-23 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >> You're the one that wants to use the hammer to do whatever it is, not >> me. I don't believe in silver bullets. Python is good at what it >> does. If I need a different tool, I use a different tool, rather than >> try and mangle a good tool into so

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread jepler
One reason might be Practicality. The zip() versions handily beat the listcomp versions on a 10kitem dict. (python2.4) $ timeit.py -s 'd = dict.fromkeys(range(1))' '[(v, k) for (k, v) in d.iteritems()]' 100 loops, best of 3: 5.05 msec per loop $ timeit.py -s 'd = dict.fromkeys(range(1))'

Re: ANNOUNCE: Mod_python 3.2.5 Beta

2005-11-23 Thread Damjan
> The Apache Software Foundation and The Apache HTTP Server Project are > pleased to announce the 3.2.5 Beta release mod_python. http://www.modpython.org/live/mod_python-3.2.5b/doc-html/hand-pub-alg-auth.html says "Since functions cannot be assigned attributes,..." But that's not true (at least i

Re: (newbie) N-uples from list of lists

2005-11-23 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Out of curiousity, is "recursion" the desirable way(or is it pythonic > > way) ? How would one do it in the imperative way ? > > For an inherently recursive problem (as this one appears to be), the > traditional alternative

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread [EMAIL PROTECTED]
Peter Hansen wrote: > [EMAIL PROTECTED] wrote: > > Peter Hansen wrote: > >>I believe it's currently guaranteed that the order of > >>the items in dict.keys() and dict.values() will match (i.e. the index of > >>any key in its list will be the same as the index of the corresponding > >>value in its

Re: about sort and dictionary

2005-11-23 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > "do things right" is my fundamental beef with Python. > Dispite claims, I don't believe Python's designers have > a monopoly on the definition of "right". I think raymond's post more correctly described it. Rather than do things right, it is more the "world view of pytho

Re: wxPython Licence vs GPL

2005-11-23 Thread Peter Hansen
Steven D'Aprano wrote: > Really? So when I take my GPLed software, and legally install it on > 100 PCs without paying one single cent for licence fees, it isn't free of > cost? > > You a living in a strange and mysterious world, where things that cost > nothing aren't free. Many definitions of "c

[OT] Enough! [was: wxPython Licence vs GPL]

2005-11-23 Thread Robert Kern
Take your off-topic argument off-list. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Peter Hansen wrote: >>I believe it's currently guaranteed that the order of >>the items in dict.keys() and dict.values() will match (i.e. the index of >>any key in its list will be the same as the index of the corresponding >>value in its list). > > Interesting, but wh

Re: (newbie) N-uples from list of lists

2005-11-23 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Out of curiousity, is "recursion" the desirable way(or is it pythonic > way) ? How would one do it in the imperative way ? For an inherently recursive problem (as this one appears to be), the traditional alternative to recursion is maintaining your o

Re: Unicode in MIMEText

2005-11-23 Thread Damjan
> Why doesn't this work: > > from email.MIMEText import MIMEText > msg = MIMEText(u'\u043a\u0438\u0440\u0438\u043b\u0438\u0446\u0430') > msg.set_charset('utf-8') > msg.as_string() ... > UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: > ordinal not in range(128) It's a r

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread [EMAIL PROTECTED]
Peter Hansen wrote: > Christoph Zwerschke wrote: > > Ok, the answer is easy: For historical reasons - built-in sets exist > > only since Python 2.4. > > > > Anyway, I was thinking about whether it would be possible and desirable > > to change the old behavior in future Python versions and let dict

Re: Making immutable instances

2005-11-23 Thread Alex Martelli
Ben Finney <[EMAIL PROTECTED]> wrote: > How can a (user-defined) class ensure that its instances are > immutable, like an int or a tuple, without inheriting from those > types? You can make a good start by defining __setattr__, __delattr__ (and __setitem__ and __delitem__ if your class is a conta

Re: about sort and dictionary

2005-11-23 Thread Alex Martelli
Neil Hodgson <[EMAIL PROTECTED]> wrote: > Magnus Lycka: > > > Except when it isn't obvious. What constitutes mutation of an object? > > C++ handles this with 'const', and lets the programmer cheat by using > > transient member variables, since there are cases when you actually > > want to mutate

Re: wxPython Licence vs GPL

2005-11-23 Thread Ed Jensen
Grow up, Steven. -- http://mail.python.org/mailman/listinfo/python-list

Unicode in MIMEText

2005-11-23 Thread Damjan
Why doesn't this work: from email.MIMEText import MIMEText msg = MIMEText(u'\u043a\u0438\u0440\u0438\u043b\u0438\u0446\u0430') msg.set_charset('utf-8') msg.as_string() Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/email/Message.py", line 129, in as_string

Re: (newbie) N-uples from list of lists

2005-11-23 Thread [EMAIL PROTECTED]
Out of curiousity, is "recursion" the desirable way(or is it pythonic way) ? How would one do it in the imperative way ? Dan Bishop wrote: > > it could be done by a recursive call, but i am interested in using and > > understanding generators. > > def cross(*args): >"""Iterates over the set cr

Re: Simple photo collage using Python and PIL

2005-11-23 Thread Callum Prentice
Thanks very much Fredrik - just what I was looking for - that gives me a good place to start from. Much appreciated. Cal. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Peter Hansen
Christoph Zwerschke wrote: > Ok, the answer is easy: For historical reasons - built-in sets exist > only since Python 2.4. > > Anyway, I was thinking about whether it would be possible and desirable > to change the old behavior in future Python versions and let dict.keys() > and dict.values() b

Re: single process instance

2005-11-23 Thread Peter Hansen
Joe Wong (Mango) wrote: > Is there any library / function that I can put in my process to make > sure he is the one and only one instance running in the box? Previous responses can be found via Google, e.g. with http://groups.google.com/groups?q=group%3Acomp.lang.python.*+single+process+instance

Re: Simple photo collage using Python and PIL

2005-11-23 Thread Callum Prentice
Thank you Thomas - I've heard good things about Image Magick - I'll go read up on it. Cheers. Cal. -- http://mail.python.org/mailman/listinfo/python-list

Re: (newbie) N-uples from list of lists

2005-11-23 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > Hello, > > i think it could be done by using itertools functions even if i can not > see the trick. i would like to have all available "n-uples" from each > list of lists. > example for a list of 3 lists, but i should also be able to handle any > numbers of items (any len

Re: Python as Guido Intended

2005-11-23 Thread [EMAIL PROTECTED]
Mike Meyer wrote: > Whatever it is, trying to turn Python into a tool for dealing with it > isn't the right thing to do. Still this tone, and logic. This statement alone is right except that it may not be what was about. > > >> > I think that it is possible to include in Python, things that are >

Re: best cumulative sum

2005-11-23 Thread David Isaac
"Peter Otten" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You are in for a surprise here: You got that right! > >>> def empty(): > ... for item in []: > ... yield item > ... > >>> bool(empty()) > True Ouch. > >>> bool(iter([])) > True # python 2.3 and probably

Re: Making immutable instances

2005-11-23 Thread Mike Meyer
Ben Finney <[EMAIL PROTECTED]> writes: > Are there other, more dependable, ways of making immutable objects? Your answer can be found at http://www.cs.bgu.ac.il/~omri/Humor/write_in_c.html > >> I'm curious as to why you care if people add attributes to your >> "immutable" class. Personally, I con

Re: Python as Guido Intended

2005-11-23 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> > I do think that the Python development community believes they do, >> > or more accurately, that if someone wants to use a different style, >> > they can go use something else. >> In other words, they believe that you should u

Re: Python as Guido Intended

2005-11-23 Thread [EMAIL PROTECTED]
Mike Meyer wrote: > > I do think that the Python development community believes they do, > > or more accurately, that if someone wants to use a different style, > > they can go use something else. > > In other words, they believe that you should use a screwdriver to > drive screws, and not a hamme

single process instance

2005-11-23 Thread Joe Wong (Mango)
Dear all,    Is there any library / function that I can put in my process to make sure he is the one and only one instance running in the box?   Best regards,   - Joe   -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython installation issues on Debian

2005-11-23 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hi all, > > I'm trying to install wxPython on Debian using 'apt-get install > python-wxgtk2.4.' I've got both Python 2.3 and 2.4 installed with 2.4 > set as my default. For whatever reason, wxPython always installs under > /usr/lib/python2.3/site-packages. > > Does anyo

Re: Would cgi be the only option if my webhosting doesn't have psp, zpt, cheetah or mod_python?

2005-11-23 Thread jepler
You might benefit some from scgi. From the httpd side, you can either use "mod_scgi" in the server or "cgi2scgi" if can't install mod_scgi. cgi2scgi doesn't have all the performance benefit of mod_scgi, but cgi2scgi is a fairly lightweight "C" program. http://www.mems-exchange.org/softwa

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread jepler
You can already get a set from a dictionary's keys in an efficient manner: >>> l = dict.fromkeys(range(10)) >>> set(l) Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) Jeff pgplWRjKoPA4t.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.4.2 on AIX fails compiling _codecs_cn.c

2005-11-23 Thread Paul Watson
Martin v. Löwis wrote: > Paul Watson wrote: > >> Can we #undef _ALL_SOURCE for _codecs_cn.c compilation? > > > Where does _ALL_SOURCE come from? Why is it defined? > What is its effect on hz? > > Regards, > Martin Martin v. Löwis wrote: > Paul Watson wrote: > >> Can we #undef _ALL_SOURCE fo

Re: Making immutable instances

2005-11-23 Thread Björn Lindström
Mike Meyer <[EMAIL PROTECTED]> writes: > I'm curious as to why you care if people add attributes to your > "immutable" class. Personally, I consider that instances of types > don't let me add attributes to be a wart. I agree. To me it seems like the OP kind of wants to implement encapsulation fro

Re: Making immutable instances

2005-11-23 Thread Ben Finney
Mike Meyer <[EMAIL PROTECTED]> wrote: > "Giovanni Bajo" <[EMAIL PROTECTED]> writes: > > In short, you can't. I usually try harder to derive from tuple to > > achieve this (defining a few read-only properties to access item > > through attributes). Using __slots__ is then required to avoid > > peopl

Re: Using Cron to run a python program

2005-11-23 Thread Carsten Haese
On 23 Nov 2005 16:23:11 -0800, vagrantbrad wrote > I'm using python 2.4 running on Fedora Core 4. I have written a python > program called ipscan.py that checks the external ip address of my > cable internet connection, and on change, will update the dns records > at my dns provider, zoneedit. So

Re: Why are there no ordered dictionaries?

2005-11-23 Thread Carsten Haese
On Wed, 23 Nov 2005 23:39:22 +0100, Christoph Zwerschke wrote > Carsten Haese schrieb: > > > Thus quoth the Zen of Python: > > "Explicit is better than implicit." > > "In the face of ambiguity, refuse the temptation to guess." > > > > With those in mind, since an odict behaves mostly like a dicti

Would cgi be the only option if my webhosting doesn't have psp, zpt, cheetah or mod_python?

2005-11-23 Thread Mohammad Jeffry
If an webhosting doen't have these feature. Can I install them ? Any experiences on this? I'm assuming that asking the webhosting system admin. to install these framworks in not an option for now.-- And whoever does an atom's weight of evil will see it. -- http://mail.python.org/mailman/listinfo/p

Re: Python as Guido Intended

2005-11-23 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >Different programming styles are appropriate for different tasks, >different times and different places, different people. And like >morality, government, or economics, I do not believe that one style of >programming fits all situation

wxPython installation issues on Debian

2005-11-23 Thread [EMAIL PROTECTED]
Hi all, I'm trying to install wxPython on Debian using 'apt-get install python-wxgtk2.4.' I've got both Python 2.3 and 2.4 installed with 2.4 set as my default. For whatever reason, wxPython always installs under /usr/lib/python2.3/site-packages. Does anyone know how I can force it to install in

Re: Python as Guido Intended

2005-11-23 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Different programming styles are appropriate for different > tasks, different times and different places, different people. > And like morality, government, or economics, I do not believe > that one style of programming fits all situations. If I read you right, what you

Re: about sort and dictionary

2005-11-23 Thread rurpy
Magnus Lycka wrote: > [EMAIL PROTECTED] wrote: > > a reminder" that the change is inplace. How arrogant! While > > I'm sure the designers had kindly intentions. my memory, though > > bad, is not that bad, and I object to being forced to write code > > that is more clunky than need be, because th

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Martin v. Löwis
Christoph Zwerschke wrote: > Anyway, I was thinking about whether it would be possible and desirable > to change the old behavior in future Python versions and let dict.keys() > and dict.values() both return sets instead of lists. You answer the question whether it would be possible (no, because

Re: Embedding a CPython Script engine in a .NET application.

2005-11-23 Thread Martin v. Löwis
Carl Waldbieser wrote: > Has anyone had any experience embedding a CPython engine in a .NET > application? In the COM/ActiveX world, it was pretty easy to use Mark > Hammond's win32 modules to create a script engine component that you could > expose other COM objects to, but I was not sure how I w

Using Cron to run a python program

2005-11-23 Thread vagrantbrad
I'm using python 2.4 running on Fedora Core 4. I have written a python program called ipscan.py that checks the external ip address of my cable internet connection, and on change, will update the dns records at my dns provider, zoneedit. So basically, I've setup dynamic dns using python. Once th

Re: 2.4.2 on AIX fails compiling _codecs_cn.c

2005-11-23 Thread Martin v. Löwis
Paul Watson wrote: > Can we #undef _ALL_SOURCE for _codecs_cn.c compilation? Where does _ALL_SOURCE come from? Why is it defined? What is its effect on hz? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.4.2 on AIX fails compiling _codecs_cn.c

2005-11-23 Thread Martin v. Löwis
Paul Watson wrote: > This is on AIX 4.3.3 > > $ grep -i _hz $(find . -name m_param.h) > #define _HZ 100/* ticks per second of the clock*/ > #define __hzHZ /* Berkeley uses lower case hz */ > #define HZ _HZ > #define hz __hz I expected to see something li

Re: Making immutable instances

2005-11-23 Thread Mike Meyer
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: >> How can a (user-defined) class ensure that its instances are >> immutable, like an int or a tuple, without inheriting from those >> types? >> >> What caveats should be observed in making immutable instances? > > In short, you can't.

Re: return in loop for ?

2005-11-23 Thread Mike Meyer
yomgui <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> yomgui <[EMAIL PROTECTED]> writes: >> > is it legal to return inside a for loop >> > or am I obliged to break out of the loop before returning ? >> Try it and see: > it is not because it does work on an implementation of python > that it wil

Re: Python as Guido Intended

2005-11-23 Thread rurpy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: > > it seems that quite some people > > don't see the language as the creator or wants them to see it. > > Here's my two cents on this recurring theme. > > While nothing forces a particular programming style, the

Re: 2.4.2 on AIX fails compiling _codecs_cn.c

2005-11-23 Thread Paul Watson
Martin v. Löwis wrote: > Paul Watson wrote: > >> Any ideas why ./Modules/cjkcodecs/_codecs_cn.c fails to compile? It >> appears that the CODEC_STATELESS macro is concatenating 'hz' with a >> number and text. > > > More likely, hz is already defined to be 100, then forming 100_encode. > > It

Re: return in loop for ?

2005-11-23 Thread yomgui
Mike Meyer wrote: > > yomgui <[EMAIL PROTECTED]> writes: > > is it legal to return inside a for loop > > or am I obliged to break out of the loop before returning ? > > Try it and see: it is not because it does work on an implementation of python that it will work on any other platform or in the

Re: Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Ok, the answer is easy: For historical reasons - built-in sets exist > only since Python 2.4. > > Anyway, I was thinking about whether it would be possible and > desirable to change the old behavior in future Python versions and let > dict.keys() an

Re: a new design pattern for Python Library?

2005-11-23 Thread The Eternal Squire
Let me try again: Suppose I have a central class with complex behavior that I want to simply write as a bare skeleton upon which to hang the auxillary classes that help provide the complex behavior. The naive approach would be to write: class Skeleton: def __init__ (self): self.core_data =

Re: return in loop for ?

2005-11-23 Thread Mike Meyer
yomgui <[EMAIL PROTECTED]> writes: > is it legal to return inside a for loop > or am I obliged to break out of the loop before returning ? Try it and see: >>> def f(): ... for i in range(20): ... if i > 10: return i ... >>> print f() 11 >>> http://www.mired.org/home/mw

Re: 2.4.2 on AIX fails compiling _codecs_cn.c

2005-11-23 Thread Paul Watson
Martin v. Löwis wrote: > Paul Watson wrote: > >> Any ideas why ./Modules/cjkcodecs/_codecs_cn.c fails to compile? It >> appears that the CODEC_STATELESS macro is concatenating 'hz' with a >> number and text. > > > More likely, hz is already defined to be 100, then forming 100_encode. > > It

Re: Making immutable instances

2005-11-23 Thread Giovanni Bajo
Ben Finney wrote: > How can a (user-defined) class ensure that its instances are > immutable, like an int or a tuple, without inheriting from those > types? > > What caveats should be observed in making immutable instances? In short, you can't. I usually try harder to derive from tuple to achiev

Re: wxPython Licence vs GPL

2005-11-23 Thread Ed Jensen
Paul Boddie <[EMAIL PROTECTED]> wrote: > It's interesting that you bring this tired thought experiment up in the > context of the original remark: "Its license is far more "free" than > GPL is." If we were focusing on the "vox pop" interpretation of the > word "free", that remark wouldn't make any

Re: Why are there no ordered dictionaries?

2005-11-23 Thread Christoph Zwerschke
Here is another old posting I just found which again gives the same use cases and semantics: http://mail.python.org/pipermail/python-dev/2005-March/051974.html "Keys are iterated over in the order that they are added. Setting a value using a key that compares equal to one already in the dict rep

Why is dictionary.keys() a list and not a set?

2005-11-23 Thread Christoph Zwerschke
Ok, the answer is easy: For historical reasons - built-in sets exist only since Python 2.4. Anyway, I was thinking about whether it would be possible and desirable to change the old behavior in future Python versions and let dict.keys() and dict.values() both return sets instead of lists. If d

Re: FTP over TLS

2005-11-23 Thread Paul Rubin
Carl Waldbieser <[EMAIL PROTECTED]> writes: > Does anyone know of any good examples for writing client side code > to upload files over a secure FTP connection? I am referring to > FTPS, *not* SFTP, which I found out the hard way are two different > things. I am not really all that familiar with

  1   2   3   4   >