Re: SimplePrograms challenge

2007-06-21 Thread Pete Forman
page. Classes should precede unittest as the latter uses a new style class. Perhaps the thing to do is to add links to the tutorial for those seeking further enlightenment. If your page gets much bigger it will lose its original attraction. -- Pete Forman-./\.- Disclaimer:

Re: matplotlib basic question

2007-04-20 Thread Pete Forman
of the box then look at Enthought. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlumberger or http://petef.port5.com -./\.- WesternGeco. -

Re: matplotlib basic question

2007-04-23 Thread Pete Forman
cussed and it is currently based on Python 2.4.3. http://code.enthought.com/enthon/ -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlum

Re: Python's handling of unicode surrogates

2007-04-24 Thread Pete Forman
gates. Operations based on concatenation will conform to Unicode, whether or not there are surrogates in the strings. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opin

local variable referenced before assignment

2007-10-25 Thread Pete Bartonly
Quick question, probably quite a simple matter. Take the follow start of a method: def review(filesNeedingReview): for item in filesNeedingReview: (tightestOwner, logMsg) = item if (logMsg != None): for logInfo in logMsg.changed_paths: This generates the

Re: local variable referenced before assignment

2007-10-25 Thread Pete Bartonly
A.T.Hofkamp wrote: > On 2007-10-25, Pete Bartonly <[EMAIL PROTECTED]> wrote: >> Quick question, probably quite a simple matter. Take the follow start of >> a method: >> >> >> def review(filesNeedingReview): >> >> for item in filesNeedin

Re: local variable referenced before assignment

2007-10-25 Thread Pete Bartonly
A.T.Hofkamp wrote: > On 2007-10-25, Pete Bartonly <[EMAIL PROTECTED]> wrote: >> Quick question, probably quite a simple matter. Take the follow start of >> a method: > With respect to compactness and style, you can move your multi-assignment > statement in the for loop

Re: local variable referenced before assignment

2007-10-25 Thread Pete Bartonly
Peter Otten wrote: > Pete Bartonly wrote: > >> Quick question, probably quite a simple matter. Take the follow start of >> a method: >> >> >> def review(filesNeedingReview): >> >> for item in filesNeedingReview: >> (tightestO

Re: local variable referenced before assignment

2007-10-25 Thread Pete Bartonly
Pete Bartonly wrote: > > Quick question, probably quite a simple matter. Take the follow start of > a method: > > > def review(filesNeedingReview): > > for item in filesNeedingReview: > (tightestOwner, logMsg) = item > > if (logMsg != No

Re: When is min(a, b) != min(b, a)?

2008-01-21 Thread Pete Forman
ally represents the result of an invalid operation. Using it for missing value is not in the draft standard, though it is not forbidden either. If NaNs in your data are important then you must take care in explicit and implicit comparisons to consider unordered results.

Re: When is min(a, b) != min(b, a)?

2008-01-24 Thread Pete Forman
ords they never return NaN unless all their arguments are NaN. int(nan) should raise an exception. I note that in Python 2.5.1 int(inf) already does. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does

Re: When is min(a, b) != min(b, a)?

2008-01-25 Thread Pete Forman
ed after a set of calculations. With pipelining the exact cause of the exception will be unknown. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- t

Re: Python Standardization: Wikipedia entry

2008-02-01 Thread Pete Forman
standards.iso.org/ittf/PubliclyAvailableStandards/index.html -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlumberger or http:

Re: Will Python on day replace MATLAB?????????????????????????????????????????????????????

2008-02-01 Thread Pete Forman
actually *implement* such ideas, not just to plan for them. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlumberger or http://petef.

Re: best way to have enum-like identifiers?

2008-03-12 Thread Pete Forman
re's a better way of doing this, > some kind of enum-like thing or somesuch. https://launchpad.net/munepy describes itself as yet another Python enum implementation. Its author is Barry Warsaw. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco

Re: Pycon disappointment

2008-03-16 Thread Pete Forde
> I know what the argument for the results of Pycon 2008 will be: we > needed the money. My answer: it's not worth it. If this is what you > have to do to grow the conference, then don't. If the choice is > between selling my experience to vendors and reducing the size of the > conference, then cut

Re: Reading new mail from outlook using Python

2008-03-24 Thread Pete Stapley
Well on a FreeBSD/Unix system you can use the .forward to pipe the incoming mail for a user to a program. Below is the contents of my .forward that invokes procmail. "|/usr/local/bin/procmail -m /path/to/conf/.procmailrc" So I imagine you could do something like this in a .forward. "|/path/myp

Re: Tkinter w.pack()?

2009-02-09 Thread Pete Forman
, > I see why I'd never find it. The BM entry does not show "Google". It > does now. ;-) As well as the site: modifier check out inurl: and friends. http://www.google.com/help/operators.html -- Pete Forman-./\.- Disclaimer: This post is originated Wester

Re: optparse versus getopt

2009-02-11 Thread Pete Forman
. You might also like to check out Jython 2.5 which is in beta. Jython 2.2 needs optparse.py and textwrap.py. These can be copied from Python 2.3 or Optik 1.4.1 or later. May also need gettext.py and locale.py. -- Pete Forman-./\.- Disclaimer: This post is originated W

Re: alt.possessive.its.has.no.apostrophe

2008-12-16 Thread Pete Forman
uage, dammit! Ours, ours, ours! > > This decision was actually taken at a meeting of the Society of > British pedants on November 23, 1786. This led to a schism between > the British and the newly-independent Americans, who responded by > taking the "u" o

Re: alt.possessive.its.has.no.apostrophe

2008-12-16 Thread Pete Forman
> >> out of colour, valour, and aluminium. >> >> > Darn Americans and their alminim ;-) >> >> > Next thing you know, they'll be putting an I in TEAM.[1] >> >> It's called humour. Or humor. Or incompetence ;-) > > There's an 

Re: docpicture

2008-10-15 Thread Pete Forman
e to embed the image. AFAIK a downside is that MS are only starting to support that in IE8. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlumberger or htt

Re: compare items in list to x

2008-11-02 Thread Pete Kirkham
2 is not equal to '2' -- http://mail.python.org/mailman/listinfo/python-list

Re: int() and leading zeros in Python 2.6

2008-11-12 Thread Pete Forman
Peter Otten <[EMAIL PROTECTED]> writes: > you're wrong. Indeed I am, sorry for the waste of time. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.-

int() and leading zeros in Python 2.6

2008-11-12 Thread Pete Forman
later? >>> int('09'.lstrip('0')) 9 Is the documentation for int([x[, radix]]) correct? I'd say that the default for radix has become 0. http://docs.python.org/library/functions.html#int -- Pete Forman-./\.- Disclaimer: This post is originated

Re: Am I missing something with Python not having interfaces?

2008-05-13 Thread Pete Forman
I would suggest that using an interface at compile time is not the only approach. Unit tests can be run on classes to check that they do indeed quack. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent

Re: code of a function

2008-05-30 Thread Pete Forman
alex23 <[EMAIL PROTECTED]> writes: > Which is very handy, like most of IPython. +1 QOTW -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlum

Re: Fast and easy GUI prototyping with Python

2008-06-22 Thread Pete Kirkham
now if there's some pit waiting for me to fall into. Pete -- http://mail.python.org/mailman/listinfo/python-list

Re: C++ or Python

2008-07-02 Thread Pete Kirkham
2008/6/29 Dan Stromberg <[EMAIL PROTECTED]>: > > On Sun, 29 Jun 2008 11:20:45 +0200, Sebastian \"lunar\" Wiesner wrote: > > > Dan Stromberg <[EMAIL PROTECTED]>: > > > >> things like passing a method as a function parameter is a no-brainer > >> (requires extra syntax in java because of the cautious

Re: Multiline text in XML file

2008-08-03 Thread Pete Kirkham
ittle more difficult for XPath processing. Pete -- http://mail.python.org/mailman/listinfo/python-list

Re: developing web spider

2008-04-02 Thread Pete Wright
The O'Reilly Spidering Hacks book is also really good, albeit a little too focussed on Perl. On Apr 2, 9:54 am, [EMAIL PROTECTED] wrote: > On Apr 2, 6:37 am, abeen <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I would want to know which could be the best programming language for > > developing we

Python crashes consistently

2008-04-16 Thread Pete Crite
from the terminal and the mac pop-up window from the crash. Any help would be very much appreciated! Cheers, Pete. The terminal says: > Error: Target org.macports.build returned: shell command " cd "/opt/ > local/var/macports/build/ > _opt_local_var_macports_sources_rsyn

Re: Python crashes consistently

2008-04-16 Thread Pete Crite
On 16/04/2008, at 9:38 PM, [EMAIL PROTECTED] wrote: > > which python ? from macports or macpython ? > -- > http://mail.python.org/mailman/listinfo/python-list > MacPorts. It automatically downloaded 2.5.2. My original message is reproduced below. On 16/04/2008, at 5:50

Re: Python crashes consistently

2008-04-16 Thread Pete Crite
(i.e. into /opt/local/)? Thanks, Pete. On 16/04/2008, at 9:56 PM, Diez B. Roggisch wrote: > > Pete Crite wrote: > >> Hello, >> >> I've been trying to install Gnumeric via MacPorts recently, but I >> can't get past the installation of py25-numpy. >

Re: Python-URL! - weekly Python news and links (Sep 9)

2008-09-10 Thread Pete Forman
looks as if that Large Hadron Collider is having ill effects already. A week has been stretched into 6 years. ;-) http://lists.xml.org/archives/xml-dev/200302/msg00259.html -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and

Re: PEP proposal optparse

2008-09-19 Thread Pete Forman
ore ' 'the results tarball', 'previousrel': 'Top level dir of previous release for regression ' 'analysis'} parser.add_option('-q', '--quiet', action="store_false", dest='verbose&#

Re: python syntax for conditional is unfortunate

2008-09-24 Thread Pete Forman
x27; % i + ('s' if i != 1 else '') for i in range(4): print '%d thing%s' % (i, ('s', '')[i==1]) for i in range(4): print '%d thing%s' % (i, 's' if i != 1 else '') -- Pete Forman-./\.- Disclaim

multiprocessing callbacks?

2009-12-14 Thread Pete Hunt
erred", defer.Deferred, DeferredProxy) This, however, fails, because "cb" and "eb" cannot be pickled. I don't actually need to pickle them, though, because I want them to run on the machine on which they were created. Is there a way, in multiprocessing, that I

Re: xmlrpc slow in windows 7 if hostnames are used

2010-02-08 Thread Pete Forman
anti-virus. Several products put a long list of blacklist sites in the hosts file. Windows can be rather slow to process that file. -- Pete Forman-./\.- West Sussex, UK -./\.- http://petef.22web.net -./\.- petef4+use...@gmail.com -./\.- -- http://mail.python.org/mailman/listinfo/python-list

Evaluate my first python script, please

2010-03-04 Thread Pete Emerson
I've written my first python program, and would love suggestions for improvement. I'm a perl programmer and used a perl version of this program to guide me. So in that sense, the python is "perlesque" This script parses /etc/hosts for hostnames, and based on terms given on the command line (argv)

Re: Evaluate my first python script, please

2010-03-04 Thread Pete Emerson
Great responses, thank you all very much. I read Jonathan Gardner's solution first and investigated sets. It's clearly superior to my first cut. I love the comment about regular expressions. In perl, I've reached for regexes WAY too much. That's a big lesson learned too, and from my point of view

Re: Evaluate my first python script, please

2010-03-05 Thread Pete Emerson
Thanks for your response, further questions inline. On Mar 4, 11:07 am, Tim Wintle wrote: > On Thu, 2010-03-04 at 10:39 -0800, Pete Emerson wrote: > > I am looking for advice along the lines of "an easier way to do this" > > or "a more python way" (I&#x

Re: Evaluate my first python script, please

2010-03-05 Thread Pete Emerson
On Mar 5, 7:00 am, Duncan Booth wrote: > Jean-Michel Pichavant wrote: > > And tell me how not using regexp will ensure the /etc/hosts processing > > is correct ? The non regexp solutions provided in this thread did not > > handled what you rightfully pointed out about host list and commented > >

Re: Evaluate my first python script, please

2010-03-05 Thread Pete Emerson
On Mar 5, 10:19 am, "sjdevn...@yahoo.com" wrote: > On Mar 5, 10:53 am, Pete Emerson wrote: > > > > > > > Thanks for your response, further questions inline. > > > On Mar 4, 11:07 am, Tim Wintle wrote: > > > > On Thu, 2010-03-04 at 10:39 -08

Conditional based on whether or not a module is being used

2010-03-05 Thread Pete Emerson
ething else. In other words, I don't want to create a dependency of foobar on foo. My failed search for solving this makes me wonder if I'm approaching this all wrong. Thanks in advance, Pete -- http://mail.python.org/mailman/listinfo/python-list

Re: Conditional based on whether or not a module is being used

2010-03-05 Thread Pete Emerson
On Mar 5, 11:24 am, Pete Emerson wrote: > In a module, how do I create a conditional that will do something > based on whether or not another module has been loaded? > > Suppose I have the following: > > import foo > import foobar > > print foo() > print foobar() &g

Re: Conditional based on whether or not a module is being used

2010-03-05 Thread Pete Emerson
On Fri, Mar 5, 2010 at 12:17 PM, Chris Rebert wrote: > On 3/5/10, Pete Emerson wrote: >> In a module, how do I create a conditional that will do something >> based on whether or not another module has been loaded? >> >> Suppose I have the following: >> >>

Re: Conditional based on whether or not a module is being used

2010-03-05 Thread Pete Emerson
On Mar 5, 12:06 pm, "Martin P. Hellwig" wrote: > On 03/05/10 19:24, Pete Emerson wrote: > > > In a module, how do I create a conditional that will do something > > based on whether or not another module has been loaded? > > > > If someone is using foo

Re: Conditional based on whether or not a module is being used

2010-03-05 Thread Pete Emerson
On Mar 5, 11:57 am, MRAB wrote: > Pete Emerson wrote: > > In a module, how do I create a conditional that will do something > > based on whether or not another module has been loaded? > > > Suppose I have the following: > > > import foo > > import fo

Re: Conditional based on whether or not a module is being used

2010-03-05 Thread Pete Emerson
On Mar 5, 1:14 pm, Chris Rebert wrote: > On Fri, Mar 5, 2010 at 12:25 PM, Pete Emerson wrote: > > On Fri, Mar 5, 2010 at 12:17 PM, Chris Rebert wrote: > >> On 3/5/10, Pete Emerson wrote: > >>> In a module, how do I create a conditional that will do something

best practices: is collections.defaultdict my friend or not?

2010-03-05 Thread Pete Emerson
"more rigid" way of doing things common throughout python, and is it best that I not fight it, but embrace it? Your thoughts and comments are very much appreciated. I think my brain already knows some of the answers, but my heart ... well, perl and I go way back. Loving python so far, though. Pete -- http://mail.python.org/mailman/listinfo/python-list

Re: best practices: is collections.defaultdict my friend or not?

2010-03-05 Thread Pete Emerson
On Mar 5, 6:10 pm, Andreas Waldenburger wrote: > On Fri, 5 Mar 2010 17:22:14 -0800 (PST) Pete Emerson > > > > > > wrote: > > [snip] > > >>> data['one'] = {} > > >>> data['one']['two'] = 'three

Re: best practices: is collections.defaultdict my friend or not?

2010-03-05 Thread Pete Emerson
On Mar 5, 8:24 pm, Steven D'Aprano wrote: > On Fri, 05 Mar 2010 17:22:14 -0800, Pete Emerson wrote: > > Why isn't the behavior of collections.defaultdict the default for a > > dict? > > Why would it be? > > If you look up a key in a dict: > > add

Re: best practices: is collections.defaultdict my friend or not?

2010-03-05 Thread Pete Emerson
On Mar 5, 6:26 pm, MRAB wrote: > Pete Emerson wrote: > > I've been wrestling with dicts. I hope at the very least what I > > discovered helps someone else out, but I'm interested in hearing from > > more learned python users. > > > I found out that

Re: Conditional based on whether or not a module is being used

2010-03-06 Thread Pete Emerson
On Mar 6, 2:38 pm, Vinay Sajip wrote: > On Mar 5, 9:29 pm, Pete Emerson wrote: > > > > > I have written my first module called "logger" that logs to syslog via > > the syslog module but also allows forloggingto STDOUT in debug mode > > at multiple levels (

Exiting gracefully from ThreadingTCPServer

2010-03-12 Thread Pete Emerson
anually control-c it. I think that I need *all* threads to close and not just the current one, so I'm not quite sure how to proceed. Pointers in the right direction are appreciated. And if there's a "better" way to do this threading httpd server (subject

Re: if, continuation and indentation

2010-06-09 Thread Pete Forman
e to hold the result of the condition and then the if statement is more readable. -- Pete Forman-./\.- West Sussex, UK -./\.- http://petef.22web.net -./\.- petef4+use...@gmail.com -./\.- -- http://mail.python.org/mailman/listinfo/python-list

Exposing all methods of a class

2017-02-26 Thread Pete Dowdell
ports and grab the parent classes to insert into the editor view. Any suggestions? Maybe there are better ways of navigating inheritance but it does seem logical to expose the whole class code in one place, suitably annotated. I feel a plugin coming on. Ta, Pete -- https://mail.python.org/ma

Re: Who still supports recent Python on shared hosting

2017-03-05 Thread Pete Forman
Is Python on shared hosting dead? > I don't need a whole VM and something I > have to sysadmin, just a small shared > hosting account. I use OpenShift from Red Hat on their free hosting package. They offer Python 3.5, 3.3 and 2.7. -- Pete Forman https://payg-petef.rhcloud.com -- h

Re: What's with all of the Case Solution and Test Bank nonsense posts?

2017-07-10 Thread Pete Forman
FC 8143) describes the use of TLS with NNTP. It enhances the connection between NNTP client and server, primarily with encryption but optionally with other benefits. Of course it does nothing to improve the content of Usenet. -- Pete Forman -- https://mail.python.org/mailman/listinfo/python-list

Re: Case-insensitive string equality

2017-08-31 Thread Pete Forman
gt; operator either. > > > > Thoughts? This seems to me to be rather similar to sort() and sorted(). How about giving equals() an optional parameter key, and perhaps the older cmp? Using casefold or upper or lower would satisfy many use cases but also allow Unicode or more locale specific normalization to be applied. The shortcircuiting in a character based comparison holds little appeal for me. I generally find that a string is a more useful concept than a collection of characters. +1 for using an affix in the name to represent a normalized version of the input. -- Pete Forman -- https://mail.python.org/mailman/listinfo/python-list

Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-10 Thread pete . bee . emm
I've been using compiler.ast.flatten, but I have comments indicating it will need be replaced if/when I move to Python 3. I don't pollute my code base with flatten, I just call my own version in my utility library that is currently redirecting to flatten. flatten works equally well with tuples

Re: Teaching python to non-programmers

2014-04-10 Thread pete . bee . emm
Don't underestimate the value of morale. Python is a scripting language. You don't need to teach them very much python to get something working, and you can always revisit the initial code and refactor it for better coding hygiene. Someday they might have jobs, and be required to learn things i

Re: Teaching python to non-programmers

2014-04-10 Thread pete . bee . emm
> > Just awesome, not only do we have double line spacing and single line > > paragraphs, we've also got top posting, oh boy am I a happy bunny :) > > I'll leave someone3 else to explain, I just can't be bothered. > > Do you get paid to be a jerk, or is it just for yuks? If the latter, yo

Re: Teaching python to non-programmers

2014-04-11 Thread pete . bee . emm
On Thursday, April 10, 2014 3:40:22 PM UTC-7, Rhodri James wrote: > It's called irony, and unfortunately Mark is reacting to an all-to-common > situation that GoogleGroups foists on unsuspecting posters like yourself. People who say "I can't be bothered to correct this" while posting a wise a

namespace question

2006-04-19 Thread Nugent, Pete (P.)
modify the test_var variable form another module? Pete -- http://mail.python.org/mailman/listinfo/python-list

<    1   2