Re: Newbie question - clearing screen @ interactive prompt

2005-12-09 Thread matt
Just press Control-L. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question - clearing screen @ interactive prompt

2005-12-09 Thread Max Ischenko
Well, you can run any system command from within Python as well: import os os.system('clear') But I'm not sure this will help in this case. Are you trying to program a console app in Python? If so, you may want to look into curses module or other console lib that has Python bindings (like newt)

Properties transfer between instances of different classes, without subclassing

2005-12-09 Thread Pierre
Folks, I'm pretty new to OOP, so I still have problems with inheritance and delegation. I defined 2 Numeric MaskedArray subclasses, as: class Temp(MA,object): def __init__(self,data): self = MA.__init__(self,data) cold = property(fget lambda self:masked_where(self<10,self) warm = p

Newbie question - clearing screen @ interactive prompt

2005-12-09 Thread Kaizer
Hello, I use python on Mandrake 10.2 2005 Ltd edition. I am learning so i use python interactively. How do i clear the screen in python?? I simply type "clear" on the Linux prompt and the screen clears there. Is there a similar command in Python to clear the interactive screen?? Thanks in advan

Re: Another newbie question

2005-12-09 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Thu, 08 Dec 2005 20:46:33 -0500, Mike Meyer wrote: >> 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 d

Re: newby question: Splitting a string - separator

2005-12-09 Thread James Stroud
Steven D'Aprano wrote: > On Fri, 09 Dec 2005 18:02:02 -0800, James Stroud wrote: > > >>Thomas Liesner wrote: >> >>>Hi all, >>> >>>i am having a textfile which contains a single string with names. >>>I want to split this string into its records an put them into a list. >>>In "normal" cases i would

Re: binascii.crc32 results not matching

2005-12-09 Thread Peter Hansen
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 out at the top of the list in respo

Re: newby question: Splitting a string - separator

2005-12-09 Thread Steven D'Aprano
On Fri, 09 Dec 2005 18:02:02 -0800, James Stroud wrote: > Thomas Liesner wrote: >> Hi all, >> >> i am having a textfile which contains a single string with names. >> I want to split this string into its records an put them into a list. >> In "normal" cases i would do something like: >> >> >>>#!

Re: Thoughts on object representation in a dictionary

2005-12-09 Thread Steven D'Aprano
On Fri, 09 Dec 2005 11:37:30 -0800, py wrote: > Say I have classes which represent parts of a car such as Engine, Body, > etc. Now I want to represent a Car in a nested dictionary like... > > {string_id:{engine_id:engine_object, body_id:body_object}}ok? > > Well the other thing is that I am

Re: Another newbie question

2005-12-09 Thread Steven D'Aprano
On Thu, 08 Dec 2005 20:46:33 -0500, Mike Meyer wrote: > 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

Re: register keyevent in wxpython

2005-12-09 Thread Chris Mellon
On 9 Dec 2005 01:52:27 -0800, ash <[EMAIL PROTECTED]> wrote: > hi, > is there a way to register application wide hotkey in wxpython? > i tried wxWindow::RegisterHotKey(). but the problem is it registers the > hotkey as a system wide hotkey. this causes problems in other > applications running concu

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

2005-12-09 Thread Steven D'Aprano
On Fri, 09 Dec 2005 02:59:44 -0600, D H wrote: > Fredrik Lundh wrote: >> Zeljko Vrba wrote: >> >> >>>But look at the following example: >>> >>>if a: >>> some_code1 >>>if b: >>> some_code2 >>> >>>If I accidentaly delete if b:, then some_code2 gets under the if a: which is >>>not intended. >> >

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

2005-12-09 Thread Steven D'Aprano
On Fri, 09 Dec 2005 08:15:14 +, Zeljko Vrba wrote: > On 2005-12-08, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >> Making a mistake in indentation level is precisely analogous to leaving >> out markers in other languages. If your editor is smart enough, and the >> > But look at the following

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

2005-12-09 Thread Steven D'Aprano
On Fri, 09 Dec 2005 09:34:44 +0100, Fredrik Lundh wrote: > do you often remove code by accident? is this some vi-specific problem ? +1 QOTW I wish I had thought of saying that! In fact, I think I will have done! -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: newby question: Splitting a string - separator

2005-12-09 Thread Michael Spencer
[EMAIL PROTECTED] wrote: > Thomas Liesner wrote: >> Hi all, >> >> i am having a textfile which contains a single string with names. >> I want to split this string into its records an put them into a list. >> In "normal" cases i would do something like: >> >>> #!/usr/bin/python >>> inp = open("file"

Re: subset permutations

2005-12-09 Thread Steven D'Aprano
On Fri, 09 Dec 2005 16:03:46 +1100, Ben Finney wrote: >> Do you want the result to be: >> AB, AC, AD, BC, BD, CD > > That is the complete set of combinations of the letters. > >> Or, do you want AB,BA,AC,CA,AD,DA,BC,CB,BD,DB,CD,DB ? > > That is the complete set of permutations of the letters.

Re: newby question: Splitting a string - separator

2005-12-09 Thread James Stroud
Kent Johnson wrote: > James Stroud wrote: > >> The one I like best goes like this: >> >> py> data = "Guido van Rossum Tim Peters Thomas Liesner" >> py> names = [n for n in data.split() if n] >> py> names >> ['Guido', 'van', 'Rossum', 'Tim', 'Peters', 'Thomas', 'Liesner'] >> >> I think it is t

Re: newby question: Splitting a string - separator

2005-12-09 Thread bonono
Thomas Liesner wrote: > Hi all, > > i am having a textfile which contains a single string with names. > I want to split this string into its records an put them into a list. > In "normal" cases i would do something like: > > > #!/usr/bin/python > > inp = open("file") > > data = inp.read() > > name

Re: Make a generator from a recursive function

2005-12-09 Thread James Stroud
Alex Martelli wrote: > James Stroud <[EMAIL PROTECTED]> wrote: >... > >>This was my answer to the thread "new in programing": >> >>def do_something(*args): >> print args >> >>def do_deeply(first, depth, lim, doit=True, *args): >> if depth < lim: >> do_deeply(first+1, depth+1, lim, Fals

Re: Another newbie question

2005-12-09 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> > What classes' invariants do you have to check in those cases? E.g., >> > consider zim.foo.bar.baz() -- you do have to check the invariants of >> > bar, foo AND zim, right? >> Nope, just bar. Attributes display s

Re: Make a generator from a recursive function

2005-12-09 Thread Alex Martelli
James Stroud <[EMAIL PROTECTED]> wrote: ... > This was my answer to the thread "new in programing": > > def do_something(*args): >print args > > def do_deeply(first, depth, lim, doit=True, *args): >if depth < lim: > do_deeply(first+1, depth+1, lim, False, *args) >if first <= d

Re: Proposal: Inline Import

2005-12-09 Thread Stephen Prinster
Shane Hathaway wrote: > Do you have any ideas on how to improve the process of maintaining > imports? Benji's suggestion of jumping around doesn't work for moving > code and it interrupts my train of thought. Sprinkling the code with > import statements causes a speed penalty and a lot of clutter

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 operation, every time but >> the first one in a program. >

Re: Another newbie question

2005-12-09 Thread Alex Martelli
Mike Meyer <[EMAIL PROTECTED]> wrote: ... > > What classes' invariants do you have to check in those cases? E.g., > > consider zim.foo.bar.baz() -- you do have to check the invariants of > > bar, foo AND zim, right? > > Nope, just bar. Attributes display state, they don't let you change > it.

Re: newby question: Splitting a string - separator

2005-12-09 Thread Tim Peters
[James Stroud] >> The one I like best goes like this: >> >> py> data = "Guido van Rossum Tim Peters Thomas Liesner" >> py> names = [n for n in data.split() if n] >> py> names >> ['Guido', 'van', 'Rossum', 'Tim', 'Peters', 'Thomas', 'Liesner'] >> >> I think it is theoretically faster (and more

Re: binascii.crc32 results not matching

2005-12-09 Thread Tim Peters
[Larry Bates] > I'm trying to get the results of binascii.crc32 > to match the results of another utility that produces > 32 bit unsigned CRCs. binascii.crc32 returns > results in the range of -2**31-1 and 2**21-1. Has > anyone ever worked out any "bit twiddling" code to > get a proper unsigned 32

Re: puzzled about class attribute resolution and mangling

2005-12-09 Thread James Stroud
Brian van den Broek wrote: > Hi all, > > I've the following code snippet that puzzles me: > > class Base(object): > __v, u = "Base v", "Base u" > def __init__(self): > print self.__v, self.u > > class Derived(Base): > __v, u = "Derived v", "Derived u" > def __init__(self)

Re: uuDecode problem

2005-12-09 Thread Alex Martelli
py <[EMAIL PROTECTED]> wrote: > Thanks...I think base64 will work just fine...and doesnt seem to have > 45 byte limitations, etc. Sure, base64 is a better encoding by all criteria, unless you specifically need to use uu encoding for compatibility with other old software. Alex -- http://mail.py

pyqt

2005-12-09 Thread Kuljo
Hi, I'm trying to explore pyqt: ev erthing works OK, but I have still two questions: - Can I execute bash commands in a python script (e.g. ls -l or grep)? - In the QT Designer there are also KDE-widgets but I'm not sucseeded to get them work in pyqt (it says: "self.kProgress1 = KProgress(self,"kP

Re: newby question: Splitting a string - separator

2005-12-09 Thread Kent Johnson
James Stroud wrote: > The one I like best goes like this: > > py> data = "Guido van Rossum Tim Peters Thomas Liesner" > py> names = [n for n in data.split() if n] > py> names > ['Guido', 'van', 'Rossum', 'Tim', 'Peters', 'Thomas', 'Liesner'] > > I think it is theoretically faster (and more p

puzzled about class attribute resolution and mangling

2005-12-09 Thread Brian van den Broek
Hi all, I've the following code snippet that puzzles me: class Base(object): __v, u = "Base v", "Base u" def __init__(self): print self.__v, self.u class Derived(Base): __v, u = "Derived v", "Derived u" def __init__(self): print self.__v, self.u sup

Make a generator from a recursive function

2005-12-09 Thread James Stroud
This was my answer to the thread "new in programing": def do_something(*args): print args def do_deeply(first, depth, lim, doit=True, *args): if depth < lim: do_deeply(first+1, depth+1, lim, False, *args) if first <= depth: do_deeply(first+1, depth, lim, True, *args + (first,))

Re: Proposal: Inline Import

2005-12-09 Thread Kent Johnson
Shane Hathaway wrote: > 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 operation, every time but >> the first one in a program. > > I'm ta

Re: PHP = Perl Improved

2005-12-09 Thread J�rgen Exner
Roedy Green wrote: Of course I have Xah plonked but thanks to your > On 9 Dec 2005 11:15:16 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote >> [...] Perl, of which i have mastery. I had the laugh of the week. Thank you very much, you really made my day. jue -- http://mail.python.org/mailman/listi

Re: newby question: Splitting a string - separator

2005-12-09 Thread James Stroud
Thomas Liesner wrote: > Hi all, > > i am having a textfile which contains a single string with names. > I want to split this string into its records an put them into a list. > In "normal" cases i would do something like: > > >>#!/usr/bin/python >>inp = open("file") >>data = inp.read() >>names =

Re: Proposal: Inline Import

2005-12-09 Thread Shane Hathaway
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 operation, every time but > the first one in a program. I'm talking about using imports *everywhere*

Re: PHP = Perl Improved

2005-12-09 Thread IchBin
Thomas G. Marshall wrote: > Roedy Green said something like: >> On 9 Dec 2005 11:15:16 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote, quoted >> or indirectly quoted someone who said : >> >>> recently i got a project that involves the use of php. In 2 days, i >>> read almost the entirety of the php doc

Re: How to detect the presence of a html file

2005-12-09 Thread Kent Johnson
Peter Hansen wrote: > Kent Johnson wrote: > >> The simplest fix is to use raw strings for all your Windows path needs: >> os.path.isfile(r'c:\bookmarks.html') >> os.path.isfile(r'c:\wumpus.c') > > > Simpler still is almost always to use forward slashes instead: > > os.path.isfile('c:/bookmarks.

binascii.crc32 results not matching

2005-12-09 Thread Larry Bates
I'm trying to get the results of binascii.crc32 to match the results of another utility that produces 32 bit unsigned CRCs. binascii.crc32 returns results in the range of -2**31-1 and 2**21-1. Has anyone ever worked out any "bit twiddling" code to get a proper unsigned 32 bit result from binascii.

Re: Catching error text like that shown in console?

2005-12-09 Thread Kent Johnson
Peter A. Schott wrote: > I know there's got to be an easy way to do this - I want a way to catch the > error text that would normally be shown in an interactive session and put that > value into a string I can use later. I've tried just using a catch statement > and trying to convert the output to

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: Catching error text like that shown in console?

2005-12-09 Thread Larry Bates
Peter A. Schott wrote: > I know there's got to be an easy way to do this - I want a way to catch the > error text that would normally be shown in an interactive session and put that > value into a string I can use later. I've tried just using a catch statement > and trying to convert the output t

Re: Documentation suggestions

2005-12-09 Thread BartlebyScrivener
Mike, This is probably a dumb thing to suggest, but I'm interested in knowing why it's dumb, if that makes sense? Could you use one of those free VMWare players? It makes a virtual operating system within an operating system as I understand it. http://www.vmware.com/products/player/ I just thin

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: PHP = Perl Improved

2005-12-09 Thread Thomas G. Marshall
Roedy Green said something like: > On 9 Dec 2005 11:15:16 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote, quoted > or indirectly quoted someone who said : > >> recently i got a project that involves the use of php. In 2 days, i >> read almost the entirety of the php doc. Finding it a breeze because it

Re: Validating an email address

2005-12-09 Thread Tim Williams (gmail)
On 09/12/05, Ben Finney <[EMAIL PROTECTED]> wrote: The only validation you should be doing before sending the message ison the domain part. Since there are records available in DNS toverify, you can check those. Is there an MX record? Is the addressvalid? Do the mappings both way for that record ma

Re: Documentation suggestions

2005-12-09 Thread Mike Meyer
Paul Rubin 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 expressions, which is what it seems like the Ruby thing

Re: new in programing

2005-12-09 Thread James Stroud
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Mike C. Fletcher <[EMAIL PROTECTED]> wrote: > >>Python iterates over "things" (objects), of which integer numbers are >>just one possible choice. The range built-in command produces ranges of >>integers which are useful for tasks such as

Re: Proposal: Inline Import

2005-12-09 Thread Shane Hathaway
Mike Meyer wrote: > Shane Hathaway <[EMAIL PROTECTED]> writes: >>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 change code and later sca

Re: Proposal: Inline Import

2005-12-09 Thread Shane Hathaway
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 you > add strange syntactic sugar that do

Re: Proposal: Inline Import

2005-12-09 Thread Erik Max Francis
Shane Hathaway wrote: > I'd like a way to import modules at the point where I need the > functionality, rather than remember to import ahead of time. You can already do this; import statements don't have to be at the top of a Python script. This proposal is pretty much dead on arrival. -- Er

Re: Validating an email address

2005-12-09 Thread Tom Anderson
On Sat, 10 Dec 2005, Ben Finney wrote: > Tom Anderson <[EMAIL PROTECTED]> wrote: > >> A hoary old chestnut this - any advice on how to syntactically >> validate an email address? > > Yes: Don't. > >http://www.apps.ietf.org/rfc/rfc3696.html#sec-3> The IETF must have updated that RFC between yo

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: Proposal: Inline Import

2005-12-09 Thread Xavier Morel
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 you add strange syntactic sugar that doesn't actually bring anything? -- http://ma

Re: Proposal: Inline Import

2005-12-09 Thread Shane Hathaway
Benji York wrote: > OK, good. You won't have to worry about that. :) You didn't give a reason for disliking it. Shane -- http://mail.python.org/mailman/listinfo/python-list

Re: Encoding of file names

2005-12-09 Thread Tom Anderson
On Fri, 9 Dec 2005, "Martin v. Löwis" wrote: Tom Anderson wrote: Isn't the key thing that Windows is applying a non-roundtrippable character encoding? This is a fact, but it is not a key thing. Of course Windows is applying a non-roundtrippable character encoding. What else could it do? W

Re: new in programing

2005-12-09 Thread Dan Bishop
Cameron Laird wrote: ... > for hextuple in [(i, j, k, l, m, n) > for i in range(1, lim + 1) \ > for j in range (1, lim + 2) \ > for k in range (1, lim + 3) \ > for l in range (1, lim + 4) \ > for m in range (1, lim + 5) \ > for n in range (1,

Re: calculate system disk space

2005-12-09 Thread Heiko Wundram
PyPK wrote: > I am looking for unix.the recipe is windows specific!! Parse the output of du/df? :-) I guess that would be simplest... ;-) Otherwise, use some combination of os.walk() and os.stat(), whereby you _don't_ use the stat.st_size field to get the file size (on disk) but rather use stat.s

Re: How to detect the presence of a html file

2005-12-09 Thread Peter Hansen
Irmen de Jong wrote: > Forward slashes as path separator only works on NTFS volumes I believe. I'm not sure what they *don't* work on, but at the least they also work across the network as in: os.listdir('//server/shared/xfer') Maybe that still qualifies as "NTFS"... -Peter -- http://mail.

Re: PHP = Perl Improved

2005-12-09 Thread Roedy Green
On 9 Dec 2005 11:15:16 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote, quoted or indirectly quoted someone who said : >recently i got a project that involves the use of php. In 2 days, i >read almost the entirety of the php doc. Finding it a breeze because it >is roughly based on Perl, of which i have

Re: Dectecting dir changes

2005-12-09 Thread Jean-Paul Calderone
On 9 Dec 2005 09:56:03 -0800, chuck <[EMAIL PROTECTED]> wrote: >Hmmm, that is an interesting idea. I've noticed the new book on >Twisted, thinking about picking it up. > >I assume that this little snippet will handle multiple/concurrent >incoming transfers via threading/sub-process, is scalable, s

Re: Documentation suggestions

2005-12-09 Thread Paul Rubin
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 expressions, which is what it seems like the Ruby thing is > limited to. > > On the other hand, with itera

Re: lambda (and reduce) are valuable

2005-12-09 Thread David Isaac
>>> Jibes against the lambda-clingers lead eventually to serious >>> questions of style in regard to variable namespacing, >>> lifespan, cleanup, and so on: >>> http://groups.google.com/group/comp.lang.python/browse_thread/thread/ad0e15cb6b8f2c32/ Alan Isaac <[EMAIL PROTECTED]> wrote:

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: Validating an email address

2005-12-09 Thread Ben Finney
Tom Anderson <[EMAIL PROTECTED]> wrote: > A hoary old chestnut this - any advice on how to syntactically > validate an email address? Yes: Don't. http://www.apps.ietf.org/rfc/rfc3696.html#sec-3> The only validation you should be doing before sending the message is on the domain part. Since t

Re: Proposal: Inline Import

2005-12-09 Thread Benji York
Shane Hathaway wrote: > Benji York wrote: [a quicker, but still manual, way to handle adding new imports] > That's something the computer should do for me. It's busywork. > Eclipse practically eliminates this busywork when I'm writing Java > code: if I autocomplete a name, it also quietly adds

Re: How to detect the presence of a html file

2005-12-09 Thread Irmen de Jong
BartlebyScrivener wrote: >> Even weirder, > >> os.path.isfile(r'c://bookmarks.html') > > Never mind. It works that way from the command line, too. Never tried > it before. Forward slashes as path separator only works on NTFS volumes I believe. --Irmen -- http://mail.python.org/mailman/listinfo

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 other classes, the assignments ha

Re: calculate system disk space

2005-12-09 Thread PyPK
I am looking for unix.the recipe is windows specific!! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find the type ...

2005-12-09 Thread Scott David Daniels
Xavier Morel wrote: > You can even do base conversions with it: > >>> a="0xe" > >>> int(a) > Traceback (most recent call last): > File "", line 1, in -toplevel- > int(a) > ValueError: invalid literal for int(): 0xe > >>> int(a,16) # Silly me, 0xe is not a decimal > 14 Or even say "lo

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: Encoding of file names

2005-12-09 Thread Martin v. Löwis
Tom Anderson wrote: > Isn't the key thing that Windows is applying a non-roundtrippable > character encoding? This is a fact, but it is not a key thing. Of course Windows is applying a non-roundtrippable character encoding. What else could it do? > Windows, however, maps that name to the > 8-bi

Re: How to detect the presence of a html file

2005-12-09 Thread BartlebyScrivener
> Even weirder, > os.path.isfile(r'c://bookmarks.html') Never mind. It works that way from the command line, too. Never tried it before. rd -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching error text like that shown in console?

2005-12-09 Thread gene tani
Peter A. Schott wrote: > I know there's got to be an easy way to do this - I want a way to catch the > error text that would normally be shown in an interactive session and put that > value into a string I can use later. I've tried just using a catch statement > and trying to convert the output t

Re: Dectecting dir changes

2005-12-09 Thread Zem
Why not use SGI's FAM (File Alteration Monitor)? It works under Linux...and I think I saw Solaris support somewhere. Under Linux, the FAM daemon doesn't use inefficient polling of the filesystem instead it monitors file changes through the kernel. Under Solaris, it'd probably fall back to polling

Re: is this a unicode/string bug?

2005-12-09 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I was going to submit to sourceforge, but my unicode skills are weak. > I was trying to strip characters from a string that contained values > outside of ASCII. I though I could just encode as 'ascii' in 'replace' > mode but it threw an error. Strangely enough, if I de

Re: new in programing

2005-12-09 Thread James Stroud
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Mike C. Fletcher <[EMAIL PROTECTED]> wrote: > >>Python iterates over "things" (objects), of which integer numbers are >>just one possible choice. The range built-in command produces ranges of >>integers which are useful for tasks such as

Re: How to detect the presence of a html file

2005-12-09 Thread BartlebyScrivener
Even weirder, os.path.isfile(r'c://bookmarks.html') also seems to work. How is that? -- http://mail.python.org/mailman/listinfo/python-list

is this a unicode/string bug?

2005-12-09 Thread olsongt
I was going to submit to sourceforge, but my unicode skills are weak. I was trying to strip characters from a string that contained values outside of ASCII. I though I could just encode as 'ascii' in 'replace' mode but it threw an error. Strangely enough, if I decode via the ascii codec and then

Re: new in programing

2005-12-09 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Mike C. Fletcher <[EMAIL PROTECTED]> wrote: >Python iterates over "things" (objects), of which integer numbers are >just one possible choice. The range built-in command produces ranges of >integers which are useful for tasks such as this. > >lim = 3 > >for i in ra

Re: calculate system disk space

2005-12-09 Thread jmdeschamps
PyPK wrote: > how can we compute the current system disk space using a python > script.? > any ideas or have anyone tried this.. Google, on "Python disk size", returned this link: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66455 Thanks for the reply recipe, Steve ;-) Jean-Marc --

calculate system disk space

2005-12-09 Thread PyPK
how can we compute the current system disk space using a python script.? any ideas or have anyone tried this.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal: Inline Import

2005-12-09 Thread Shane Hathaway
Benji York wrote: > Why not: 1) jump to the top of the file when you need to do an import > (1G in Vim), 2) add the import, 3) jump back to where you were (Ctrl-o > in Vim) and keep coding. This isn't Vim specific, I suspect all decent > editors have similar capabilities (I know Emacs does). T

Re: heartbeats

2005-12-09 Thread Tom Anderson
On Fri, 9 Dec 2005, Peter Hansen wrote: > Tom Anderson wrote: >> On Fri, 9 Dec 2005, Sybren Stuvel wrote: >>> You probably mean "really a ping, just not an ICMP echo request". >> >> What's a real ping, if not an ICMP echo request? That's pretty much the >> definitive packet for internetwork grop

Re: Thoughts on object representation in a dictionary

2005-12-09 Thread Peter Hansen
py wrote: ... > 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. Homework? > So my question is th

Re: How to detect the presence of a html file

2005-12-09 Thread Xavier Morel
Phoe6 wrote: > Operating System: Windows > Python version: 2.4 > > I have bookmarks.html and wumpus.c under my c: > > When I tried to check the presence of the bookmarks.html, I fail. > os.path.isfile('c:\bookmarks.html') > False os.path.isfile('c:\wumpus.c') > True > os.path.exi

Re: How to detect the presence of a html file

2005-12-09 Thread Peter Hansen
Kent Johnson wrote: > The simplest fix is to use raw strings for all your Windows path needs: > os.path.isfile(r'c:\bookmarks.html') > os.path.isfile(r'c:\wumpus.c') Simpler still is almost always to use forward slashes instead: os.path.isfile('c:/bookmarks.html') os.path.isfile('c:/wumpus.c') T

Re: Proposal: Inline Import

2005-12-09 Thread Benji York
Shane Hathaway wrote: > 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 > change code and later scan my changes to make matching changes

Re: heartbeats

2005-12-09 Thread Peter Hansen
Tom Anderson wrote: > On Fri, 9 Dec 2005, Sybren Stuvel wrote: >>You probably mean "really a ping, just not an ICMP echo request". > > What's a real ping, if not an ICMP echo request? That's pretty much the > definitive packet for internetwork groping as far as i know. I think that > the more ge

Re: new in programing

2005-12-09 Thread Mike C. Fletcher
Python iterates over "things" (objects), of which integer numbers are just one possible choice. The range built-in command produces ranges of integers which are useful for tasks such as this. lim = 3 for i in range( 1, lim+1 ): for j in range( i+1, lim+2): for k in range( j+1, lim+

Proposal: Inline Import

2005-12-09 Thread Shane Hathaway
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, my process is I change code and later scan my changes to make matching changes to t

Re: Overloading

2005-12-09 Thread Josef Meile
>>> In C++ you can overload functions and constructors. For example if I >>> have a >>> class that represents a complex number, than it would be nice if I can >>> write two seperate constructors >> >> >> >> Python doesn't support this, but it does support default arguments: > > Yes, in part you a

Thoughts on object representation in a dictionary

2005-12-09 Thread py
Say I have classes which represent parts of a car such as Engine, Body, etc. Now I want to represent a Car in a nested dictionary like... {string_id:{engine_id:engine_object, body_id:body_object}}ok? Well the other thing is that I am allowed to store strings in this dictionary...so I can't j

Re: Overloading

2005-12-09 Thread Josef Meile
>>In C++ you can overload functions and constructors. For example if I have a >>class that represents a complex number, than it would be nice if I can >>write two seperate constructors > > > Python doesn't support this, but it does support default arguments: Yes, in part you are right since the p

Re: Moving a package in cygwin

2005-12-09 Thread 63q2o4i02
Ok, thanks. I actually hadn't considered the build system, figuring that function names, etc., would somehow magically be "exported" to anyone wanting to use the .pyd library. Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: new in programing

2005-12-09 Thread Brett Hoerner
Efrain Marrero wrote: > i want to now how to do this in python > this is java > > > for(int i=1 ; i<=lim ; i++){ > > for(int j=i+1; j<=lim+1; j++){ > > for(int k =j+1; k<=lim+2;k++){ > > for(int l=k+1 ; l<=lim+3;l++){ > >

Re: How to detect the presence of a html file

2005-12-09 Thread Phoe6
Kent Johnson wrote: > The problem is that \ is special in string literals. \b is a backspace > character, not the two-character sequence you expect. \w has no special > meaning so it *is* the two-character sequence you expect. > The simplest fix is to use raw strings for all your Windows path need

Re: Documentation suggestions

2005-12-09 Thread A.M. Kuchling
On Thu, 8 Dec 2005 18:17:59 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > cool. can you post a sample page somewhere? It's not terribly interesting at the moment. The generated LaTeX looks like this: \seeurl{http://effbot.org/librarybook/zlib.htm}{The zlib module} And that gets f

PHP = Perl Improved

2005-12-09 Thread Xah Lee
recently i got a project that involves the use of php. In 2 days, i read almost the entirety of the php doc. Finding it a breeze because it is roughly based on Perl, of which i have mastery. i felt a sensation of neatness, as if php = Perl Improved, for a dedicated job of server-side scripting. Ev

new in programing

2005-12-09 Thread Efrain Marrero
i want to now how to do this in python this is java for(int i=1 ; i<=lim ; i++){ for(int j=i+1; j<=lim+1; j++){ for(int k =j+1; k<=lim+2;k++){

  1   2   >