Re: Another newbie question

2005-12-10 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 10 Dec 2005 22:56:12 -0500, Mike Meyer wrote: >>> Really, I don't think this makes a good poster child for your "attribute >>> mutators make life more difficult" campaign...;-) >> The claim is that there exists cases where that's true. This case

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> > Really, I don't think this makes a good poster child for your "attribute >> > mutators make life more difficult" campaign...;-) >> The claim is that there exists cases where that's true. This cases >> demonstrate

Re: Another newbie question

2005-12-10 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 10 Dec 2005 13:33:25 -0500, Mike Meyer wrote: >> Steven D'Aprano <[EMAIL PROTECTED]> writes: In particular, you can get most of your meaningless methods out of a properly designed Coordinate API. For example, add/sub_x/y_ord can a

Re: Another newbie question

2005-12-10 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > The fact that sys is a module and not a class is a red herring. If the > "Law" of Demeter makes sense for classes, it makes just as much sense for > modules as well -- it is about reducing coupling between pieces of code, > not something specific to cla

Re: Using XML w/ Python...

2005-12-10 Thread James
XPath is the least painful way of doing it. Here are some samples with various libraries for XPath http://www.oreillynet.com/pub/wlg/6225 Read XPath basics here http://www.w3schools.com/xpath/default.asp It is not practical and perhaps not polite to expect people write tutorials just for you and

Re: Another newbie question

2005-12-10 Thread Steven D'Aprano
On Sat, 10 Dec 2005 15:46:35 +, Antoon Pardon wrote: >> Do you lie awake at nights worrying that in Python 2.6 sys.stdout will be >> renamed to sys.standard_output, and that it will no longer have a write() >> method? According to the "law" of Demeter, you should, and the writers of >> the sys

Re: Another newbie question

2005-12-10 Thread Steven D'Aprano
On Sat, 10 Dec 2005 22:56:12 -0500, Mike Meyer wrote: [snip] >> Really, I don't think this makes a good poster child for your "attribute >> mutators make life more difficult" campaign...;-) > > The claim is that there exists cases where that's true. This cases > demonstrates the existence of suc

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

2005-12-10 Thread Steven D'Aprano
On Sat, 10 Dec 2005 22:01:07 +, Zeljko Vrba wrote: > On 2005-12-10, Tom Anderson <[EMAIL PROTECTED]> wrote: >> >> ED IS THE STANDARD TEXT EDITOR. >> > And: > INDENTATION > SUCKS > BIG > TIME. > > Using indentation without block termination marke

Using XML w/ Python...

2005-12-10 Thread Jay
OK, I have this XML doc, i dont know much about XML, but what i want to do is take certain parts of the XML doc, such as blah and take just that and put onto a text doc. Then same thing doe the part. Thats about it, i checked out some of the xml modules but dont understand how to use them. Dont

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

2005-12-10 Thread Steven D'Aprano
On Sat, 10 Dec 2005 16:34:13 +, Tom Anderson wrote: > On Sat, 10 Dec 2005, Sybren Stuvel wrote: > >> Zeljko Vrba enlightened us with: >> >>> Find me an editor which has folds like in VIM, regexp search/replace >>> within two keystrokes (ESC,:), marks to easily navigate text in 2 >>> keystro

Re: Managing import statements

2005-12-10 Thread Kent Johnson
Jean-Paul Calderone wrote: > On Sat, 10 Dec 2005 13:40:12 -0500, Kent Johnson <[EMAIL PROTECTED]> >> Do any of these tools (PyLint, PyChecker, pyflakes) work with Jython? To >> do so they would have to work with Python 2.1, primarily... > > Pyflakes will *check* Python 2.1, though you will have t

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > def setRho(self, rho): > > c = self.fromPolar(rho, self.getTheta()) > > self.x, self.y = c.x, c.y > > def setTheta(self, theta): > > c = self.fromPolar(self.getRho(), theta) > >

Re: Managing import statements

2005-12-10 Thread Jean-Paul Calderone
On Sat, 10 Dec 2005 11:54:47 -0700, Shane Hathaway <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Sat, 10 Dec 2005 02:21:39 -0700, Shane Hathaway <[EMAIL PROTECTED]> wrote: >>>How about PyLint / PyChecker? Can I configure one of them to tell me >>>only about missing / extra imports?

ANN: pygene0.12 - Genetic Programming&Algorithms Library

2005-12-10 Thread aum
Hi all, This announcement supersedes an earlier announcement of pygene. pygene 0.2 now supports genetic programming, in addition to the classical Mendelian genetic algorithms of the earlier version. I thank the respondents to the earlier announcement for inspiring me to implement GP functionality

Re: Another newbie question

2005-12-10 Thread Steven D'Aprano
On Sat, 10 Dec 2005 13:33:25 -0500, Mike Meyer wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >>> In particular, >>> you can get most of your meaningless methods out of a properly >>> designed Coordinate API. For example, add/sub_x/y_ord can all be >>> handled with move(delta_x = 0, delta_y

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > def setRho(self, rho): > c = self.fromPolar(rho, self.getTheta()) > self.x, self.y = c.x, c.y > def setTheta(self, theta): > c = self.fromPolar(self.getRho(), theta) > self.x, self.y = c.x, c.y > > That's the maximu

Re: Managing import statements

2005-12-10 Thread Jean-Paul Calderone
On Sat, 10 Dec 2005 13:40:12 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Sat, 10 Dec 2005 02:21:39 -0700, Shane Hathaway >> <[EMAIL PROTECTED]> wrote: >>> How about PyLint / PyChecker? Can I configure one of them to tell me >>> only about missing / extra import

Re: Proposal: Inline Import

2005-12-10 Thread Robert Kern
Bengt Richter wrote: > Are you willing to type a one-letter prefix to your .re ? E.g., > > >>> class I(object): > ... def __getattr__(self, attr): > ... return __import__(attr) [snip] > There are special caveats re imports in threads, but otherwise > I don't know of any significa

Re: Another newbie question

2005-12-10 Thread Erik Max Francis
Paul Rubin wrote: > Right, you could use properties to make point.x get the real part of > an internal complex number. But now you're back to point.x being an > accessor function; you've just set things up so you can call it > without parentheses, like in Perl. E.g. > > a = point.x > b

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Paul Rubin wrote: ... > Right, you could use properties to make point.x get the real part of > an internal complex number. But now you're back to point.x being an > accessor function; you've just set things up so you can call it > without parentheses, like in Perl. E

Re: Proposal: Inline Import

2005-12-10 Thread Bengt Richter
On Fri, 09 Dec 2005 12:24:59 -0700, Shane Hathaway <[EMAIL PROTECTED]> wrote: >Here's a heretical idea. > >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,

Re: Another newbie question

2005-12-10 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > > I could imagine using Python's built-in complex numbers to represent > > 2D points. They're immutable, last I checked. I don't see a big > > conflict. > > No big conflict at all -- as I recall, last I checked, computation on > complex numbers was opt

Re: Proposal: Inline Import

2005-12-10 Thread Alex Martelli
Erik Max Francis <[EMAIL PROTECTED]> wrote: > Shane Hathaway wrote: > > > Let me fully elaborate the heresy I'm suggesting: I am talking about > > inline imports on every other line of code. The obvious implementation > > would drop performance by a double digit percentage. > > Module importing

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Bernhard Herzog <[EMAIL PROTECTED]> wrote: ... > > and y, obviously. However, a framework for 2D geometry entirely based > > on immutable-instance classes would probably be unwieldy > > Skencil's basic objects for 2d geometry, points and transformations, are > immutable. It works fine. Immut

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Paul Rubin wrote: ... > I could imagine using Python's built-in complex numbers to represent > 2D points. They're immutable, last I checked. I don't see a big > conflict. No big conflict at all -- as I recall, last I checked, computation on complex numbers was optim

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > Take our much-abused coordinate example, and assume you've exposed the > x and y coordinates as attributes. > > Now we have a changing requirement - we want to get to make the polar > coordinates available. To keep the API consistent, they should be >

Re: slice notation as values?

2005-12-10 Thread Bengt Richter
On 10 Dec 2005 12:07:12 -0800, "Devan L" <[EMAIL PROTECTED]> wrote: > >Antoon Pardon wrote: >> On 2005-12-10, Duncan Booth <[EMAIL PROTECTED]> wrote: >[snip] >> >> I also think that other functions could benefit. For instance suppose >> >> you want to iterate over every second element in a list. S

Re: reddit.com rewritten in Python

2005-12-10 Thread BartlebyScrivener
More http://reddit.com/blog/2005/12/on-lisp.html and more http://www.findinglisp.com/blog/2005/12/reddit-and-lisp-psychosis.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Another newbie question

2005-12-10 Thread Bernhard Herzog
[EMAIL PROTECTED] (Alex Martelli) writes: > You could make a case for a "2D coordinate" class being "sufficiently > primitive" to have immutable instances, of course (by analogy with > numbers and strings) -- in that design, you would provide no mutators, > and therefore neither would you provide

Re: OO in Python? ^^

2005-12-10 Thread Heiko Wundram
Paul Boddie wrote: > Heiko Wundram wrote: >> Matthias Kaeppler wrote: >> > > > Well, unless you are (or he is) in with the GNOME crowd, C probably > isn't really the object-oriented language acting as inspiration here. Pardon this glitch, I corrected it in a followup-post somewhere along the lin

Re: Another newbie question

2005-12-10 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > You could make a case for a "2D coordinate" class being "sufficiently > primitive" to have immutable instances, of course (by analogy with > numbers and strings) -- in that design, you would provide no mutators, > and therefore neither would you provide s

Re: OO in Python? ^^

2005-12-10 Thread Leif K-Brooks
Heiko Wundram wrote: > Fredrik Lundh wrote: >>Matthias Kaeppler wrote: >>>polymorphism seems to be missing in Python >> >>QOTW! > > Let's have some UQOTW: the un-quote of the week! ;-) +1 -- http://mail.python.org/mailman/listinfo/python-list

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

2005-12-10 Thread Rick Wotnaz
Zeljko Vrba <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > On 2005-12-10, Tom Anderson <[EMAIL PROTECTED]> wrote: >> >> ED IS THE STANDARD TEXT EDITOR. >> > And: > INDENTATION > SUCKS >BIG > TIME. > > Using indentation without block termination markers

Re: OO in Python? ^^

2005-12-10 Thread Paul Boddie
Heiko Wundram wrote: > Matthias Kaeppler wrote: > > Well, unless you are (or he is) in with the GNOME crowd, C probably isn't really the object-oriented language acting as inspiration here. [Zen of Python] Of course the ZoP (Zen of Python) is deep guidance for those languishing in some design d

Re: OO in Python? ^^

2005-12-10 Thread Martin Christensen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > "Matthias" == Matthias Kaeppler <[EMAIL PROTECTED]> writes: Matthias> sorry for my ignorance, but after reading the Python Matthias> tutorial on python.org, I'm sort of, well surprised about Matthias> the lack of OOP capabilities in python. Hones

Re: OO in Python? ^^

2005-12-10 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, Matthias Kaeppler <[EMAIL PROTECTED]> wrote: ... > obj = Base() # I want a base class reference which is polymorphic obj now refers to an instance of Base. > if (): > obj = D1() obj now refers to an instance of D1(). The Base instance is unreferenced. >

Re: OO in Python? ^^

2005-12-10 Thread Heiko Wundram
Brian Beck wrote: >> >> class D1(Base): >>def foo(self): >> print "D1" >> >> class D2(Base): >>def foo(self): >> print "D2" >> obj = Base() # I want a base class reference which is polymorphic >> if (): >>obj = D1() >> else: >>obj = D2() > > I have no idea what you'r

Re: Dectecting dir changes

2005-12-10 Thread Fredrik Lundh
"chuck" wrote: > While I do appreciate the suggestions but I have to say that if the > twisted folks spent half the time writing documentation as they do code > - twisted would probably get used a lot more Python folks. Didn't get > much encouragement/assistance from the twisted irc channel eithe

Re: Dectecting dir changes

2005-12-10 Thread chuck
I do need to stick to FTP though as indicated I could run it on a different port. Limit comes more from the client side capabilities. Did some reading about twisted and I now understand that things in general are single threaded. I started working my way through the twisted finger tutorial. Whi

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> > "In addition to the full set of methods which operate on the coordinate as >> > a whole, you can operate on the individual ordinates via instance.x and >> > instance.y which are floats." >> That's an API which ma

Re: OO in Python? ^^

2005-12-10 Thread Heiko Wundram
Fredrik Lundh wrote: > Matthias Kaeppler wrote: >> polymorphism seems to be missing in Python > > QOTW! Let's have some UQOTW: the un-quote of the week! ;-) --- Heiko. -- http://mail.python.org/mailman/listinfo/python-list

Re: OO in Python? ^^

2005-12-10 Thread Brian Beck
Matthias Kaeppler wrote: > class Base: >def foo(self): # I'd like to say that children must implement foo > pass def foo(self): raise NotImplementedError("Subclasses must implement foo") Now calling foo on a child instance will fail if it hasn't implemented foo. > And how do I for

Re: OO in Python? ^^

2005-12-10 Thread Fredrik Lundh
Matthias Kaeppler wrote: > polymorphism seems to be missing in Python QOTW! -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: pygene - genetic algorithms package

2005-12-10 Thread eXt
Erik Max Francis wrote: > Unfortunately I can't give a precise date. If I have the time, a > polished working system with at least the basics should only take a week > or so to finish up. Unfortunately, I have a big deadline coming up in > my day job, so I'm probably not going to get much time

Re: OO in Python? ^^

2005-12-10 Thread Heiko Wundram
Matthias Kaeppler wrote: > Let this enlighten your way, young padawan: [EMAIL PROTECTED] ~/gtk-gnutella-downloads $ python Python 2.4.2 (#1, Oct 31 2005, 17:45:13) [GCC 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)] on linux2 Type "help", "copyright", "credits" or "license" for more informat

OO in Python? ^^

2005-12-10 Thread Matthias Kaeppler
Hi, sorry for my ignorance, but after reading the Python tutorial on python.org, I'm sort of, well surprised about the lack of OOP capabilities in python. Honestly, I don't even see the point at all of how OO actually works in Python. For one, is there any good reason why I should ever inherit

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

2005-12-10 Thread Fredrik Lundh
Zeljko Vrba wrote: > Using indentation without block termination markers is opposite of the way we > write spoken language, terminating each sentence with . Ever wondered why > we use such things in written language, when people are much better in > guessing what the writer wanted to say then comp

Re: double underscore attributes?

2005-12-10 Thread Xavier Morel
[EMAIL PROTECTED] wrote: > Could someone explain the use of __add__ (and similar double underscore > attributes) and what their use is. > > Bob > Methods with double leading and trailing underscores are basically "magic methods" with specific meanings for the Python interpreter. You're not supp

Re: ANN: pygene - genetic algorithms package

2005-12-10 Thread Erik Max Francis
eXt wrote: > I'm really happy to see that someone is working on Python based GP > implementation :) I'm currently trying to get into GP world (I'm the GP > newbie you talked about :P) and, as I'm a Python programmer, I look > towards Python based solutions. Unfortunately there are no active Pyt

Re: calculate system disk space

2005-12-10 Thread Neil Hodgson
Heiko Wundram: > Under Windows you don't have sparse files though, so there > are no fields ... Does too! http://msdn.microsoft.com/library/en-us/fileio/fs/fsctl_set_sparse.asp They're fairly rare though. Neil -- http://mail.python.org/mailman/listinfo/python-list

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

2005-12-10 Thread Zeljko Vrba
On 2005-12-10, Tom Anderson <[EMAIL PROTECTED]> wrote: > > ED IS THE STANDARD TEXT EDITOR. > And: INDENTATION SUCKS BIG TIME. Using indentation without block termination markers is opposite of the way we write spoken language, terminating eac

Re: binascii.crc32 results not matching

2005-12-10 Thread Heiko Wundram
Larry Bates wrote: > > > The algorithm looks very much like the source code for > binascii.crc32 (but I'm not a C programmer). Well... As you have access to the code, you might actually just create a thin Python-Wrapper around this so that you can get comparable results. In case you're unable to

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >... >> Well, the hard-core solution is to note that your class doesn't really >> deal with the type Bar, but deals with a subtype of Bar for which x > >> 23 in all cases. Since types are represented by classes, y

Re: Proposal: Inline Import

2005-12-10 Thread Erik Max Francis
Shane Hathaway wrote: > Let me fully elaborate the heresy I'm suggesting: I am talking about > inline imports on every other line of code. The obvious implementation > would drop performance by a double digit percentage. Module importing is already idempotent. If you try to import an already

Re: double underscore attributes?

2005-12-10 Thread Dan Bishop
[EMAIL PROTECTED] wrote: ... > Every time I use dir(some module) I get a lot of attributes with double > underscore, for example __add__. Ok, I thought __add__ must be a method > which I can apply like this ... > I tried > >>> help(5.__add__) > > but got > SyntaxError: invalid syntax That's becaus

Re: double underscore attributes?

2005-12-10 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > Every time I use dir(some module) I get a lot of attributes with double > underscore, for example __add__. Ok, I thought __add__ must be a method > which I can apply like this > 5.__add(8) > > However Python responded > SyntaxError: invalid syntax > > I tried > >>

Re: slice notation as values?

2005-12-10 Thread Steven Bethard
Antoon Pardon wrote: > On 2005-12-10, Steven Bethard <[EMAIL PROTECTED]> wrote: > >>Antoon Pardon wrote: >> >>>So lets agree that tree['a':'b'] would produce a subtree. Then >>>I still would prefer the possibility to do something like: >>> >>> for key in tree.iterkeys('a':'b') >>> >>>Instead of h

Re: problems binding a dictionary

2005-12-10 Thread Dody Suria Wijaya
[EMAIL PROTECTED] wrote: > this has to be a very silly thing. > > I have a function foo taking a dictionary as parameters. i.e.: def > foo(**kwargs): pass > when I call foo(param1='blah',param2='bleh',param3='blih') everything > is fine. > but when I do: def foo(**kwargs): > ... pass > ..

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: > > "In addition to the full set of methods which operate on the coordinate as > > a whole, you can operate on the individual ordinates via instance.x and > > instance.y which are floats." > > That's an API which makes changing the object more difficult. It m

Re: double underscore attributes?

2005-12-10 Thread LocaWapp
Hi Bob, see this my example: >>> class A: ... def __add__(a,b): ... print a,b ... >>> a = A() >>> b = A() >>> a + b <__main__.A instance at 0x80c5a74> <__main__.A instance at 0x80c6234> >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: slice notation as values?

2005-12-10 Thread Brian Beck
Antoon Pardon wrote: > Will it ever be possible to write things like: > > a = 4:9 I made a silly recipe to do something like this a while ago, not that I'd recommend using it. But I also think it wouldn't be too far-fetched to allow slice creation using a syntax like the above... http://aspn.

Re: double underscore attributes?

2005-12-10 Thread Wojciech Mula
[EMAIL PROTECTED] wrote: > Now I went to Python Library Reference and searched for "__add__" but > got zero hits. http://python.org/doc/2.4.2/ref/specialnames.html -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find the type ...

2005-12-10 Thread Lad
Thank you ALL for help and explanation Regards, L. -- http://mail.python.org/mailman/listinfo/python-list

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > Well, the hard-core solution is to note that your class doesn't really > deal with the type Bar, but deals with a subtype of Bar for which x > > 23 in all cases. Since types are represented by classes, you should > subclass Bar so you have a class that

double underscore attributes?

2005-12-10 Thread bobueland
Entering >>>dir(5) I get ['__abs__', '__add__', '__and__', '__class__', '__cmp__', '__coerce__', '__delattr__', '__div__', '__divmod__', '__doc__', '__float__', '__floordiv__', '__getattribute__', '__getnewargs__', '__hash__', '__hex__', '__init__', '__int__', '__invert__', '__long__', '__lshift__

locawapp-001.zip

2005-12-10 Thread LocaWapp
LocaWapp: localhost web applications V.0.0.1 (2005 Dec 10) Copyright (C) 2005 RDJ This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. http://LocaWapp.blogspot.com - Run with: python run.py - or: python run.py 8081 - and browse

Re: slice notation as values?

2005-12-10 Thread Devan L
Antoon Pardon wrote: > On 2005-12-10, Duncan Booth <[EMAIL PROTECTED]> wrote: [snip] > >> I also think that other functions could benefit. For instance suppose > >> you want to iterate over every second element in a list. Sure you > >> can use an extended slice or use some kind of while. But why n

Re: binascii.crc32 results not matching

2005-12-10 Thread Raymond L. Buvel
Larry Bates wrote: Looking over the code, it seems very inefficient and hard to understand. You really should check out the following. http://sourceforge.net/projects/crcmod/ It will allow you to generate efficient CRC functions for use in Python and in C or C++. The only thing you need to in

Re: ANN: pygene - genetic algorithms package

2005-12-10 Thread eXt
Erik Max Francis wrote: > Sure thing. Obviously I'll post an announcement here when it's ready. I'm really happy to see that someone is working on Python based GP implementation :) I'm currently trying to get into GP world (I'm the GP newbie you talked about :P) and, as I'm a Python programmer,

Re: calculate system disk space

2005-12-10 Thread Heiko Wundram
[EMAIL PROTECTED] wrote: > A little somehting I rigged up when I found the Python call to be Linux > specific: os.stat isn't Linux-specific, isn't even Unix-specific, works just fine under Windows. Under Windows you don't have sparse files though, so there are no fields which give you the block-si

Re: Proposal: Inline Import

2005-12-10 Thread Shane Hathaway
Benji York wrote: > Shane Hathaway wrote: > >> Benji York wrote: >> >>> OK, good. You won't have to worry about that. :) >> >> >> You didn't give a reason for disliking it. > > > Oh, I don't particularly dislike it. I hadn't come up with a reason to > like or dislike it, other than a predilec

Re: Managing import statements

2005-12-10 Thread Shane Hathaway
Chris Mellon wrote: > On 12/10/05, Shane Hathaway <[EMAIL PROTECTED]> wrote: >>I'm surprised this problem isn't more familiar to the group. Perhaps >>some thought I was asking a newbie question. I'm definitely a newbie in >>the sum of human knowledge, but at least I've learned some tiny fraction

Re: Proposal: Inline Import

2005-12-10 Thread Benji York
Shane Hathaway wrote: > Benji York wrote: > >> OK, good. You won't have to worry about that. :) > > You didn't give a reason for disliking it. Oh, I don't particularly dislike it. I hadn't come up with a reason to like or dislike it, other than a predilection for the status quo. -- Benji York

Re: Another newbie question

2005-12-10 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >... >> >> it. Nothing you do with zim.foo or zim.foo.bar can change the state of >> >> zim. The only invariants you need to check are bar's, which you do at >> >> the exit to it's baz method. >> > So foo's class

Re: Proposal: Inline Import

2005-12-10 Thread Thomas Heller
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 woul

Re: Managing import statements

2005-12-10 Thread Shane Hathaway
Jean-Paul Calderone wrote: > On Sat, 10 Dec 2005 02:21:39 -0700, Shane Hathaway <[EMAIL PROTECTED]> wrote: >>How about PyLint / PyChecker? Can I configure one of them to tell me >>only about missing / extra imports? Last time I used one of those >>tools, it spewed excessively pedantic warnings.

Re: calculate system disk space

2005-12-10 Thread [EMAIL PROTECTED]
A little somehting I rigged up when I found the Python call to be Linux specific: """ mount_list Taste the system and return a list of mount points. On UNIX this will return what a df will return On DOS based systems run through a list of common drive letters and test them to see if a mount point

Re: Managing import statements

2005-12-10 Thread Kent Johnson
Jean-Paul Calderone wrote: > On Sat, 10 Dec 2005 02:21:39 -0700, Shane Hathaway > <[EMAIL PROTECTED]> wrote: >> How about PyLint / PyChecker? Can I configure one of them to tell me >> only about missing / extra imports? Last time I used one of those >> tools, it spewed excessively pedantic warni

Re: Another newbie question

2005-12-10 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: >> In particular, >> you can get most of your meaningless methods out of a properly >> designed Coordinate API. For example, add/sub_x/y_ord can all be >> handled with move(delta_x = 0, delta_y = 0). > > Here is my example again: > > [quote] > Then, somew

Re: Proposal: Inline Import

2005-12-10 Thread Mike Meyer
Shane Hathaway <[EMAIL PROTECTED]> writes: > Let me fully elaborate the heresy I'm suggesting: I am talking about > inline imports on every other line of code. The obvious > implementation would drop performance by a double digit percentage. No, it wouldn't. The semantics of import pretty much re

Re: binascii.crc32 results not matching

2005-12-10 Thread Fredrik Lundh
Larry Bates wrote: > def CalculateCrc(buffer, crc): /snip/ > The algorithm looks very much like the source code for > binascii.crc32 (but I'm not a C programmer). does your Python version give the right result ? if so, the following might be somewhat helpful: def test1(text, crc=0): # l

Re: problems binding a dictionary

2005-12-10 Thread Sam Pointon
You're not 'exploding' the dict to the param1='blah' etc form - you-re actually passing it in as a single dict object. To solve this, add a ** to the front of a dict you want to explode in a function, just as you'd add a * to explode a sequence. -- http://mail.python.org/mailman/listinfo/python-l

Re: problems binding a dictionary

2005-12-10 Thread vida00
[EMAIL PROTECTED] wrote: > this has to be a very silly thing. > > I have a function foo taking a dictionary as parameters. i.e.: def > foo(**kwargs): pass > when I call foo(param1='blah',param2='bleh',param3='blih') everything > is fine. > but when I do: > >>> def foo(**kwargs): > ... pass > .

Re: Thoughts on object representation in a dictionary

2005-12-10 Thread Paul Rubin
"py" <[EMAIL PROTECTED]> writes: > Well the other thing is that I am allowed to store strings in this > dictionary...so I can't just store the Engine and Body object and later > use them. this is just a requirement (which i dont understand > either)...but its what I have to do. Probably so th

problems binding a dictionary

2005-12-10 Thread vida00
this has to be a very silly thing. I have a function foo taking a dictionary as parameters. i.e.: def foo(**kwargs): pass when I call foo(param1='blah',param2='bleh',param3='blih') everything is fine. but when I do: >>> def foo(**kwargs): ... pass ... >>> d=dict(param1='blah',param2='bleh',par

Re: slice notation as values?

2005-12-10 Thread Antoon Pardon
On 2005-12-10, Duncan Booth <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> In general I use slices over a tree because I only want to iterate >> over a specific subdomain of the keys. I'm not iterested in make >> a tree over the subdomain. Making such a subtree would be an >> enormous waste o

Re: binascii.crc32 results not matching

2005-12-10 Thread Larry Bates
Peter Hansen wrote: > Larry Bates wrote: > >> I'm trying to get the results of binascii.crc32 >> to match the results of another utility that produces >> 32 bit unsigned CRCs. > > > What other utility? As Tim says, there are many CRC32s... the > background notes on this one happen to stumble

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

2005-12-10 Thread Tom Anderson
On Sat, 10 Dec 2005, Sybren Stuvel wrote: > Zeljko Vrba enlightened us with: > >> Find me an editor which has folds like in VIM, regexp search/replace >> within two keystrokes (ESC,:), marks to easily navigate text in 2 >> keystrokes (mx, 'x), can handle indentation-level matching as well as >>

Re: Managing import statements

2005-12-10 Thread Jean-Paul Calderone
On Sat, 10 Dec 2005 02:21:39 -0700, Shane Hathaway <[EMAIL PROTECTED]> wrote: >Let's talk about the problem I really want help with. I brought up a >proposal earlier, but it was only half serious. I realize Python is too >sacred to accept such a heretical change. ;-) > >Here's the real problem: m

Re: newbie question

2005-12-10 Thread Dody Suria Wijaya
How about this: python your_program.py examle.txt Bermi wrote: > > how i can link it to read my file examle.txt? -- http://mail.python.org/mailman/listinfo/python-list

Re: small inconsistency in ElementTree (1.2.6)

2005-12-10 Thread Damjan
>>> ascii strings and unicode strings are perfectly interchangable, with >>> some minor exceptions. >> >> It's not only translate, it's decode too... > > why would you use decode on the strings you get back from ET ? Long story... some time ago when computers wouldn't support charsets people inven

Re: Another newbie question

2005-12-10 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > >> it. Nothing you do with zim.foo or zim.foo.bar can change the state of > >> zim. The only invariants you need to check are bar's, which you do at > >> the exit to it's baz method. > > So foo's class is not allowed to have as its invariant any formul

Re: slice notation as values?

2005-12-10 Thread Antoon Pardon
On 2005-12-10, Steven Bethard <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> So lets agree that tree['a':'b'] would produce a subtree. Then >> I still would prefer the possibility to do something like: >> >> for key in tree.iterkeys('a':'b') >> >> Instead of having to write >> >> for k

Re: slice notation as values?

2005-12-10 Thread Duncan Booth
Antoon Pardon wrote: > In general I use slices over a tree because I only want to iterate > over a specific subdomain of the keys. I'm not iterested in make > a tree over the subdomain. Making such a subtree would be an > enormous waste of resources. Probably not unless you have really large data

Re: Another newbie question

2005-12-10 Thread Antoon Pardon
On 2005-12-10, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 10 Dec 2005 01:28:52 -0500, Mike Meyer wrote: > > The not-so-wise programmer takes abstraction as an end itself, and > consequently spends more time and effort defending against events which > almost certainly will never happen tha

Re: slice notation as values?

2005-12-10 Thread Steven Bethard
Antoon Pardon wrote: > So lets agree that tree['a':'b'] would produce a subtree. Then > I still would prefer the possibility to do something like: > > for key in tree.iterkeys('a':'b') > > Instead of having to write > > for key in tree['a':'b'].iterkeys() > > Sure I can now do it like this:

Re: Documentation suggestions

2005-12-10 Thread Fredrik Lundh
I wrote: > if it turns out that this doesn't scale (has anyone put up that library > reference wiki yet? ;-) if anyone's interested, here's a seealso file for the python library reference: http://effbot.org/zone/seealso-python-library.xml this was generated from the global module index by t

newbie question

2005-12-10 Thread Bermi
i have this program === from sys import * import math import math, Numeric from code import * from string import * from math import * from dataSet import * from string import * def drawAsciiFile(): _fileName=str(argv[1]) __localdataSet=DataSet(_fileName) #_PlotCols=str

Re: binascii.crc32 results not matching

2005-12-10 Thread Raymond L. Buvel
Tim Peters wrote: > [Raymond L. Buvel] > >>Check out the unit test in the following. >> >>http://sourceforge.net/projects/crcmod/ > > > Cool! > > >>I went to a lot of trouble to get the results to match the results of >>binascii.crc32. As you will see, there are a couple of extra operations >

Re: binascii.crc32 results not matching

2005-12-10 Thread Tim Peters
[Raymond L. Buvel] > Check out the unit test in the following. > > http://sourceforge.net/projects/crcmod/ Cool! > I went to a lot of trouble to get the results to match the results of > binascii.crc32. As you will see, there are a couple of extra operations > even after you get the polynomial a

  1   2   >