Re: why _import__ only works from interactive interpreter?

2006-05-07 Thread BartlebyScrivener
I'm on Windows, but I think you need the shebang thing at the top of your script, right? Then, put whatever you want to import in a script or module called testmod.py. Then you should be able to import either into a script or at the command line using simply: import testmod If it doesn't work

Re: why _import__ only works from interactive interpreter?

2006-05-07 Thread [EMAIL PROTECTED]
It's not that, it looks like __import__looks into sys.path, so if use an absolute path it cannot work. I found this thread and it seems they are right:

Re: Can I use python for this .. ??

2006-05-07 Thread placid
Terry Reedy wrote: placid [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] .) When you hibernate/boot up/hibernate for a long time without a clean reboot, Windows becomes unstable... This seems to depend on the system. I have gone at least a week, maybe two, with nightly

Re: md5 from python different then md5 from command line

2006-05-07 Thread John Salerno
Paul Rubin wrote: John Salerno [EMAIL PROTECTED] writes: Any reason you can't just read the whole file at once and update m? Yes, you could say print md5.new(file('foo.exe').read()).hexdigest() but that means reading the whole file into memory at once. If the file is very large,

utility functions within a class?

2006-05-07 Thread John Salerno
I might be missing something obvious here, but I decided to experiment with writing a program that involves a class, so I'm somewhat new to this in Python. Anyway, what is the best way to create a function (A) within a class that another function (B) can use? Function A is not something that

Re: why _import__ only works from interactive interpreter?

2006-05-07 Thread I V
On Sun, 07 May 2006 16:21:01 -0700, [EMAIL PROTECTED] wrote: So, if this is right, I need to put the .py file to be imported inside sys.path!! And the relative path will be usedto find the module. Can I __import__ providing the absolute path? import sys print sys.path ['',

Re: python 2.5a2, gcc 4.1 and memory problems

2006-05-07 Thread Giovanni Bajo
Michele Petrazzo wrote: Then I execute my test. The memory usage of 2.5a2 and gcc 3.3 that I see with top, is the same (about VIRT: 260 MB and RES: 250MB ) that with the py 2.3 and 2.4, but then I recompile with 4.1 and execute the same test, my system stop to work... with top I can see that

Re: utility functions within a class?

2006-05-07 Thread blair . bethwaite
It sounds like all you want is some encapsulation, the following makes methods __head__ and __body__ private - the double underscores are important. I'd suggest reading the Object bits of the python tutorial also. class HTMLWrapper: def generate(self, ...): ... self.__head__(foo)

Re: A critic of Guido's blog on Python's lambda

2006-05-07 Thread Chris Lambacher
On Sun, May 07, 2006 at 11:57:55AM -0700, Alex Martelli wrote: [1] I'm considering introducing bugs or misdesigns that have to be fixed as part of training for the purposes of this discussion. Also the Actually, doing it _deliberately_ (on training projects for new people just coming

Re: utility functions within a class?

2006-05-07 Thread [EMAIL PROTECTED]
You do *NOT* want to put double-underscores before and after a method name. That does not indicate a private method, it indicates a magic method -- something that has special meaning to Python. Thus, you have special methods like __init__(), __len__(), __getattr__(), __setattr__(), etc; all of

evaluation of

2006-05-07 Thread Gary Wessle
Hi what does the i a in this code mean. because the code below is giving False for all the iteration. isn't suppose to evaluate each value of i to the whole list? thanks a = range(8) i = 0 while i 11: print i a i = i + 1 False False False False False False False False False False

Re: Numerical Python Tutorial errors

2006-05-07 Thread Gary Wessle
Robert Kern [EMAIL PROTECTED] writes: Gary Wessle wrote: Hi is the Numerical Python tutorial maintained? http://www.pfdubois.com/numpy/html2/numpy.html seams to have some errors and no email to mail them to when found. No, it is not since Numeric itself is no longer maintained. The

Re: Python Eggs Just install in *ONE* place? Easy to uninstall?

2006-05-07 Thread [EMAIL PROTECTED]
But not matter where eggs are installed they are never spread across multiple places on hard drive right? An egg is all under one node of tree right? -- http://mail.python.org/mailman/listinfo/python-list

Getting HTTP responses - a python linkchecking script.

2006-05-07 Thread blair . bethwaite
Hi Folks, I'm thinking about writing a script that can be run over a whole site and produce a report about broken links etc... I've been playing with the urllib2 and httplib modules as a starting point and have found that with urllib2 it doesn't seem possible to get HTTP status codes. I've had

Re: utility functions within a class?

2006-05-07 Thread blair . bethwaite
You do *NOT* want to put double-underscores before and after a method name. That does not indicate a private method, it indicates a magic method WHOOPS!! Sorry, I haven't touched python for a few months and just started working on a script this morning so was going to post my own question

Re: evaluation of

2006-05-07 Thread Roy Smith
In article [EMAIL PROTECTED], Gary Wessle [EMAIL PROTECTED] wrote: Hi what does the i a in this code mean. because the code below is giving False for all the iteration. isn't suppose to evaluate each value of i to the whole list? thanks a = range(8) i = 0 while i 11: print i a

Re: utility functions within a class?

2006-05-07 Thread John Salerno
[EMAIL PROTECTED] wrote: Even if you don't end up referring to self or any instance attributes within the method, it's simpler to keep it as a normal method. Thanks, that makes sense to me! So basically just create them as methods, and if I want a little 'privacy' I can lead with an

Image SIG ML Moderator does not respond

2006-05-07 Thread Calvin Spealman
I have tried repeatedly to make a post to the Image SIG ML, and get nothing but automated responses that I must wait for word from the moderator to approve my posting on the list. I have gotten no reply, positive or not, in over a month. I am assuming the Image SIG moderator is currently MIA. What

Re: utility functions within a class?

2006-05-07 Thread John Salerno
[EMAIL PROTECTED] wrote: Even if you don't end up referring to self or any instance attributes within the method Hmm, follow-up: I *do* plan to refer to instance attributes inside these methods (self.something), but does that require that they be instance methods, or can they still reference

Re: utility functions within a class?

2006-05-07 Thread John Salerno
John Salerno wrote: [EMAIL PROTECTED] wrote: Even if you don't end up referring to self or any instance attributes within the method Hmm, follow-up: I *do* plan to refer to instance attributes inside these methods (self.something), but does that require that they be instance methods,

Re: evaluation of

2006-05-07 Thread John Machin
On 8/05/2006 12:45 PM, Gary Wessle wrote: what does the i a in this code mean. because the code below is giving False for all the iteration. isn't suppose to evaluate each value of i to the whole list? thanks But that's EXACTLY what it's doing; each integer value named i is notionally being

Re: Image SIG ML Moderator does not respond

2006-05-07 Thread Robert Kern
Calvin Spealman wrote: I have tried repeatedly to make a post to the Image SIG ML, and get nothing but automated responses that I must wait for word from the moderator to approve my posting on the list. I have gotten no reply, positive or not, in over a month. I am assuming the Image SIG

How can I do this with python ?

2006-05-07 Thread Xiao Jianfeng
Dear all, In a shell script, I can run a command which need interactive input like this, #!/bin/sh A_Command-EOF a b c EOF But, how can I do this with python ? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: A critic of Guido's blog on Python's lambda

2006-05-07 Thread Ken Tilton
[EMAIL PROTECTED] wrote: Alex Martelli wrote: Steve R. Hastings [EMAIL PROTECTED] wrote: ... But the key in the whole thread is simply that indentation will not scale. Nor will Python. This is a curious statement, given that Python is famous for scaling well. I think ridiculous is a

Re: utility functions within a class?

2006-05-07 Thread blair . bethwaite
John Salerno wrote: Ugh, sorry about another post, but let me clarify: In these utility functions, I need to refer to an attribute of an instance, but these functions will be called from another method in the class, not from the instance itself. Is this even possible, or would 'self' have no

Re: utility functions within a class?

2006-05-07 Thread John Salerno
[EMAIL PROTECTED] wrote: I'm having trouble deciphering what this bit means - but these functions will be called from another method in the class, not from the instance itself, I don't think it makes sense. Yeah, I'm starting to see that as I tried to implement it. Here's what I came up

which is better, string concatentation or substitution?

2006-05-07 Thread John Salerno
My initial feeling is that concatenation might take longer than substitution, but that it is also easier to read: def p(self, paragraph): self.source += 'p' + paragraph + '/p\n\n' vs. def p(self, paragraph): self.source += 'p%s/p\n\n' % paragraph Is there a preference between

Re: utility functions within a class?

2006-05-07 Thread blair . bethwaite
John Salerno wrote: What I originally meant was that they would not be called from an instance *outside* the class itself, i.e. they won't be used when writing another script, they are only used by the class itself. Yep, so you want to encapsulate the functionality that those methods provide,

dial-up from python script

2006-05-07 Thread Jon Van DeVries
I want to create a simple script that dials my modem to whatever number I specify. Any tips on modules to be used? google didn't help much this time. Platform: SuSE 10.1 Linux 2.6.x (but since it will be done in Python, I'm assuming it doesn't matter what platform I'm using right?) thanks in

Re: which is better, string concatentation or substitution?

2006-05-07 Thread Leif K-Brooks
John Salerno wrote: My initial feeling is that concatenation might take longer than substitution Doesn't look that way: [EMAIL PROTECTED]:~$ python -m timeit 'p%s/p\n\n' % 'foobar' 100 loops, best of 3: 0.6 usec per loop [EMAIL PROTECTED]:~$ python -m timeit 'p' + 'foobar' + '/p\n\n'

Re: A critic of Guido's blog on Python's lambda

2006-05-07 Thread Tomasz Zielonka
I V wrote: Monads are one of those parts of functional programming I've never really got my head around, but as I understand them, they're a way of transforming what looks like a sequence of imperative programming statements that operate on a global state into a sequence of function calls

Re: A critic of Guido's blog on Python's lambda

2006-05-07 Thread Ken Tilton
Alexander Schmolck wrote: [trimmed groups] Ken Tilton [EMAIL PROTECTED] writes: yes, but do not feel bad, everyone gets confused by the /analogy/ to spreadsheets into thinking Cells /is/ a spreadsheet. In fact, for a brief period I swore off the analogy because it was so invariably

Re: Designing Plug-in Systems in Python

2006-05-07 Thread Kent Johnson
mystilleef wrote: Hello, I need to design a plug-in system for a project. The goal is to allow third party developers interact with an application via plug-ins in a clean and robust manner. At this point I am overwhelmed by my inexperience with designing plug-in systems. One of these

Re: the print statement

2006-05-07 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Thank you. Yes, that post answers most of the questions. I now have a bit of an understanding of the \xhh pattern. It's still unclear to me, however, how one can go from the \x92 pattern and arrive at the apostrophe character. Is \x92 theh apostrophe character in

Re: A critic of Guido's blog on Python's lambda

2006-05-07 Thread Alex Martelli
Chris Lambacher [EMAIL PROTECTED] wrote: On Sun, May 07, 2006 at 11:57:55AM -0700, Alex Martelli wrote: [1] I'm considering introducing bugs or misdesigns that have to be fixed as part of training for the purposes of this discussion. Also the Actually, doing it _deliberately_

Re: A critic of Guido's blog on Python's lambda

2006-05-07 Thread Tomasz Zielonka
Alex Martelli wrote: Worst case, you name all your functions Beverly so you don't have to think about the naming I didn't think about this, probably because I am accustomed to Haskell, where you rather give functions different names (at the module top-level you have no other choice). I just

Re: which is better, string concatentation or substitution?

2006-05-07 Thread fuzzylollipop
niether .join() is the fastest -- http://mail.python.org/mailman/listinfo/python-list

reading a column from a file

2006-05-07 Thread Gary Wessle
Hi I have a file with data like location pressure temp str flootfloot I need to read pressure and temp in 2 different variables so that I can plot them as lines. is there a package which reads from file with a given formate and returns desired variables? or I need to open, while not

[ python-Bugs-595601 ] file (amp; socket) I/O are not thread safe

2006-05-07 Thread SourceForge.net
Bugs item #595601, was opened at 2002-08-15 11:34 Message generated for change (Comment added) made by aegis You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=595601group_id=5470 Please note that this message will contain a full copy of the comment thread,

[ python-Bugs-1471427 ] tarfile.py chokes on long names

2006-05-07 Thread SourceForge.net
Bugs item #1471427, was opened at 2006-04-16 22:34 Message generated for change (Comment added) made by alexanderweb You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1471427group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1481770 ] hpux ia64 shared lib ext should be .so

2006-05-07 Thread SourceForge.net
Bugs item #1481770, was opened at 2006-05-04 05:43 Message generated for change (Comment added) made by deckrider You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1481770group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Feature Requests-1110010 ] 'attrmap' function, attrmap(x)['attname'] == x.attname

2006-05-07 Thread SourceForge.net
Feature Requests item #1110010, was opened at 2005-01-26 11:28 Message generated for change (Comment added) made by gregsmith You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=1110010group_id=5470 Please note that this message will contain a full copy of the

[ python-Bugs-1483384 ] Add set.member() method

2006-05-07 Thread SourceForge.net
Bugs item #1483384, was opened at 2006-05-07 11:41 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1483384group_id=5470 Please note that this message will contain a full copy of

[ python-Feature Requests-1483384 ] Add set.member() method

2006-05-07 Thread SourceForge.net
Feature Requests item #1483384, was opened at 2006-05-07 15:41 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=1483384group_id=5470 Please note that this message will contain a full copy of the

[ python-Feature Requests-1483384 ] Add set.member() method

2006-05-07 Thread SourceForge.net
Feature Requests item #1483384, was opened at 2006-05-07 10:41 Message generated for change (Comment added) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=1483384group_id=5470 Please note that this message will contain a full copy of

<    1   2