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

Re: wxPython Licence vs GPL

2005-11-26 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > 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 y

New docs for set elements/dictionary keys (Was: 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: >>>This is not true. The second definition of __hash__ does not meet >>>the specifications: >> The specification isn't on the __hash__ method, but on objects. > What does it

Re: CGI question

2005-11-26 Thread Mike Meyer
Dan Stromberg <[EMAIL PROTECTED]> writes: > On Sat, 26 Nov 2005 13:26:11 +0100, Fredrik Lundh wrote: >> Dan Stromberg wrote: >>> What's the best way of converting this: >>> 'hide\\?http://www.dedasys.com/articles/programming_language_economics.html\x012005-07-20 >>> 14:48' >>> ...to something easil

Re: Nested list comprehensions

2005-11-26 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Hey guys: > [(i,j,k) for i in range(1,j) for j in range(1,k) for k in range(1,5)] > [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 1, 4), (1, 2, 1), (1, 2, 2), (1, > 2, 3), (1, 2, 4), (1, 3, 1), (1, 3, 2), (1, 3, 3), (1, 3, 4), (2, 1, > 1), (2, 1, 2), (2, 1, 3), (2, 1, 4), (

Re: wxPython Licence vs GPL

2005-11-26 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 26 Nov 2005 18:18:44 -0500, Mike Meyer wrote: >> So that's the basis of the disagreement. I'm using "restriction" with >> the intent of communicating it's normal english meaning, > Your m

Re: Which License Should I Use?

2005-11-27 Thread Mike Meyer
"Andrew Koenig" <[EMAIL PROTECTED]> writes: > I'm pretty sure that there was a change to the copyright laws a few years > ago (perhaps as part of the DMCA), that made it clear that you own > everything you produce, unless you're a W-2 employee or there is a written > agreement to the contrary.

Re: New docs for set elements/dictionary keys

2005-11-27 Thread Mike Meyer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Personally, I think we'd be better off to come up with a term for this >> property that doesn't have a commonly understood meaning that has such >> broad areas of disagreement

Re: New docs for set elements/dictionary keys

2005-11-27 Thread Mike Meyer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Me, personally, I had your definition in mind: hashable should indicate > "returns a value constant over time and consistent with comparison". > > I suggested that most people would consider "hashable" to mean: > hash() returns a value. To those peopl

Re: New docs for set elements/dictionary keys

2005-11-27 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Any object for which hash() returns an appropriate value(1) can be >> used as a dictionary key/set element. Lists, sets and dicts are not >> hashable, and can not be used. Tuples can be used if all

Death to tuples!

2005-11-27 Thread Mike Meyer
It seems that the distinction between tuples and lists has slowly been fading away. What we call "tuple unpacking" works fine with lists on either side of the assignment, and iterators on the values side. IIRC, "apply" used to require that the second argument be a tuple; it now accepts sequences, a

Re: type of form field

2005-11-28 Thread Mike Meyer
"Ajar" <[EMAIL PROTECTED]> writes: > Is there any way to retrieve the type(checkbox,radio...) of the form > field from cgi.FieldStorage. I tried something like form['name'].type, > but this field seems to be None for all the form fields There isn't. cgi.FieldStorage parses data sent via an HTTP re

Re: return in loop for ?

2005-11-28 Thread Mike Meyer
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 the checking it is >>> guaranteed there exist programs which are correct but your verifier >>> cannot pro

Re: Precision for equality of two floats?

2005-11-28 Thread Mike Meyer
Anton81 <[EMAIL PROTECTED]> writes: > When I do simple calculation with float values, they are rarely exactly > equal even if they should be. What is the threshold and how can I change > it? Implementation dependent, because floats use an underlying C type, and there's no portable way to do that.

Re: Death to tuples!

2005-11-28 Thread Mike Meyer
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 use as dictionary keys? >> The % operator for strings. And in

Re: Death to tuples!

2005-11-28 Thread Mike Meyer
Peter Hansen <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> It seems that the distinction between tuples and lists has slowly been >> fading away. What we call "tuple unpacking" works fine with lists on >> either side of the assignment, and iterators on t

Re: Python as Guido Intended

2005-11-28 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-11-25, Mike Meyer schreef <[EMAIL PROTECTED]>: >> 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 f

Re: Death to tuples!

2005-11-28 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Mike> Tuples have the problem that they are immutable, except when > Mike> they're not (or for proper values of immutable, your > Mike> choice). They're hashable, except when they're not. Or > Mike> equivalently, they can be used as dictionary keys - or s

Re: return in loop for ?

2005-11-28 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> Which means you can't create a verifier which will verify all >> programs. Is there a reason to believe that you can't have a verifier >> with three possible out

Re: return in loop for ?

2005-11-28 Thread Mike Meyer
Paul Rubin writes: > I don't know about the BCPL type verifier but every statically typed > language verifies certain assertions about the types of expressions > and this is useful. BCPL is untyped. You can perform any operation on any variable. You can use the floating

Re: General question about Python design goals

2005-11-28 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > A programming language is not a "work of art". If you are an artist, > you may break symmetry and introduce all kinds of unexpected > effects. Actually, as an artist, you purposfully want to provoke > astonishment. But if I am using a programming la

Re: New docs for set elements/dictionary keys

2005-11-28 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Christoph Zwerschke wrote: >>>I think that is not so bad. How about this simplification: >>> >>>Any hashable object(1) can be used as a dictionary key/set >>>element. Lis

Re: General question about Python design goals

2005-11-28 Thread Mike Meyer
[EMAIL PROTECTED] (Bengt Richter) writes: >>Then feel free to submit patches for the docs. > This is easy to say, and maybe the docs maintainers are accomodating, > but I'd be the average reader wouldn't have a concept of how a "patch" > should be prepared. >From what's been said here before, the

Re: Python as Guido Intended

2005-11-29 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >> You see, you can make languages more powerful by *removing* things >> from it. > You cast this in way to general terms. The logic conclusion > from this statements is that the most powerfull language > is the empty language. The only way you reach that

Re: Death to tuples!

2005-11-29 Thread Mike Meyer
Duncan Booth <[EMAIL PROTECTED]> writes: > Dan Bishop 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):

Re: Which License Should I Use?

2005-11-29 Thread Mike Meyer
"Andrew Koenig" <[EMAIL PROTECTED]> writes: > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Definitely not. The most recent change to the copyright laws made >> works of music recorded to fullfill a contract &quo

Re: ncurses' Dark Devilry

2005-11-29 Thread Mike Meyer
Jeremy Moles <[EMAIL PROTECTED]> writes: > Basically what I'm looking for is a way to refresh a portion of a > curses-controlled "window" without affecting the current location of the > cursor or having to manually move it and move it back. Have you looked into using curses window feature?

Re: Making immutable instances

2005-11-29 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> 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 >> reason for placing such restriction

Re: General question about Python design goals

2005-11-29 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> But a programming language (or UI) is not just a collection of syntax >> and and interfaces - it's an implementation. You need to keep in mind >> that "practicality

Re: General question about Python design goals

2005-11-30 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> > An awful lot of the time in this newsgroup, "practicality beats >> > purity" translates as "the programmer can just be a lazy slob". >> You post

Re: Making immutable instances

2005-11-30 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> Letting the class author declare whether or not the client can add >> attributes is wrong for the same reasons - and in the same places - >> that letting the class author dec

Re: Making immutable instances

2005-11-30 Thread Mike Meyer
[EMAIL PROTECTED] writes: > I am puzzled, and could have read what you want wrong. Are you saying > you want something like this : > > a={} > a.something = "I want to hang my stuff here, outside the intended use > of dict" Exactly. For a use case, consider calling select.select on lists of file ob

Re: Python as Guido Intended

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

Re: python speed

2005-11-30 Thread Mike Meyer
"Harald Armin Massa" <[EMAIL PROTECTED]> writes: >>Faster than assembly? LOL... :) > why not? Of course, a simple script like "copy 200 bytes from left to > right" can be handoptimized in assembler and run at optimum speed. > Maybe there is even a special processor command to do that. Chances are

Re: Making immutable instances

2005-11-30 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Mike Meyer wrote: >> [EMAIL PROTECTED] writes: >> > I am puzzled, and could have read what you want wrong. Are you saying >> > you want something like this : >> > a={} >> > a.something = "I want to hang my stuff here,

Re: HTML parsing/scraping & python

2005-11-30 Thread Mike Meyer
Sanjay Arora <[EMAIL PROTECTED]> writes: > We are looking to select the language & toolset more suitable for a > project that requires getting data from several web-sites in real- > timehtml parsing/scraping. It would require full emulation of the > browser, including handling cookies, automat

Re: Making immutable instances

2005-11-30 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Well, in this case, would it be simple for the OP that if he wants to > disallow this attaching additional things, just use __slot__. That's *documented* as an implementation-dependent behavior. Using it to get that effect is abuse of the feature, and may well quit work

Re: Making immutable instances

2005-11-30 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Mike Meyer wrote: >> [EMAIL PROTECTED] writes: >> > Well, in this case, would it be simple for the OP that if he wants to >> > disallow this attaching additional things, just use __slot__. >> That's *documented* as an implementat

Re: Making immutable instances

2005-11-30 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Quoting the frequently used term "Practicality beats purity". If I have > a practical problem/needs now and it solves it, why not use it ? In other words, you have a use case. Cool. Please tell us what it is - at least if it's better than "I think that's bad style."

Re: General question about Python design goals

2005-11-30 Thread Mike Meyer
"Donn Cave" <[EMAIL PROTECTED]> writes: > Tuples and lists really are intended to serve two fundamentally different > purposes. We might guess that just from the fact that both are included > in Python, in fact we hear it from Guido van Rossum, and one might add > that other languages also make th

Re: Death to tuples!

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

Re: Making immutable instances

2005-12-01 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Mike Meyer wrote: >> [EMAIL PROTECTED] writes: >> > Quoting the frequently used term "Practicality beats purity". If I have >> > a practical problem/needs now and it solves it, why not use it ? >> In other words, you have

Re: General question about Python design goals

2005-12-01 Thread Mike Meyer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> So why the $*@& (please excuse my Perl) does "for x in 1, 2, 3" work? > because the syntax says so: > http://docs.python.org/ref/for.html In other words, "Because that's

Re: python speed

2005-12-01 Thread Mike Meyer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> If you wire everything down, you can always hand-code assembler that >> will be faster than HLL code > but that doesn't mean that your hand-coded assembler will always be faster > than an

Re: HTML parsing/scraping & python

2005-12-01 Thread Mike Meyer
"Fuzzyman" <[EMAIL PROTECTED]> writes: > The standard library module for fetching HTML is urllib2. Does urllib2 replace everything in urllib? I thought there was some urllib functionality that urllib2 didn't do. > There is a project called mechanize, built by John Lee on top of > urllib2 and othe

Re: Python as Guido Intended

2005-12-01 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >> We don't talk much about how you produce buffer >> overfows in Python, but people have asked for that as well. Adding >> ways to write hard-to-read code is frowned upon. And so on. > Do you mean people have asked for the possibility that

Re: Automate webpage refresh

2005-12-01 Thread Mike Meyer
DarkBlue <[EMAIL PROTECTED]> writes: > I am trying to write a script (python2.3) which will be used > with linux konqueror to retrive 2 webpages alternatively every 2 minutes. > > My question is how can I send alternative args (the url) > to the same invocation of konqueror which I started with >

Re: General question about Python design goals

2005-12-01 Thread Mike Meyer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>>> Seriously. Why doesn't this have to be phrased as "for x in list((1, >>>> 2, 3))", just like you have to write list((1, 2, 3)).count(1), etc.? >>> because anythi

Re: Death to tuples!

2005-12-01 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > On 2005-12-01, Mike Meyer <[EMAIL PROTECTED]> wrote: >> Antoon Pardon <[EMAIL PROTECTED]> writes: >>> I know what happens, I would like to know, why they made this choice. >>> One could argue that the expre

Re: Making immutable instances

2005-12-01 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> Lots of people seem to want immutable instances. Nobody seems to have >> a use case for them. > What is the use case for immutable strings? Why shouldn't strings be &g

Re: Making immutable instances

2005-12-01 Thread Mike Meyer
Ben Finney <[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> Lots of people seem to want immutable instances. Nobody seems to >> have a use case for them. > Perhaps you missed my release announcement of the 'enum' package that > expl

Re: Instances behaviour

2005-12-01 Thread Mike Meyer
"Mr.Rech" <[EMAIL PROTECTED]> writes: > Suppose I have a bunch of classes that represent slightly (but > conceptually) different object. The instances of each class must behave > in very similar manner, so that I've created a common class ancestor > (let say A) that define a lot of special method (

Re: Making immutable instances

2005-12-01 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Mike Meyer wrote: >> That's not a use case, that's a debugging aid. The same logic applies >> to adding type declarations, private/public/etc. declerations, and >> similar B&D language features. It's generally considered that it&

Re: Making immutable instances

2005-12-01 Thread Mike Meyer
Ben Finney <[EMAIL PROTECTED]> writes: > > "Since the values of an enumeration are directly reflected in the > values and attributes, Enum instances are immutable to preserve > this relationship" This justifies making the attributes immutable. But that's old hat - I had that use case l

Re: Making immutable instances

2005-12-01 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Mike Meyer wrote: >> > By design, this is a "don't use" feature so it would be very hard to >> > find a "use case" ;-) >> But I can think of use cases for instances with no mutable attributes, >> which is a

Re: Making immutable instances

2005-12-01 Thread Mike Meyer
Ben Finney <[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> Ben Finney <[EMAIL PROTECTED]> writes: >> > "Since the values of an enumeration are directly reflected in >> > the values and attributes, Enum instances ar

Re: Death to tuples!

2005-12-02 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >>> Well there are two possibilities I can think of: >>> >>> 1) >>> arg_default = ... >>> def f(arg = arg_default): >>> ... >> >> Yuch. Mostly because it doesn't work: >> >> arg_default = ... >> def f(arg = arg_default): >> ... >> >> arg_default =

Re: Death to tuples!

2005-12-02 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > On 2005-12-02, Bengt Richter <[EMAIL PROTECTED]> wrote: >> On 1 Dec 2005 09:24:30 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >>>On 2005-11-30, Duncan Booth <[EMAIL PROTECTED]> wrote: Antoon Pardon wrote: >>>I think one could argue that since '[]'

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Mike Meyer
Carsten Haese <[EMAIL PROTECTED]> writes: > (3) assumes that whatever shell the user is running looks up the shebang > executable in the path, which bash, just to name one example, does not > do. For the record, on a modern Unix system, #! isn't handled by the shell; it's handled by the kernel. #!

Re: Setting PYTHONPATH from Makefile

2005-12-02 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > I have a Makefile target that uses a python script, like: > > %.abc: %.def > python myscript.py > > The problem is that myscript.py and some modules that myscript.py > imports are not in the current directory, but in another place in the > f

Re: Setting PYTHONPATH from Makefile

2005-12-02 Thread Mike Meyer
Inyeol Lee <[EMAIL PROTECTED]> writes: > On Fri, Dec 02, 2005 at 07:33:20PM -0500, Mike Meyer wrote: >> > The problem is that myscript.py and some modules that myscript.py >> > imports are not in the current directory, but in another place in the >> > filesystem

Re: General question about Python design goals

2005-12-02 Thread Mike Meyer
Donn Cave <[EMAIL PROTECTED]> writes: > In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> > wrote: >> Seriously. Why doesn't this have to be phrased as "for x in list((1, >> 2, 3))", just like you have to write list((1, 2, 3)).coun

Re: Function to retrieve running script

2005-12-03 Thread Mike Meyer
"Harlin Seritt" <[EMAIL PROTECTED]> writes: > Is there a function that allows one to get the name of the same script > running returned as a string? The questions a little ambiguous, but one answer might be: import sys myname = sys.argv[0] http://www.mired.org/home/mwm/

Re: regexp non-greedy matching bug?

2005-12-03 Thread Mike Meyer
John Hazen <[EMAIL PROTECTED]> writes: > I want to match one or two instances of a pattern in a string. Then you should be using the split() method of the match object on the pattern in question. > According to the docs for the 're' module > ( http://python.org/doc/current/lib/re-syntax.html ) t

Re: Checking length of each argument - seems like I'm fighting Python

2005-12-03 Thread Mike Meyer
"Brendan" <[EMAIL PROTECTED]> writes: > There must be an easy way to do this: Not necessarily. > For classes that contain very simple data tables, I like to do > something like this: > > class Things(Object): > def __init__(self, x, y, z): > #assert that x, y, and z have the same leng

Re: regexp non-greedy matching bug?

2005-12-04 Thread Mike Meyer
John Hazen <[EMAIL PROTECTED]> writes: >> To do what you said you want to do, you want to use the split method: >> >> foo = re.compile('foo') >> if 2 <= len(foo.split(s)) <= 3: >>print "We had one or two 'foo's" > > Well, this would solve my dumbed down example, but each foo in the > original

Re: regexp non-greedy matching bug?

2005-12-04 Thread Mike Meyer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> ^ must match the beginning of the string (BTW, you can get the same >> behavior by leaving off the ^ and using search instead of match). > that's backwards, isn't it? using ^ with ma

Re: Detect character encoding

2005-12-04 Thread Mike Meyer
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Michal wrote: >> is there any way how to detect string encoding in Python? >> I need to proccess several files. Each of them could be encoded in >> different charset (iso-8859-2, cp1250, etc). I want to detect it, >> and encode it to utf-8 (with stri

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

2005-12-04 Thread Mike Meyer
Benji York <[EMAIL PROTECTED]> writes: >> See, I can make up bizarre scenarios where spaces cause >> problems, too. > Only if you don't know how decent editors behave. :) But the same is also true of tabs causing problems :-). http://www.mired.org/home/mwm/ Independent

Re: Favorite flavor of Linux? (for python or anything else)

2005-12-04 Thread Mike Meyer
"Brett Hoerner" <[EMAIL PROTECTED]> writes: > I have to add another vote for Gentoo. I agree that you just "have > less problems" on Gentoo. Updates are from source, Gentoo is one of my favorite Linux distributions - because it's the the most like a BSD distribution, except not as mature. A lot

Re: Favorite flavor of Linux? (for python or anything else)

2005-12-05 Thread Mike Meyer
You know, without some context, it's hard to say what you're replying to. "malv" <[EMAIL PROTECTED]> writes: > Any popular distro would. No one is really superior from this angle. Assuming you mean would "come with nearly jeverything installed", I'd have to disagree. Distros that are popular with

Re: Binary representation of floating point numbers

2005-12-06 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Hi, > I'm using python to run some lab equipment using PyVisa. When I read a > list of values from the equipment, one of the fields is 32 bits of > flags, but the value is returned as a floating point number, either in > ASCII format, or pure binary. Value returned by

Re: Binary representation of floating point numbers

2005-12-06 Thread Mike Meyer
[EMAIL PROTECTED] writes: > In float mode, the instrument returns a sequence of bits that are > exactly the ieee754 number in the case of floats, or just the flags in > the case of flags. PyVisa, when set to float mode, will convert > everything to float, because it is unaware apriori that one of

Re: Bitching about the documentation...

2005-12-07 Thread Mike Meyer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: >> Er... no, I can't parse that. I suffered a Too Much Recursion error about >> the third Badger (I only have a limited runtime stack). I always loved the demonstration that English requires backtracking: "The old man the ship." h

Re: ElementTree - Why not part of the core?

2005-12-07 Thread Mike Meyer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > as I've said many times, if the Linux folks can build distributions that con- > sists of thousands of individually maintained pieces, the Python distributors > should be able to handle a few dozen components. Yes, but "distributers" is not necessarily

Re: Mutability of function arguments?

2005-12-07 Thread Mike Meyer
"ex_ottoyuhr" <[EMAIL PROTECTED]> writes: > I'm trying to create a function that can take arguments, say, foo and > bar, and modify the original copies of foo and bar as well as its local > versions -- the equivalent of C++ funct(&foo, &bar). C++'s '&' causes an argument to be passed by reference.

Re: Mutability of function arguments?

2005-12-07 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Mike Meyer wrote: >> "ex_ottoyuhr" <[EMAIL PROTECTED]> writes: >> > I'm trying to create a function that can take arguments, say, foo and >> > bar, and modify the original copies of foo and bar as well as its local >>

Re: Another newbie question

2005-12-07 Thread Mike Meyer
"solaris_1234" <[EMAIL PROTECTED]> writes: > 1) The stmt "board.Blist[10].DrawQueen(board.Blist[10].b1)" seems > awkward. Is there another way (cleaner, more intuitive) to get the > same thing done? Yes. Reaching through objects to do things is usually a bad idea. Some languages don't allow you

Re: Mutability of function arguments?

2005-12-07 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Mike Meyer wrote: >> [EMAIL PROTECTED] writes: >> > Mike Meyer wrote: >> >> "ex_ottoyuhr" <[EMAIL PROTECTED]> writes: >> >> > I'm trying to create a function that can take arguments, say, foo and >>

Re: efficient 'tail' implementation

2005-12-07 Thread Mike Meyer
[EMAIL PROTECTED] writes: > I have a file which is very large eg over 200Mb , and i am going to use > python to code a "tail" > command to get the last few lines of the file. What is a good algorithm > for this type of task in python for very big files? > Initially, i thought of reading everything

Re: Mutability of function arguments?

2005-12-07 Thread Mike Meyer
[EMAIL PROTECTED] writes: >> Except "trick" is a poor word choice. Nobody is playing a trick on >> them - they just don't understand what is going on. > oops, never thought about the negative meaning of it, it is just meant > as "not behave as expected", what would be the word you use then ? Surp

Re: Mutability of function arguments?

2005-12-08 Thread Mike Meyer
Kent Johnson <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> "ex_ottoyuhr" <[EMAIL PROTECTED]> writes: >> >>>I'm trying to create a function that can take arguments, say, foo and >>>bar, and modify the original copies of foo and

Re: Dynamically add Class to Modules

2005-12-08 Thread Mike Meyer
[EMAIL PROTECTED] writes: > So: Does anyone know how dynamically generate a class, and add it to a > "module" that is already in memory? How about adding a step: generate your class to a file import the file as a module. bind a name in "module" to the class in the imported module.

Re: Another newbie question

2005-12-08 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Wed, 07 Dec 2005 23:58:02 -0500, Mike Meyer wrote: >> "solaris_1234" <[EMAIL PROTECTED]> writes: >>> 1) The stmt "board.Blist[10].DrawQueen(board.Blist[10].b1)" seems >>> awkward. Is

Re: Documentation suggestions

2005-12-08 Thread Mike Meyer
"BartlebyScrivener" <[EMAIL PROTECTED]> writes: > Too bad there > isn't something like what Ruby does with the "Try Ruby In Your Browser" > thing, which is a very effective marketing tool (although obviously I > chose Python). > > http://tryruby.hobix.com/ I've seen things like this for other lang

Re: Another newbie question

2005-12-08 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Paul Rubin wrote: >> Steven D'Aprano <[EMAIL PROTECTED]> writes: Yes. Reaching through objects to do things is usually a bad idea. >>>I don't necessarily disagree, but I don't understand why you say this. Why >>>it is bad? >> The traditional OOP sp

Re: Another newbie question

2005-12-08 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> My standard object interface is modeled after Meyer's presentation in >> OOSC: an objects state is manipulated with methods and examined with >> attributes; manipulating attrib

Re: pyparsing and LaTeX?

2005-12-09 Thread Mike Meyer
"Tim Arnold" <[EMAIL PROTECTED]> writes: > For now I'm working on a tag translator to convert from one LaTeX tagset to > another, which is a pretty simple task compared to writing a full parser > like pyLaTeX > http://pylatex.sourceforge.net/ You might check out the LyX project. They use python

Re: Another newbie question

2005-12-09 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> for an object, and methods are the knobs/dials/etc. This also ties in >> with the compiler having facilities to check class invariants. If you >> allow assignments to attributes in oth

Re: Documentation suggestions

2005-12-09 Thread Mike Meyer
Trent Mick <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote] >> Trent> Nah, the Try Ruby thing is mostly faking it (I believe) rather >> Trent> than running an actually Ruby interactive session ("bastion'ed" >> Trent> or not). >> I don't think so. I tried typing some stuff at the

Re: Proposal: Inline Import

2005-12-09 Thread Mike Meyer
Shane Hathaway <[EMAIL PROTECTED]> writes: > Here's a heretical idea. Not really. > I'd like a way to import modules at the point where I need the > functionality, rather than remember to import ahead of time. This > might eliminate a step in my coding process. Currently, my process is > I chan

Re: Documentation suggestions

2005-12-09 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> I'm working on puttingn this up for Python. I'm planning on using AJAX >> to pass the input string to eval on the server. I.e. - you'll be >> limited to express

Re: Validating an email address

2005-12-09 Thread Mike Meyer
Tom Anderson <[EMAIL PROTECTED]> writes: > On Sat, 10 Dec 2005, Ben Finney wrote: >> Please, don't attempt to "validate" the local-part. It's not up to >> you to decide what the receiving MTA will accept as a local-part, > Absolutely not - it's up to the IETF, and their decision is recorded > in RF

Re: Proposal: Inline Import

2005-12-09 Thread Mike Meyer
Shane Hathaway <[EMAIL PROTECTED]> writes: > Xavier Morel wrote: >> Shane Hathaway wrote: >>>Thoughts? >> >>> import re; name_expr = re.compile('[a-zA-Z]+') >> >>> name_expr >> <_sre.SRE_Pattern object at 0x00F9D338> >> >>> >> the import statement can be called anywhere in the code, why would >>

Re: Proposal: Inline Import

2005-12-09 Thread Mike Meyer
Shane Hathaway <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Shane Hathaway <[EMAIL PROTECTED]> writes: >>>That syntax is verbose and avoided by most coders because of the speed >>>penalty. >> What speed penalty? "import re" is a cheap

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