Re: Python obfuscation

2005-11-16 Thread Steven D'Aprano
idea. > "It was MY idea!!!" "No, it's NOT!!!" "Is TOO!!!" That's what happens when you try to teach 6th graders about intellectual property: they revert back to two year old mentality. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal for adding symbols within Python

2005-11-16 Thread Steven Bethard
Pierre Barbier de Reuille wrote: > Proposal > > > First, I think it would be best to have a syntax to represent symbols. > Adding some special char before the name is probably a good way to > achieve that : $open, $close, ... are $ymbols. How about using the prefix "symbol." instead of "

Re: is parameter an iterable?

2005-11-16 Thread Steven D'Aprano
Fredrik Lundh wrote: > Steven D'Aprano wrote: > > >>This means we're no longer assuming what the error message will be, >>which makes our code a lot more future-proof and implementation-proof: if >>some version of Python changes the error string from "i

Re: is parameter an iterable?

2005-11-17 Thread Steven D'Aprano
. >>> iter Traceback (most recent call last): File "", line 1, in ? NameError: name 'iter' is not defined What should I do when I can't rely on functions that don't exist in older versions of Python? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: is parameter an iterable?

2005-11-17 Thread Steven D'Aprano
is not quite as future-proof as I thought it was. Since a better solution does exist, I agree it should be used in preference to my crappy one, assuming you are running a recent enough version of Python. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python obfuscation

2005-11-17 Thread Steven D'Aprano
t's right, they are the Authorities, and the Authorities can do no wrong. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Library Reference - question

2005-11-17 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > The "Python LIbrary Reference" at > http://docs.python.org/lib/contents.html seems to be an important > document. I have two questions > > Q1. How do you search inside "Python LibraryReference" ? Does it exist > in pdf or chm form? One other option. Go to google and us

how to organize a module that requires a data file

2005-11-17 Thread Steven Bethard
Ok, so I have a module that is basically a Python wrapper around a big lookup table stored in a text file[1]. The module needs to provide a few functions:: get_stem(word, pos, default=None) stem_exists(word, pos) ... Because there should only ever be one lookup table, I feel lik

Re: how to organize a module that requires a data file

2005-11-17 Thread Steven Bethard
Terry Hancock wrote: > On Thu, 17 Nov 2005 12:18:51 -0700 > Steven Bethard <[EMAIL PROTECTED]> wrote: > >>My problem is with the text file. Where should I keep it? >> >>I can only think of a few obvious places where I could >>find the text file at import

Re: how to organize a module that requires a data file

2005-11-17 Thread Steven Bethard
Larry Bates wrote: > Personally I would do this as a class and pass a path to where > the file is stored as an argument to instantiate it (maybe try > to help user if they don't pass it). Something like: > > class morph: > def __init__(self, pathtodictionary=None): > if pathtodictiona

textwrap.dedent() drops tabs - bug or feature?

2005-11-17 Thread Steven Bethard
So I've recently been making pretty frequent use of textwrap.dedent() to allow me to use triple-quoted strings at indented levels of code without getting the extra spaces prefixed to each line. I discovered today that not only does textwrap.dedent() strip any leading spaces, but it also substi

Re: How to convert a "long in a string" to a "long"?

2005-11-18 Thread Steven Bethard
[EMAIL PROTECTED] wrote: 0xL > > 4294967295L > > OK, this is what I want, so I tried > > s = long("0xL") > ValueError: invalid literal for long(): 0xL >>> int("0x", 0) 4294967295L STeVe -- http://mail.python.org/mailman/listinfo/python-list

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

2005-11-18 Thread Steven D'Aprano
languages, for instance French and Italian, and sometimes Dutch. When used as quote marks, the French term guillemet is sometimes used as synonym for chevron. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: different binding behavior

2005-11-18 Thread Steven D'Aprano
change from version to version, and is not generally true: py> x = 0; y = 3-3 py> x == y True py> x is y True py> x = 35791; y = 3579*10+1 py> x == y True py> x is y False So in general, there can be many instances of int with the same value. That's not

Re: How to convert a "long in a string" to a "long"?

2005-11-18 Thread Steven D'Aprano
t can I do? >> >> Thank you in advance. >> Stefan > > Leave out the "0x" prefix and tell long() that you're using base 16: > >>>> long("", 16) > 4294967295L Or leave the prefix in, and tell Python to use the prefix to predict the base: py> long("0xL", 0) 4294967295L -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert a "long in a string" to a "long"?

2005-11-18 Thread Steven D'Aprano
On Fri, 18 Nov 2005 17:49:50 +, Leif K-Brooks wrote: > Sion Arrowsmith wrote: >> Steven Bethard <[EMAIL PROTECTED]> wrote: >> >>>[EMAIL PROTECTED] wrote: >>> >>>>s = long("0xL") >>>>ValueErro

Re: Python obfuscation

2005-11-18 Thread Steven D'Aprano
you find a way to make water not wet and three-sided squares, then you can turn your mind towards solving the *really* hard problem: how to make bytes not copyable. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread Steven D'Aprano
ned way? if cond: x = true_value else: x = false_value It is easy to read, easy to understand, only one of true_value and false_value is evaluated. It isn't a one-liner. Big deal. Anyone would think that newlines cost money or that ever time you used one God killed a kitten. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Underscores in Python numbers

2005-11-18 Thread Steven D'Aprano
tes string literals: "abc" "def" is the same as "abcdef". Perhaps Python should concatenate numeric literals at compile time: 123 456 is the same as 123456. Off the top of my head, I don't think this should break any older code, because 123 456 is not currently

Re: the PHP ternary operator equivalent on Python

2005-11-18 Thread Steven D'Aprano
On Fri, 18 Nov 2005 21:05:50 -0800, [EMAIL PROTECTED] wrote: > Steven D'Aprano wrote: >> WHY WHY WHY the obsession with one-liners? What is wrong with the good old >> fashioned way? >> >> if cond: >> x = true_value >> else: >> x = false_

Re: Immutable instances, constant values

2005-11-19 Thread Steven D'Aprano
, you should be able to rebind enums and face the consequences (good bad or indifferent) as best you can. Possibility (3) is the logical solution. It shouldn't matter what labels we put on the enums. But I fear not practical unless the enums are implemented as Singletons (multitons?), and perhaps not even then. Alternatively, you could bypass the whole problem by making enums immutable. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Underscores in Python numbers

2005-11-19 Thread Steven D'Aprano
On Sat, 19 Nov 2005 01:33:40 -0800, bearophileHUGS wrote: > Steven D'Aprano: >> Perhaps Python should concatenate numeric literals at compile time: >> 123 456 is the same as 123456. > > I think using the underscore it is more explicit: > n = 123_456 It is also easy

Re: textwrap.dedent() drops tabs - bug or feature?

2005-11-19 Thread Steven Bethard
Peter Hansen wrote: > Steven Bethard wrote: > >> Note that even though the tabs are internal, they are still removed by >> textwrap.dedent(). The documentation[1] says: > > ... > >> So it looks to me like even if this is a "feature" it is undocument

Re: Underscores in Python numbers

2005-11-19 Thread Steven D'Aprano
rbitrary bases is not, in my opinion, common enough a task that support for it needs to be built into the syntax for literals. If somebody cares enough about it, write a module to handle it and try to get it included with the Python standard modules. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Immutable instances, constant values

2005-11-19 Thread Steven D'Aprano
On Sun, 20 Nov 2005 08:56:33 +1100, Ben Finney wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> On Fri, 18 Nov 2005 14:32:46 +1100, Ben Finney wrote: >> > Is there any difference between a Python immutable value, and a >> > constant? I suppose "c

Re: Underscores in Python numbers

2005-11-19 Thread Steven D'Aprano
On Sun, 20 Nov 2005 01:39:04 +, Steve Holden wrote: > Steven D'Aprano wrote: > [...] >> Likewise, base conversion into arbitrary bases is not, in my opinion, >> common enough a task that support for it needs to be built into the syntax >> for literals. If somebody

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

2005-11-19 Thread Steven D'Aprano
ill close the file eventually, but you can't guarantee when. > And what shoud I do if I want to explicitly close the file immediately > after reading all data I want? That is the best practice. f.close() -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

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

2005-11-19 Thread Steven D'Aprano
On Sat, 19 Nov 2005 22:51:04 -0500, Mike Meyer wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> Brackets include: >> >> parentheses or round brackets ( ) >> square brackets [ ] >> braces or curly brackets { } >> chevrons or angle brack

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

2005-11-19 Thread Steven D'Aprano
ieve Python will take advantage of your file system's buffering capabilities. Try it and see, you'll be surprised how fast it runs. If you try it and it is too slow, then come back and we'll see what can be done to speed it up. But don't try to speed it up before you know if it is fast enough. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

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

2005-11-19 Thread Steven D'Aprano
On Sun, 20 Nov 2005 16:10:58 +1100, Steven D'Aprano wrote: > def get_line(filename, token): > """Returns the next line following a token, or None if not found. > Leading and trailing whitespace is ignored when looking for > the token. > "&qu

Re: Underscores in Python numbers

2005-11-20 Thread Steven D'Aprano
ill be enough to justify changing the way Python handles numeric literals -- Guido seems quite conservative in what he adds to the language, so unless there is either great demand or it scratches a particular itch he has personally, I doubt it will fly. But we'll never know unless we try, hey

Re: Underscores in Python numbers

2005-11-20 Thread Steven D'Aprano
in any reasonable time. Numeric programming often uses magic constants which truly are "magic" (in the sense that where they come from requires deep, difficult, and sometimes hidden knowledge). Nobody sensible wants to be typing in long strings of digits, but sometimes it is un

Re: Aproximative string matching

2005-11-20 Thread Steven D'Aprano
edit distance of dist from the target. """ found = [] for s in strlist: if levenshtein(s, target) <= dist: found.append(s) return s -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: best cumulative sum

2005-11-20 Thread Steven D'Aprano
it does do that it shouldn't? You could do it this way: # untested def cumulative_sum(L): CL = [] csum = 0 for x in L: csum += x CL.append(csum) return CL Whether it is better or worse depends on what you consider better or worse. -- Steven. --

Re: duplicate items in a list

2005-11-21 Thread Steven D'Aprano
(item) return U The trick you are trying to do with _ is undocumented and, even if you get it to work *now*, is probably not going to work in the future. Don't do it. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

the name of a module in which an instance is created?

2005-11-21 Thread Steven Bethard
The setup: I'm working within a framework (designed by someone else) that requires a number of module globals to be set. In most cases, my modules look like: (1) a class definition (2) the creation of one instance of that class (3) binding of the instance methods to the appropriate module global

Re: Aproximative string matching

2005-11-21 Thread Steven D'Aprano
welve, not three. With len(cat)=3 and len(hippopothamus) = 13, you need ten insertions just to get the lengths equal, so the L-distance must be at least ten. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Backwards compatibility [was Re: is parameter an iterable?]

2005-11-21 Thread Steven D'Aprano
Fredrik Lundh wrote: > Steven D'Aprano wrote: > > >>Alas and alack, I have to write code which is backwards >>compatible with older versions of Python: [snip] >>What should I do when I can't rely on functions that >>don't exist in older versio

Re: Backwards compatibility [was Re: is parameter an iterable?]

2005-11-21 Thread Steven D'Aprano
es should be set for life. Hah, I wish! Thanks for the assistance, I learnt a lot. Let's hope I don't have to use it ever again... -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Steven D'Aprano
tuff > > But math folks usually name things after the person(s) who came > up with the idea, not just some random implementer. No no no! In maths things are usually named after Euler, or the first person to discover them after Euler. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a flat list to a list of tuples

2005-11-22 Thread Steven D'Aprano
x27;b', 2), ('c', 3)] If you absolutely need the inner tuples to be lists, use a list comprehension afterwards: [list(t) for t in zip(['a', 'b', 'c'], [1, 2, 3])] -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a flat list to a list of tuples

2005-11-22 Thread Steven D'Aprano
fall to my knees in admiration of a Cool Hack, or recoil in horror at a Bogus Kludge :-) The code looks like it should return [('a', 'a'), (1, 1), ('b', 'b'), (2, 2), ('c', 'c'), (3, 3)] but of course it does not: the arguments for zip are not independent. I guess it is more of a Neat Trick, with a dash of Gotcha For The Unwary. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

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

2005-11-22 Thread Steven D'Aprano
he whole sample string and check the > condition, Yes. Where does the string come from? Can a hostile user pass bad strings to you and crash your code? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: the name of a module in which an instance is created?

2005-11-22 Thread Steven Bethard
Mardy wrote: > I'm not sure I got your problem correctly, however see if this helps: > > $ cat > test.py > class myclass: > name = __module__ > ^D > [snip] > > >>> import test > >>> a = test.myclass() > >>> a.name > 'test' > > This works, as we define "name" to be a class attribute. > Is th

Re: about sort and dictionary

2005-11-22 Thread Steven D'Aprano
t flexible is a combination of (3) and (4). Python now has that with sort() and sorted(). Prior to the addition of sorted() to the language, (3) was considered the best solution because of a simple Python principle: never duplicate objects unless explicitly told to. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-22 Thread Steven D'Aprano
) the safest position is to claim you've never read a book, seen a line of code, been to the movies or heard a song in your life. (Only half joking.) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Steven D'Aprano
x that I don't object to, although that's not saying much. In mathematics, there are operators of a plus sign within a circle, multiply sign within a circle, etc. The closest we can get in plain ASCII would be: m0(+)m1 m0(*)m1 m0(-)m1 etc. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

defining the behavior of zip(it, it) (WAS: Converting a flat list...)

2005-11-22 Thread Steven Bethard
[Duncan Booth] > >>> aList = ['a', 1, 'b', 2, 'c', 3] > >>> it = iter(aList) > >>> zip(it, it) >[('a', 1), ('b', 2), ('c', 3)] [Alan Isaac] > That behavior is currently an accident. >http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=1121416 [Bengt Richter] > That sa

Re: defining the behavior of zip(it, it) (WAS: Converting a flat list...)

2005-11-22 Thread Steven Bethard
[EMAIL PROTECTED] wrote: >> > ii. The other problem is easier to explain by example. >> > Let it=iter([1,2,3,4]). >> > What is the result of zip(*[it]*2)? >> > The current answer is: [(1,2),(3,4)], >> > but it is impossible to determine this from the docs, >> > which would allow [(1,3),(2,4)] inste

Re: about sort and dictionary

2005-11-22 Thread Steven D'Aprano
[EMAIL PROTECTED] wrote: > Steven D'Aprano wrote: > >>There are four possibilities for a construction like list.sort(): >> >>(1) sort the list in place and return a reference to the same list; >>(2) sort the list in place and return a copy of the same lis

Re: Anyway to clarify this code? (dictionaries)

2005-11-23 Thread Steven D'Aprano
un (say) 20 tests, and look at the average speed. Of better still, use the timeit module. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: What a curious assignment.

2005-11-23 Thread Steven D'Aprano
(Again, ignoring slots and any other special cases I have't thought of.) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: defining the behavior of zip(it, it) (WAS: Converting a flat list...)

2005-11-23 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > Steven Bethard wrote: > >>[EMAIL PROTECTED] wrote: >> >>>>>ii. The other problem is easier to explain by example. >>>>>Let it=iter([1,2,3,4]). >>>>>What is the result of zip(*[it]*2)? >>>>>The

Re: What a curious assignment.

2005-11-23 Thread Steven D'Aprano
On Wed, 23 Nov 2005 00:17:32 -0800, [EMAIL PROTECTED] wrote: > > Steven D'Aprano wrote: >> [EMAIL PROTECTED] wrote: >> >> > Is there somthing wrong >> >> Kids today, don't they learn about inheritence? :-) [snip] > I believe he knows ab

Re: the PHP ternary operator equivalent on Python

2005-11-23 Thread Steven D'Aprano
olution is fine. But just to prove it can be done: dNewDataFields['CODE'] = dOldDataFields['CODEDATA'] dNewDataFields['DATE'] = dOldDataFields['DATE'] if dOldDataFields['CONTACTTYPE'] == 2: dNewDataFields['CONTACT'] = dOldDataFields['FIRSTCONTACT'] else: dNewDataFields['CONTACT'] = dOldDataFields['SECONDCONTACT'] There. The world didn't end. *wink* -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-23 Thread Steven D'Aprano
to GPL'd > software as "free as in pushing my personal social agenda". Of course you are FREE to do so, and I won't even charge you. That doesn't make what you say meaningful. Is the Python licence not "pushing my personal social agenda" too? What about proprietary licences that prohibit making backup copies? Doesn't that push a social agenda too, an agenda to make it expected that every time your software needs to be reinstalled you have to go out a buy a new one? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-23 Thread Steven D'Aprano
rather > misleading term. > > I still think of the term "Free Software" as false advertising. I'm FREE to use the software, FREE to redistribute it, FREE to give it away, FREE to make derivative works, FREE to transfer the licence, *and* I got it FREE of cost as well, but that doesn't make it free. Not on Bizarro World at least. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

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

2005-11-23 Thread Steven D'Aprano
to break them anyway. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

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

2005-11-23 Thread Steven D'Aprano
roperty is almost certainly used in some > code, so it can't be broken without good reason. As I recall, that guarantee is only if the dict is not modified between retrieving the keys and retrieving the values. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-24 Thread Steven D'Aprano
process your code is arguably a > derivative work of the original. "Derivative work" is not a well-formed concept. Many copyright lawyers have made many fortunes arguing whether or not this work or that work is a derivative work of some other. -- Steven. -- http://mail.python.or

Re: the PHP ternary operator equivalent on Python

2005-11-24 Thread Steven D'Aprano
if you create an empty dict, and then populate it one item at a time, it will take approximately twice as long as creating the non-empty dict directly. As a very unscientific, system-dependent, statistically shoddy ball-park estimate, it looks like each item assignment to a pre-existing dict takes less than 0.002s. So if you had a dict and added another million items to it, one at a time, it might take an extra 0.2s in total more than what it would have taken you if you wrote those one million items in your source code. I can live with that. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: return in loop for ?

2005-11-24 Thread Steven D'Aprano
rmal verification are way beyond what a normal user is capable of > specifying, making them an even worse tool for specification. Can't argue with that observation :-) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-24 Thread Steven D'Aprano
On Thu, 24 Nov 2005 00:26:36 -0800, [EMAIL PROTECTED] wrote: > As for the liability, that is for sure, withness what is happening for > the linux kernel. What is happening for the Linux kernel? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: return in loop for ?

2005-11-24 Thread Steven D'Aprano
On Thu, 24 Nov 2005 12:51:34 +, Duncan Booth wrote: > Steven D'Aprano wrote: > >>> While outwardly they apear to offer a technique for making software >>> more reliable there are two shortcomings I'm leery of. First, no >>> verification program can

Re: Making immutable instances

2005-11-25 Thread Steven D'Aprano
le data"). If there is no difference, I don't understand the point of your example. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-25 Thread Steven D'Aprano
w console game developers, is there any company making a profit on software sales? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Making immutable instances

2005-11-25 Thread Steven D'Aprano
But I should have to *think about it* before messing about with it. Python's consenting adults philosophy allows the class designer some limited ability to force the class user to think about it before messing about with private variables. I think Ben's immutable class falls into that sa

Re: wxPython Licence vs GPL

2005-11-25 Thread Steven D'Aprano
y, I release stuff under a BSD-like license, historically > having included requirements that I be notified of bug fixes, and/or > that I be given copies of commercial software that included my code. That would make it NOT a BSD-like licence then. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-25 Thread Steven D'Aprano
release your work with no restrictions whatsoever, then just put the work in the public domain. Is attribution really that important to you -- especially when that attribution may be buried deep in the source code of software which nobody will ever see? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-25 Thread Steven D'Aprano
source code (excepting reasonable distribution costs of shipping extra media). Such chilling effects. That explains why Linux and other GPLed software has languished in obscurity over the last decade, while companies like IBM, Novell and Red Hat have flocked to support the much older BSD-licenced co

Re: return in loop for ?

2005-11-25 Thread Steven D'Aprano
ty of a verification program's own source code that prevents the verification program working correctly on itself. And that was my point: formal correctness checking programs will be as good as testing themselves as they are at testing other programs. If you trust them to check other programs, you have no reason not to trust them to check themselves. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-25 Thread Steven D'Aprano
unique in that regard is deluding themselves. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Making immutable instances

2005-11-25 Thread Steven D'Aprano
On Fri, 25 Nov 2005 20:50:41 -0500, Mike Meyer wrote: > 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: >>> >&g

Re: wxPython Licence vs GPL

2005-11-26 Thread Steven D'Aprano
On Fri, 25 Nov 2005 20:17:15 -0800, Alex Martelli wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> On Thu, 24 Nov 2005 17:43:22 +0100, Martin P. Hellwig wrote: >> >> > if I owned a company >> > making profit on software sales (sale =! su

Re: Making immutable instances

2005-11-26 Thread Steven D'Aprano
On Fri, 25 Nov 2005 23:20:05 -0500, Mike Meyer wrote: > 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

Re: wxPython Licence vs GPL

2005-11-26 Thread Steven D'Aprano
e to BSDs, or given money to BSD coders? In a pig's ear they have. Microsoft stands for closed source software: they absolutely hate the GPL. But they like the BSD licence, because it lets them freeload off the labour of idealistic programmers for free, without so much as a thank you. --

Re: wxPython Licence vs GPL

2005-11-26 Thread Steven D'Aprano
On Fri, 25 Nov 2005 20:54:55 -0500, Mike Meyer wrote: > 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

Re: Which License Should I Use?

2005-11-26 Thread Steven D'Aprano
right (c) 2005 Steven D'Aprano. Released under the same license as used by Python 2.3.2 itself. See http://www.python.org/psf/license.html for details, and http://www.python.org/2.3.2/license.html for the full text of the license. I use that as a no-brainer licence: it is weaker than but compat

Re: wxPython Licence vs GPL

2005-11-26 Thread Steven D'Aprano
On Sat, 26 Nov 2005 11:26:30 +0100, Martin P. Hellwig wrote: > Steven D'Aprano wrote: >> On Thu, 24 Nov 2005 17:43:22 +0100, Martin P. Hellwig wrote: >> >>> if I owned a company >>> making profit on software sales (sale =! support) you sign a death wis

Re: Making immutable instances

2005-11-26 Thread Steven D'Aprano
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'd be interested in hearing it. >> frozenset perhaps? If

Re: wxPython Licence vs GPL

2005-11-26 Thread Steven D'Aprano
On Sat, 26 Nov 2005 04:46:15 -0500, Mike Meyer wrote: > 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 l

Re: wxPython Licence vs GPL

2005-11-26 Thread Steven D'Aprano
o. Then we can all agree that all software licences are restrictive and that moral rights are restrictive ("but what if I *want* to plagiarise the author of this public domain work?"). I think that your usage of the word is about as useful as plutonium underwear, but if you are going to use it in that way, at least be consistent. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-27 Thread Steven D'Aprano
venue from licencing, not sales. You're usage of sales may differ, and I'm not going to argue that one is better than the other. By my meaning, Red Hat doesn't sell RH Enterprise Linux, but charges for support. By your meaning, Red Hat does sell RHEL. I'm good with that definition too, so long as we can agree on one or the other. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython Licence vs GPL

2005-11-27 Thread Steven D'Aprano
not revenue from sales. Of course you're welcome to describe it as sales. It is an arbitrary choice one way or another -- the main thing is to not talk at cross-purposes, as we obviously have been doing. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: return in loop for ?

2005-11-28 Thread Steven D'Aprano
On Mon, 28 Nov 2005 08:44:04 +, Duncan Booth wrote: > Steven D'Aprano wrote: > >> Since real source code verifiers make no such sweeping claims to >> perfection (or at least if they do they are wrong to do so), there is >> no such proof that they are impos

Re: should python have a sort list-map object in the std-lib?

2005-11-28 Thread Steven D'Aprano
how little time the deletion took :-) Why don't you try it for yourself? You only need some quick and dirty code to discover which approach is better (for a quick and dirty definition of "better"). Don't forget to check out the bisect module too. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: return in loop for ?

2005-11-28 Thread Steven D'Aprano
s impossible to create a program which will determine whether *all* programs will terminate. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Death to tuples!

2005-11-28 Thread Steven Bethard
Dan Bishop wrote: > Mike Meyer wrote: > >>Is there any place in the language that still requires tuples instead >>of sequences, except for use as dictionary keys? > > The % operator for strings. And in argument lists. > > def __setitem__(self, (row, column), value): >... Interesting that b

Re: importing a method

2005-11-28 Thread Steven D'Aprano
ts of various types. Deprecated.' -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: return in loop for ?

2005-11-28 Thread Steven D'Aprano
On Mon, 28 Nov 2005 12:05:03 -0500, Mike Meyer wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> On Mon, 28 Nov 2005 10:02:19 +0100, Sybren Stuvel wrote: >>> Duncan Booth enlightened us with: >>>> I would have thought that no matter how elaborate

Re: Precision for equality of two floats?

2005-11-28 Thread Steven D'Aprano
a long time since I worried about this; there's > probably a better version). Sometimes you want relative differences, sometimes you care about absolute differences, and sometimes -- very rarely -- you actually want full-blown bit-for-bit equality. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Which License Should I Use?

2005-11-28 Thread Steven D'Aprano
On Mon, 28 Nov 2005 12:40:07 -0600, Rocco Moretti wrote: > Gaak! No! The Python license you point to contains horrible amounts of > cruft due to the ownership ping-pong game. (And just using the hyperlink > like you did leaves it vauge as to who is doing the liscensing - Steven > D

Re: Death to tuples!

2005-11-28 Thread Steven Bethard
Mike Meyer wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: > >>Dan Bishop wrote: >> >>>Mike Meyer wrote: >>> >>> >>>>Is there any place in the language that still requires tuples instead >>>>of sequences, except for

Re: python speed

2005-11-30 Thread Steven Bethard
David Rasmussen wrote: > Harald Armin Massa wrote: > >> Dr. Armin Rigo has some mathematical proof, that High Level Languages >> like esp. Python are able to be faster than low level code like >> Fortran, C or assembly. > > Faster than assembly? LOL... :) I think the claim goes something along t

Re: Which License Should I Use?

2005-12-01 Thread Steven D'Aprano
om > distributing it, if you have a copy. Only if the copy is licenced to you by the copyright owner under the GPL in the first place. You can't just take source code you have no rights to, or some other set of rights, stick the GPL on it without the copyright owner's permission, and

Re: [newbie] super() and multiple inheritance

2005-12-01 Thread Steven Bethard
hermy wrote: > As I understand it, using super() is the preferred way to call > the next method in method-resolution-order. When I have parameterless > __init__ methods, this works as expected. > However, how do you solve the following simple multiple inheritance > situation in python ? > > class

aligning a set of word substrings to sentence

2005-12-01 Thread Steven Bethard
I've got a list of word substrings (the "tokens") which I need to align to a string of text (the "sentence"). The sentence is basically the concatenation of the token list, with spaces sometimes inserted beetween tokens. I need to determine the start and end offsets of each token in the sente

Re: aligning a set of word substrings to sentence

2005-12-01 Thread Steven Bethard
Fredrik Lundh wrote: > Steven Bethard wrote: >> I feel like there should be a simpler solution (maybe with the re >> module?) but I can't figure one out. Any suggestions? > > using the finditer pattern I just posted in another thread: > > tokens = ['She

Re: aligning a set of word substrings to sentence

2005-12-01 Thread Steven Bethard
Paul McGuire wrote: > "Steven Bethard" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>I've got a list of word substrings (the "tokens") which I need to align >>to a string of text (the "sentence"). The sentence i

Re: aligning a set of word substrings to sentence

2005-12-02 Thread Steven Bethard
Fredrik Lundh wrote: > Steven Bethard wrote: > > >>>>I feel like there should be a simpler solution (maybe with the re >>>>module?) but I can't figure one out. Any suggestions? >>> >>>using the finditer pattern I just posted in another t

<    37   38   39   40   41   42   43   44   45   46   >