Re: Structured programming with optionParser

2010-08-31 Thread NickC
for this example to work. Many thanks, very useful. -- NickC -- http://mail.python.org/mailman/listinfo/python-list

Structured programming with optionParser

2010-08-30 Thread NickC
? Thanks, -- NickC -- http://mail.python.org/mailman/listinfo/python-list

How to Embed PHP in HTML print

2010-01-24 Thread NickC
includes? Many thanks for any help. -- NickC -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Embed PHP in HTML print

2010-01-24 Thread NickC
prints that to insert it into the html output. And I thought it would be hard; I should have known better. -- NickC -- http://mail.python.org/mailman/listinfo/python-list

Re: Vim breaks after Python upgrade

2009-11-20 Thread NickC
, sed'ing 's:2\.5:2\.6:g' doesn't work. It does change some strings, but not (apparently) the numbers that matter. -- NickC -- http://mail.python.org/mailman/listinfo/python-list

Vim breaks after Python upgrade

2009-11-17 Thread NickC
, or are the library locations used by the loader coded in binary rather than ascii (and so, harder to find)? Thanks, -- NickC -- http://mail.python.org/mailman/listinfo/python-list

Create object from variable indirect reference?

2009-11-10 Thread NickC
me in the right direction here? (The library is PyEphem, an extraordinarily useful library for anyone interested in astronomy.) Many thanks, -- NickC -- http://mail.python.org/mailman/listinfo/python-list

Re: Create object from variable indirect reference?

2009-11-10 Thread NickC
Many thanks for the replies. getattr() works great: name='Moon' m2 = getattr(ephem,name)() m2.compute(home) print ephem.localtime(m2.rise_time) 2009-11-11 01:30:36.02 shows the moon will rise at 1:30am localtime tonight at my home location. Excellent. -- NickC -- http

Re: Why does python not have a mechanism for data hiding?

2008-06-04 Thread NickC
On May 26, 7:32 am, Joe P. Cool [EMAIL PROTECTED] wrote: I saw this don't need it pattern in discussions about the ternary if..else expression and about except/finally on the same block level. Now Python has both. if/else was added solely because people kept coming up with ways of embedding a

Re: Why does python not have a mechanism for data hiding?

2008-06-04 Thread NickC
On May 26, 2:49 pm, Russ P. [EMAIL PROTECTED] wrote: I am also bothered a bit by the seeming inconsistency of the rules for the single underscore. When used at file scope, they make the variable or function invisible outside the module, but when used at class scope, the underscored variables

Re: Why does python not have a mechanism for data hiding?

2008-06-04 Thread NickC
On Jun 4, 4:09 am, Russ P. [EMAIL PROTECTED] wrote: What is it about leading underscores that bothers me? To me, they are like a small pebble in your shoe while you are on a hike. Yes, you can live with it, and it does no harm, but you still want to get rid of it. With leading underscores, you

Re: Why does python not have a mechanism for data hiding?

2008-06-04 Thread NickC
On May 25, 8:01 pm, Fuzzyman [EMAIL PROTECTED] wrote: Python was not really written with 'difficult' customers in mind ;-) True. It's extremely suited to what we do though.Minor difficulties like this are vastly outweighed by advantages. The difficulties are real though. It's interesting to

Re: Why does python not have a mechanism for data hiding?

2008-06-04 Thread NickC
On Jun 4, 4:41 pm, Antoon Pardon [EMAIL PROTECTED] wrote: Guido has been known to change his mind, which is an admirabele quality, but it does show that at some point he rejected a good idea or accepted a bad idea. And sometimes the person that talked him into accepting the bad idea in the

Re: Why does python not have a mechanism for data hiding?

2008-06-04 Thread NickC
On Jun 4, 9:24 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: NickC [EMAIL PROTECTED] writes: if/else was added solely because people kept coming up with ways of embedding a pseudo conditional inside expressions and writing buggy code in the process. All it really saves you in practice

Re: Why does python not have a mechanism for data hiding?

2008-06-04 Thread NickC
On Jun 4, 9:56 pm, Ben Finney [EMAIL PROTECTED] wrote: Those unit tests should *not*, though, exercise anything but the public API, otherwise they're breaking encapsulation. Their assertion should continue to be just as true after a refactoring of the internal components as before. Python

Re: Finally had to plonk google gorups.

2008-04-21 Thread NickC
Hmm, according to this thread I probably shouldn't bother even trying to contribute to c.l.p discussions that are highlighted in the Python- URL announcements, even in cases where I think a core developer's perspective may be of interest. As someone that only posts here rarely, and uses Google

Re: Java or C++?

2008-04-21 Thread NickC
On Apr 15, 1:46 pm, Brian Vanderburg II [EMAIL PROTECTED] wrote: This will automatically call the constructors of any contained objects to initialize the string. The implicit assignment operator automatically performs the assignment of any contained objects. Destruction is also automatic.

Re: PyCon Feedback and Volunteers (Re: Pycon disappointment)

2008-03-19 Thread NickC
On Mar 19, 6:07 am, Jeff Schwab [EMAIL PROTECTED] wrote: As I have never attended PyCon, the amount of entertainment already gleaned from this thread has wildly exceeded my expectations. :) Are slides or notes from any of the presentations available online? What was the topic of the

Re: for-else

2008-03-11 Thread NickC
On Mar 4, 11:27 pm, [EMAIL PROTECTED] wrote: The meaning is explicit. While else seems to mean little there. So I may like something similar for Python 3.x (or the removal of the else). Consider a loop with the following form: while 1: if while-cond: 0-to-many times code block else:

Re: Embedding a literal \u in a unicode raw string.

2008-03-04 Thread NickC
On Feb 26, 8:45 am, rmano [EMAIL PROTECTED] wrote: BTW, 2to3.py should warn when a raw string (not unicode) with \u in it, I think. I tried it and it seems to ignore the problem... Python 3.0a3+ (py3k:61229, Mar 4 2008, 21:38:15) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on

Re: How about adding rational fraction to Python?

2008-03-04 Thread NickC
On Mar 4, 7:11 am, Lie [EMAIL PROTECTED] wrote: On Mar 2, 11:36 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: Try with a=7, b=25 They should still compare true, but they don't. The reason why they don't is because of float's finite precision, which is not exactly what we're talking

Re: Module/package hierarchy and its separation from file structure

2008-02-04 Thread NickC
On Jan 31, 12:27 am, Gabriel Genellina [EMAIL PROTECTED] wrote: Python stores filename and line number information in code objects (only). If you have a reference to any code object (a method, a function, a traceback...) inspect can use it to retrieve that information. Aside from general

Re: getting n items at a time from a generator

2007-12-31 Thread NickC
On Dec 27 2007, 11:31 pm, Kugutsumen [EMAIL PROTECTED] wrote: On Dec 27, 7:24 pm, Terry Jones [EMAIL PROTECTED] wrote: Kugutsumen == Kugutsumen [EMAIL PROTECTED] writes: Kugutsumen On Dec 27, 7:07 pm, Paul Hankin [EMAIL PROTECTED] wrote: On Dec 27, 11:34 am, Kugutsumen [EMAIL

Re: Bizarre behavior with mutable default arguments

2007-12-31 Thread NickC
On Jan 1, 3:22 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: On Dec 31, 10:58 am, Odalrick [EMAIL PROTECTED] wrote: I'm surprised noone has said anything about the why of default mutables. I think it is becasue it isn't easy to do it an other way. [...] There is an easy enough way:

Re: Python 3.0 migration plans?

2007-10-01 Thread NickC
On Sep 30, 2:29 am, John Roth [EMAIL PROTECTED] wrote: I was thinking of starting work on converting Python FIT to 3.0, and then they posted PEP 3137. I think it's a real good idea, but it shows that 3.0a1 isn't ready for a conversion effort. http://www.python.org/dev/peps/pep-3137/ I'll

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread NickC
On Sep 24, 9:16 pm, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: Matthew Woodcraft a écrit : One reason for the different syntax is that functions, unlike most other objects, know their own names (which can be shown in tracebacks and the like). Nope. They know *one* of their names

Re: Python 2.4 online certification - new items available for Beta testing

2006-10-17 Thread NickC
[EMAIL PROTECTED] wrote: Randy There is a free Beta test of a Python 2.4 Certification test Randy available at Brainbench.com. They are a provider of skills-based Randy certification exams. Go to the link below to find the test. It Randy is free to take the test. Randy

Re: Log rolling question

2005-10-26 Thread NickC
If you're on Python 2.4, then consider whether or not you can use a TimedRotatingLogFileHandler from the logging module to handle this for you: http://www.python.org/doc/2.4.1/lib/node344.html Of course, that only works if defining a month as 30 days is acceptable. If you genuinely need calendar

Re: Path inherits from basestring again

2005-07-29 Thread NickC
[Re: alternatives to overloading '/'] Is there a reason the Path constructor is limited to a single argument? If it allowed multiple arguments, the following would seem very straightforward: p = Path(somePath, user.getFolder(), 'archive', oldPath + .bak) I'm usually not much of a purist, but

Re: Path inherits from basestring again

2005-07-29 Thread NickC
[Re: how to get at the base class] Do you really want to have a only works for Path way to get at the base class, rather than using the canonical Path.__bases__[0]? How about a new property in the os.path module instead? Something like os.path.path_type. Then os.path.path_type is unicode if and

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-06 Thread NickC
Ralf, I'd be very interested to hear your opinion on the 'namespace' module, which looks at addressing some of these issues (the Record object, in particular). The URL is http://namespace.python-hosting.com, and any comments should be directed to the [EMAIL PROTECTED] discussion list. Regards,

Re: Which kid's beginners programming - Python or Forth?

2005-06-30 Thread NickC
Gentle folk of comp.lang.python, I heartily thank you all for your input. I think I'm taking the boys through the door marked Logo. We may be back this way, though. We will likely need MORE in the nebulous future. I am impressed with the outpouring of support here! Before you commit

Re: Favorite non-python language trick?

2005-06-30 Thread NickC
Steven D'Aprano wrote: with colour do begin red := 0; blue := 255; green := 0; end; instead of: colour.red := 0; colour.blue := 255; colour.green := 0; c = colour c.red = 0; c.blue = 255; c.green = 0 del c # Not strictly needed, but limits the scope of c When everything's a reference, the

Re: case/switch statement?

2005-06-23 Thread NickC
Andrew Durdin wrote: In this case the dictionary is obviously a better and clearer choice. I've generally found for other circumstances where I've used switch statements that the code ends up more readable if it's reorganised so that the switch statements are all of the form above, or are