Re: Python obfuscation

2005-11-16 Thread Mike Meyer
"Ben Sizer" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> "Ben Sizer" <[EMAIL PROTECTED]> writes: >> > In my >> > case, providing a free download of any lost executables or data upon >> > presentation of a legitimate licen

Re: How to write an API for a Python application?

2005-11-16 Thread Mike Meyer
"Eric Brunel" <[EMAIL PROTECTED]> writes: > On 16 Nov 2005 06:18:05 -0800, Paul Boddie <[EMAIL PROTECTED]> wrote: >> One technology that I used many years ago with Python, and which should >> still do the job is CORBA - at that time ILU, but I suppose the various >> other ORBs should also be as cap

Re: Python obfuscation

2005-11-16 Thread Mike Meyer
"The Eternal Squire" <[EMAIL PROTECTED]> writes: > A fair request. The teaching of legality and ethics of incorporating > other peoples' works into one's own should begin at 6th grade and be > repeated every year until the message is driven home. Right. You want to teach potential programmers th

Re: JMS yet again

2005-11-16 Thread Mike Meyer
Ben Finney <[EMAIL PROTECTED]> writes: > Aahz <[EMAIL PROTECTED]> wrote: >> Am I the only person who immediately thought of Babylon 5 and >> wondered if I was in the wrong newsgroup? > > I plead guilty. Well, I thought of Crusade. But I'd just finished watching those. htt

Re: Python obfuscation

2005-11-16 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> Alex's solution doesn't require special treatment for disaster >> recovery and/or planning, and as such is a valid answer to the > I'm not sure I understand this. I would a

Re: python-mysqldb__debian_to_freebsd

2005-11-16 Thread Mike Meyer
Damjan <[EMAIL PROTECTED]> writes: >> Is there any at all chance that this will work >> with the proper configs or should I go ahead >> and beg the host for an installation ? > It seems to me very unlikely that a program compiled for FreeBSD would link > to a library compiled for Debian Linux

Re: How to write an API for a Python application?

2005-11-17 Thread Mike Meyer
"Eric Brunel" <[EMAIL PROTECTED]> writes: > On Wed, 16 Nov 2005 15:43:33 -0500, Mike Meyer <[EMAIL PROTECTED]> wrote: > >> "Eric Brunel" <[EMAIL PROTECTED]> writes: >>> On 16 Nov 2005 06:18:05 -0800, Paul Boddie <[EMAIL PROTECTED]>

Re: Python obfuscation

2005-11-17 Thread Mike Meyer
Chris Mellon <[EMAIL PROTECTED]> writes: > Your rights are anything you can do that is not forbidden - the US > constitution is explicitly designed in this way, something that people > often forget. There is no difference between an "explicit" and an > "inferred" right, by design. If you read the t

Re: install python2.4 on FreeBSD and keep using python2.3

2005-11-17 Thread Mike Meyer
Ksenia Marasanova <[EMAIL PROTECTED]> writes: > Hi, > > I have python2.3, installed from port /lang/python long time ago. The > current version is 2.4, but I'd rather have two python versions, > instead of upgrading. > Is there maybe a way to somehow link installed python to > /lang/python2.3 port

Re: How to write an API for a Python application?

2005-11-17 Thread Mike Meyer
[EMAIL PROTECTED] (Cameron Laird) writes: > In article <[EMAIL PROTECTED]>, > Paul Boddie <[EMAIL PROTECTED]> wrote: > . >>meaning that callbacks and other things just work. Rolling your own >>solution, on the other hand, can end in a long road discovering what >>those CORBA p

Re: Zope vs Php

2005-11-17 Thread Mike Meyer
"Steve" <[EMAIL PROTECTED]> writes: > I am going to go the mod_python route. > > as for why a person would go route one over route 2 > > is that the number of lines of html/output vs python code are usually > 10 to 1 and it's much easier to encapsulate the python code than to > quote and escape al

Re: Importing a class without knowing the module

2005-11-17 Thread Mike Meyer
Franck PEREZ <[EMAIL PROTECTED]> writes: > ### My test application > class Foo(object): > #The class I'd like to serialize > pass > > import myMarshaller > foo = Foo() > s = myMarshaller.dumps(foo) #works fine, spits something like class = "Foo"...> > another_foo = loads(s

Re: Importing a class without knowing the module

2005-11-17 Thread Mike Meyer
[Format recovered from top posting.] Franck PEREZ <[EMAIL PROTECTED]> writes: > On 11/18/05, Mike Meyer <[EMAIL PROTECTED]> wrote: >> Franck PEREZ <[EMAIL PROTECTED]> writes: >> > ### My test application >> > class Foo(obj

Re: Zope vs Php

2005-11-17 Thread Mike Meyer
Jorge Godoy <[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> That said, I have to confess that lately I've been using Cheetah >> templates, because the syntax for inserting values is simpler, and the >> way Cheetah templates wo

Re: Importing a class without knowing the module

2005-11-17 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> >> How about adding Foo.__file__ to the serialized data? >> > I thought about it, but it would make the XML file depend on the >> > machine... no more portability... >

Re: install python2.4 on FreeBSD and keep using python2.3

2005-11-17 Thread Mike Meyer
Xiao Jianfeng <[EMAIL PROTECTED]> writes: > Can I install python2.4.2 and keep using python2.4.1 on IRIX? Yes, but you'll have to install it with a different prefix. Use the --prefix flag to configure when you install it. http://www.mired.org/home/mwm/ Independent WWW/

Re: Zope vs Php

2005-11-17 Thread Mike Meyer
Jorge Godoy <[EMAIL PROTECTED]> writes: >> While I'm at it - how does KID do for things that aren't HTML? >> Cheetah integrates with web servers, but can be used to generate >> nearly anything. I've found that using Cheetah scripts to build >> Makefiles that run Cheetah scripts to build a dynamical

Re: Importing a class without knowing the module

2005-11-17 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >... >> >> >> How about adding Foo.__file__ to the serialized data? >... >> >> depends on somewhere on it. You can use the module name if you have it >> >

Re: Choose meaningful subjects for posts [was: Re: newb ?]

2005-11-18 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > Fredrik Lundh wrote: >> Chad Everett wrote: >>>I am back. >>>No I am not a high school or college student. >> your subject lines still suck. please read this >> http://www.catb.org/~esr/faqs/smart-questions.html#bespecific >> before you post your next

Re: Importing a class without knowing the module

2005-11-18 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >... >> A classes __module__ attribute doesn't always tell you the name of the >> module - or at least, not a name that would be usefull for the the OPs >> use case. That&

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread Mike Meyer
"Daniel Crespo" <[EMAIL PROTECTED]> writes: > Hi! > > I would like to know how can I do the PHP ternary operator/statement > (... ? ... : ...) in Python... > > I want to something like: > > a = {'Huge': (quantity>90) ? True : False} > > Any suggestions? Lots of ways, depending on your exact needs

Re: Importing a class without knowing the module

2005-11-18 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >... >> > How do you arrange a module so that its classes' __module__ attributes >> > don't tell you the name of the module "that would be useful", yet the >

Re: Choose meaningful subjects for posts

2005-11-18 Thread Mike Meyer
Micah Elliott <[EMAIL PROTECTED]> writes: > On Nov 18, [EMAIL PROTECTED] wrote: >> Grant> Obligatory aside: I'm completely baffled why anybody would choose >> Grant> the mailing list format over Usenet. I don't even read mailing >> Grant> lists via mailing lists. I recommend gmane.org

Re: Importing a class without knowing the module

2005-11-18 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > You did help me to better understand some of the roots of your many > mistaken assertions in this thread, from your first "How about adding > Foo.__file__" proposal onwards, yes -- thank you. I claim I haven't made a single mistaken assertion in this th

Re: Hot to split string literals that will across two or more lines ?

2005-11-19 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Brackets include: > > parentheses or round brackets ( ) > square brackets [ ] > braces or curly brackets { } > chevrons or angle brackets 〈 〉 > > The symbols for chevrons are not available on common keyboards, are not > available in ordinary ASCII,

Re: Underscores in Python numbers

2005-11-19 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 19 Nov 2005 13:08:57 -0500, Peter Hansen wrote: >> Umm... in other words, "the underscore is under-used so let's assign >> some arbitrary meaning to it" (to make the language more like Perl >> perhaps?). > > +1 > > I *really* don't like the id

Re: newbie-question about a list

2005-11-19 Thread Mike Meyer
[EMAIL PROTECTED] writes: > I've seen this construct in a script [x.capitalize() for x in ['a','b', 'c']] > ['A', 'B', 'C'] > I tried to find a description of this in "Library Reference" but > couldn't find it. Could somebody direct me where this type of construct > is described. As others ha

Re: Can a function access its own name?

2005-11-19 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Thanks Diez and Peter, > Just what I was looking for. In "Library Reference" heading > 3.11.1 Types and members > Running this yields the result > > cap(s, n) You've now got three solutions. They'll work fine most of the time, but can't be trusted in general. Bindin

Re: Underscores in Python numbers

2005-11-19 Thread Mike Meyer
Roy Smith <[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> I've seen at least one language (forget which one) that allowed such >> separators, but only for groups of three. > That seems a bit silly. Not all numbers are naturally split in

Re: Delays getting data on sys.stdin.readline() ?

2005-11-19 Thread Mike Meyer
Christian Convey <[EMAIL PROTECTED]> writes: > I've got a program that (ideally) perpetually monitors sys.stdin for > lines of text. As soon as a line comes in, my program takes some > action. > The problem is, it seems like a very large amount of data must > accumulate on sys.stdin before even my

Re: Where can I find string.translate source?

2005-11-20 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Inside the file string.py I couldn't find the source code for > translate. Where could it be? Object/stringmodule.c in the python source distribution. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for m

Re: what happens when the file begin read is too big for all lines tobe?read with "readlines()"

2005-11-20 Thread Mike Meyer
"Ross Reyes" <[EMAIL PROTECTED]> writes: > Yes, I have read this part > How does one tell exactly what the limitation is to the size of the > returned list of strings? There's not really a good platform-indendent way to do that, because you'll get memory until the OS won't give you any more.

Re: Why are there no ordered dictionaries?

2005-11-20 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Ben Finney wrote: >> Another possibility: ordered dictionaries are not needed when Python >> 2.4 has the 'sorted' builtin. > The 'sorted' function does not help in the case I have indicated, > where "I do not want the keys to be sorted alphabeticall

Re: ignore specific data

2005-11-21 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Hi I need help. What I want to do is If I read a file with some text > content... > I would like to ignore a block of lines and consider the rest.. > so if the block starts with > > "start of block." > fjesdgsdhfgdlgjklfjdgkd > jhcsdfskdlgjkljgkfdjkgj > "end

Re: ignore specific data

2005-11-21 Thread Mike Meyer
[EMAIL PROTECTED] writes: > thanks for that. But this will check for the exact content of the > "start of block.." or "end of block". How about if the content is > anywhere in the line? Then the test is '"start of block." in line'. You could also use the line.find or line.index methods, b

Re: Looking for magic method to override to prevent dict(d) from grabbing subclass inst d contents directly

2005-11-22 Thread Mike Meyer
[EMAIL PROTECTED] (Bengt Richter) writes: > Has anyone found a way besides not deriving from dict? > Shouldn't there be a way? > TIA > (need this for what I hope is an improvement on the Larosa/Foord OrderedDict > ;-) > > I guess I can just document that you have to spell it dict(d.items()), but I

Re: matching a string to extract substrings for which some function returns true

2005-11-22 Thread Mike Meyer
Amit Khemka <[EMAIL PROTECTED]> writes: > Well actually the problem is I have a list of tuples which i cast as > string and then > put in a html page as the value of a hidden variable. And when i get > the string again, > i want to cast it back as list of tuples: > ex: > input: "('foo', 1, 'foobar'

Re: wxPython Licence vs GPL

2005-11-22 Thread Mike Meyer
"John Perks and Sarah Mount" <[EMAIL PROTECTED]> writes: > How should we refer to this in terms of copyright statements and bundled > Licence files? Is there, say, a standard wording to be appended to the > GPL header in each source file? Does the original author need to be > named as one of the c

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Mike Meyer
"Steve R. Hastings" <[EMAIL PROTECTED]> writes: > I have been studying Python recently, and I read a comment on one > web page that said something like "the people using Python for heavy math > really wish they could define their own operators". The specific > example was to define an "outer prod

Re: about sort and dictionary

2005-11-22 Thread Mike Meyer
[EMAIL PROTECTED] writes: > I think this is just another (admittedly minor) case of Python's > designers using Python to enforce some idea of programming > style purity. You say that as if it were a bad thing. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/U

Re: Anyway to clarify this code? (dictionaries)

2005-11-22 Thread Mike Meyer
"javuchi" <[EMAIL PROTECTED]> writes: > I've been searching thru the library documentation, and this is the > best code I can produce for this alogorithm: > > I'd like to return a dictionary which is a copy of 'another' dictionary > whoes values are bigger than 'x' and has the keys 'keys': > > def

Re: Anyway to clarify this code? (dictionaries)

2005-11-22 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> def my_search(another, keys, x): >>return dict([[k, v] for k, v in another.items() if v >= x and k in keys]) >> But then you're looking through all the keys in another, and se

Re: Looking for magic method to override to prevent dict(d) from grabbing subclass inst d contents directly

2005-11-22 Thread Mike Meyer
[EMAIL PROTECTED] (Bengt Richter) writes: >>I'm not sure exactly what you mean by "grabbing sublass inst d contens >>directly", but if dict(d.items()) does it, the above class should do >>it as well. Of course, *other* ways of initializing a dict won't work >>for this class. >> > It's not initializ

Re: What a curious assignment.

2005-11-22 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > [test 1] class A: > ...i = 1 > ... a = A() A.i > 1 a.i > 1 A.i = 2 A.i > 2 a.i > 2 > > [test2] class A: > ...i = 1 > ... a = A() A.i > 1 a.i > 1 a.i = 2 A.i > 1 a.i

Re: What a curious assignment.

2005-11-23 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > I believe he knows about inheritance, but not about the behaviour of > the assignment. In many other OO languages, I believe you cannot have > the same name for both instance variable and class variable. javascript > has similar behaviour. I think

Re: newbie class question

2005-11-23 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Sorry folks, this is what I meant: > class heh(object): > ... def __init__(self): > ... self.foo='hello' > ... def change(self): > ... self.foo+=' world' > ... def show(self): > ... return self.foo > ... > ... class hih(object

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: 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: 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 do

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: 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: 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. &

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: >> 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 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: 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: 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: wxPython Licence vs GPL

2005-11-24 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > 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

Re: Making immutable instances

2005-11-24 Thread Mike Meyer
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > 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

Re: wxPython Licence vs GPL

2005-11-24 Thread Mike Meyer
"Martin P. Hellwig" <[EMAIL PROTECTED]> writes: > If the non-techie is still interested, I'll rave on about that I > understand why GPL is a good way to ensure availability of IP > especially if the software is a collaborated effort in the academic > scene. Your comment about the GPL "ensuring ava

Re: return in loop for ?

2005-11-24 Thread Mike Meyer
Duncan Booth <[EMAIL PROTECTED]> writes: > In practice it is impossible to write code in Python (or most > languages) with only one return point from a function: any line could throw > an exception which is effectively another return point, so the cleanup has > to be done properly anyway. This

Re: Making immutable instances

2005-11-24 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> "Giovanni Bajo" <[EMAIL PROTECTED]> writes: >> > Mike Meyer wrote: >> >> Note that this property of __slots__ is an implementation detail. You >> >> can&

Re: Making immutable instances

2005-11-24 Thread Mike Meyer
Ben Finney <[EMAIL PROTECTED]> writes: > I'm looking for a "consenting adults" restriction: classes will have > immutable instances only where it makes sense from the class protocol. > I'm not going to lose sleep over users who go looking for trouble. I think you're defining immutable differently

Re: Python as Guido Intended

2005-11-24 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >> The usual response is "That's not the Python way." That's not calling >> someone dumb, just pointing out that they don't yet fully understand >> the Python way. > "That is not the Python way", is just saying "Python doesn't have it" > in other words. So

Re: return in loop for ?

2005-11-24 Thread Mike Meyer
Roy Smith <[EMAIL PROTECTED]> writes: > In any case, in a language which has exceptions, it's almost impossible to > really have true SESE, since an exception could be thrown from almost > anywhere. To be fair, there are those who use this to argue that > exceptions themselves are a bad thing.

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

2005-11-24 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > - Because sets can only contain immutable values Not true. Sets can only contain *hashable* objects, which isn't the same thing. > This, of course, in turn raises the question ;-) Would it be desirable > to have an additional, more general set dat

Re: wxPython Licence vs GPL

2005-11-24 Thread Mike Meyer
"Martin P. Hellwig" <[EMAIL PROTECTED]> writes: >> "Martin P. Hellwig" <[EMAIL PROTECTED]> writes: >>> If the non-techie is still interested, I'll rave on about that I >>> understand why GPL is a good way to ensure availability of IP >>> especially if the software is a collaborated effort in the ac

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

2005-11-24 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: >>>- Because sets can only contain immutable values > > Mike Meyer wrote: > >> Not true. Sets can only contain *hashable* objects, which isn't the >> same thing. > > I trusted the doco which defines a

Re: wxPython Licence vs GPL

2005-11-24 Thread Mike Meyer
"Martin P. Hellwig" <[EMAIL PROTECTED]> writes: > Those who can not afford the software are excluded for that end > product even though they may have worked on the source where 99,99% of > the restricted licensed software is based on. Well, they chose to make it available to others for reuse. But

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

2005-11-24 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Mike Meyer schrieb: >> If the hash changes, you've screwed up the set. What it really should >> say is "collection of objects with fixed hashes", or words to that >> effect. Do you want to file a PR on this

Re: Python as Guido Intended

2005-11-24 Thread Mike Meyer
[EMAIL PROTECTED] writes: > "Mike Meyer" <[EMAIL PROTECTED]> writes: >> [EMAIL PROTECTED] writes: >> > Different programming styles are appropriate for different >> > tasks, different times and different places, different people. >> > And like

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

2005-11-24 Thread Mike Meyer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>>I trusted the doco which defines a set as "an unordered collection of >>>immutable values" (http://docs.python.org/lib/types-set.html). >> If the hash changes, you&#

Re: wxPython Licence vs GPL

2005-11-24 Thread Mike Meyer
"Martin P. Hellwig" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: > >> Well, they chose to make it available to others for reuse. But >> software "unavailable to those who can't afford it" is better than "no >> software at all"

Re: wxPython Licence vs GPL

2005-11-24 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> On the other hand, so long as the price is lower than the cost of >> recreating the software for someone, then it's better for society as >> a whole if it exists

Re: Making immutable instances

2005-11-24 Thread Mike Meyer
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > 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

Re: Making immutable instances

2005-11-24 Thread Mike Meyer
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > Björn Lindström wrote: > Why do you think we have a frozenset, for instance? By Mike's argument, we > shouldn't have it. Not *my* arguments, certainly. Not unless you're seriously misinterpreting them. http://www.mired.org

Re: Making immutable instances

2005-11-24 Thread Mike Meyer
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> And I have no problems with that. If you believe your class should >> throw an error if someone calls an instances pop() method when it's >> empty, do so. >> Likewise, if y

Re: Making immutable instances

2005-11-24 Thread Mike Meyer
Paul Rubin writes: > "Giovanni Bajo" <[EMAIL PROTECTED]> writes: >> > However, when you prevent a client from adding an attribute, you're >> > not merely making your objects immutable, you're making them >> > static. > No I don't believe that. If an object is immutable,

Re: Making immutable instances

2005-11-24 Thread Mike Meyer
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>> Björn Lindström wrote: >>> Why do you think we have a frozenset, for instance? By Mike's >>> argument, we shouldn't have it. >> Not *my* arguments, certainly. Not un

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

2005-11-24 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Christoph Zwerschke wrote: >> [EMAIL PROTECTED] schrieb: >> > 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]) >> Good point. I expe

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

2005-11-24 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >> Not all tuples can be elements of a set. Elements of a set have to be >> hashable. Tuples compute their hash by hashing their contents. If >> their contents aren't hashable, the tuple isn't hashable, and hence >> can't be an element of a set. If th

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

2005-11-25 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > As a general note, I think it would be good to place the exact > description in a footnote, since speaking about hashable objects, > __hash__ and __cmp__ will certainly frighten off newbies and make it > hard to read even for experienced users. The

Re: Python as Guido Intended

2005-11-25 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-11-24, Mike Meyer schreef <[EMAIL PROTECTED]>: >> Antoon Pardon <[EMAIL PROTECTED]> writes: >>>> The usual response is "That's not the Python way." That's not calling >>>&g

Re: Python as Guido Intended

2005-11-25 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Well this is, is one thing I have a problem with. > > The python people seem to be more concerned with fighting things > that could be used counter the python philosophy, than search for > things that enable working in the python philosophy. And what's w

Re: Making immutable instances

2005-11-25 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> There isn't a standard serialize method in Python, so I don't know how >> you want to define it. >> I can think of perfectly reasonable definitions >> of se

Re: wxPython Licence vs GPL

2005-11-25 Thread Mike Meyer
"Paul Boddie" <[EMAIL PROTECTED]> writes: > Ed Jensen wrote: > [On proprietary ports of Python...] >> Show me the harm done. > We'll have to wait and see what happens. There's a risk that versions > of Python with different semantics or characteristics to the original > could cause the development

Re: Which License Should I Use?

2005-11-25 Thread Mike Meyer
"mojosam" <[EMAIL PROTECTED]> writes: > I will be doing the bulk of the coding on my own time, because I need > to be able to take these tools with me when I change employers. > However, I'm sure that in the course of using these tools, I will need > to spend time on the job debugging or tweaking t

Re: Which license should I use?

2005-11-25 Thread Mike Meyer
[EMAIL PROTECTED] (Björn Lindström) writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> IANAL, but I don't believe the GPL helps in this situation. It places >> conditions on redistributing the code; it doesn't force you to >> redistribute modifieed code. Y

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

2005-11-25 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Mike Meyer schrieb: >> Ok, how about this for dictionaries/sets: >> Any hashable object can be used as a dictionary key (set >> member). Immutable >> objects, except for tuples that contain a non-hashable object, ar

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

2005-11-25 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: > > The mutability - or immutability - of an object is irrelevant to > > the question of whether or not they can be a dictionary key/set > > element. The critical property is that they are hash

Re: Making immutable instances

2005-11-25 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Thu, 24 Nov 2005 11:44:16 -0500, Mike Meyer wrote: >> In Python, I can even fix >> it so *your* code uses my wrapped version: >> >> import Finney >> class Addable(Finnney.Immutable): pass >> Finney.

Re: wxPython Licence vs GPL

2005-11-25 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Thu, 24 Nov 2005 16:00:29 -0500, Mike Meyer wrote: > The GPL doesn't restrict distribution. I don't understand where > people get this bizarre view of the GPL from.> It happens because people say things like: >

Re: Making immutable instances

2005-11-25 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > "Hmmm, the class designer didn't want me adding attributes to instances... > maybe he had a good reason for that..." When it was suggested that a facility for doing this be added to the language, I asked for a use case for it. Nobodies come up with a r

Re: wxPython Licence vs GPL

2005-11-26 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > But if you *do* redistribute it, then you must live up to conditions in > the licence. If you aren't willing to do that, use software with a > different licence. That's a restriction on redistribution. > The only restriction is that you can't give th

Re: Python as Guido Intended

2005-11-26 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> Those two statements say the same thing. Part of the Python philosphy, >> from "import this", is that there should only be one obvious way to do >> it. By enabl

Re: Making immutable instances

2005-11-26 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Fri, 25 Nov 2005 23:20:05 -0500, Mike Meyer wrote: >> If you've got a use case, I'd be interested in hearing it. > frozenset perhaps? If it were needed once, it could be needed again. That's not a use case,

Re: Which License Should I Use?

2005-11-26 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > Simply assuming that because you have developed the code "in your own > time" you have sole rights to it, or even a right to redistribute, is > likely to lead to trouble and I would recommend against that course of > action. The employment agreement may s

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

2005-11-26 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: > > I think you're trying to tweak the wrong definition. Types are > > immutable if their instances are immutable. > I'm not trying to tweak it, but to gain more clarity about what is &g

Re: Making immutable instances

2005-11-26 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 26 Nov 2005 04:59:59 -0500, Mike Meyer wrote: >> Steven D'Aprano <[EMAIL PROTECTED]> writes: >>> On Fri, 25 Nov 2005 23:20:05 -0500, Mike Meyer wrote: >>>> If you've got a use case, I&#x

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

2005-11-26 Thread Mike Meyer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>>class mylist1(list): >>> def __hash__(self): return 0815 >>> >>>class mylist2(list): >>> def __hash__(self): return id(self) >>> >>>In the

<    2   3   4   5   6   7   8   9   10   11   >