[issue7447] Sum() doc and behavior mismatch

2010-07-29 Thread Leonhard Vogt
Changes by Leonhard Vogt leonhard.v...@gmx.ch: Removed file: http://bugs.python.org/file18223/functions.rst.patch4.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7447

[issue7447] Sum() doc and behavior mismatch

2010-07-29 Thread Leonhard Vogt
Leonhard Vogt leonhard.v...@gmx.ch added the comment: Thank you Georg, I updated the patch Ezio, wouldn't start=0 in the signature imply that sum accepted a keyword argument? I read Documenting Python (4.3) but am not sure about the distinction of default values or keyword arbuments. sum

[issue7447] Sum() doc and behavior mismatch

2010-07-27 Thread Leonhard Vogt
Leonhard Vogt leonhard.v...@gmx.ch added the comment: another patch: - moved string case to first position, i think it's the most important. - reworded (shortened) list case. - wrapped for 80 caracter lines. still using itertools.itertools.chain.from_iterable as mentioned in previous message

[issue7447] Sum() doc and behavior mismatch

2010-07-26 Thread Leonhard Vogt
Leonhard Vogt leonhard.v...@gmx.ch added the comment: Thank you. I think the specific list of list example is better for the sum documentation because lists support the + operator. I don't think that someone would consider using sum for chaining arbitrary iterables. What about a concise

[issue7447] Sum() doc and behavior mismatch

2010-05-18 Thread Leonhard Vogt
Leonhard Vogt leonhard.v...@gmx.ch added the comment: I changed the documentation regarding string not allowed as start argument and performance I included the list concatenation with itertools.chain from http://groups.google.com/group/comp.lang.python/msg/33e764d0ac41826a patch is based

Re: Using 'apply' as a decorator, to define constants

2009-08-22 Thread Leonhard Vogt
Why I've personally stopped using it: I've always had the impression that decorators were intended to provide a convenient and obvious way of augmenting functions. Having one that automatically executes the function at definition just runs counter to the behaviour I expect from a decorator.

Re: How to create functors?

2009-08-18 Thread Leonhard Vogt
The example I gave earlier is a bit contrived, the real example fundamentally requires a lambda since I am actually passing in local variables into the functions the lambda is wrapping. Example: def MyFunction(): localVariable = 20 CreateTask( lambda: SomeOtherFunction( localVariable ) ) #

Tkinter Entry blocked by tkFileDialog

2008-10-02 Thread Leonhard Vogt
Hello I have the following problem in Python 2.5 on Windows XP. On Ubuntu I do not see the problem. I have a Tkinter application as in the following example The entry-widget is somehow blocked (i cannot type characters into it) when I call askopenfilename before I create the widget. Calling

Customizing code.InteractiveConsole

2008-08-30 Thread Leonhard Vogt
Hello I have subclassed code.InteractiveInterpreter for testing an interpreter i have written myself. The interpreter is a function (evaluate) that can raise MyError exceptions. I want these to be reported with an indication of the position (^) as in the python interactive interpreter. The

Re: Writing to ms excel

2008-08-30 Thread Leonhard Vogt
Marin Brkic schrieb: I'm trying to find a way to write data to excel cells (or to be more specific to an .xls file), let's say for the sake of argument, data readen from a file (although it will be calculated in the process). I've been searching, but couldn't find any examples which allows that.

Re: How can I check nbr of cores of computer?

2008-07-30 Thread Leonhard Vogt
defn noob schrieb: How can I check how many cores my computer has? Is it possible to do this in a Python-app? processing (http://pyprocessing.berlios.de/) has an utility function processing.cpuCount(). Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: subexpressions (OT: math)

2007-06-03 Thread Leonhard Vogt
Yes, I understand that, but what is the geometrical meaning of the square root of an arc length? That's a different question to your original question, which was asking about the square root of an angle. And what would the units be? Angles are a ratio of two lengths, and are

Re: Logging output from python

2006-12-09 Thread Leonhard Vogt
Cameron Walsh schrieb: If it's on linux you can just redirect the screen output to a file: python initialfile.py 1stdout.txt 2stderr.txt As for windows, I'll test it now... It turns out you can at least redirect the output to a file, I'm not sure what it does with standard error or

Re: String Replace only if whole word?

2006-11-19 Thread Leonhard Vogt
Michael Yanowitz schrieb: Yeah, I am operating this on a Python script. However, I am working off a requirement that the script be pre-processed and the strings replaced before executing the script and that if there are any remaining (not replaced) names that I don't execute the script and

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Nov 7)

2006-11-07 Thread Leonhard Vogt
John Salerno schrieb: Cameron Laird wrote: Fredrik Lundh collects pyidioms: http://effbot.org/zone/python-lists.htm Not working? Try http://effbot.org/zone/python-list.htm Leonhard -- http://mail.python.org/mailman/listinfo/python-list

unexpected behaviour of lambda expression

2006-10-09 Thread leonhard . vogt
Please consider that example: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. s = 'foo' f = lambda x: s f(None) 'foo' s = 'bar' f(None) 'bar' del(s) f(None) Traceback (most recent call last):

Re: unexpected behaviour of lambda expression

2006-10-09 Thread leonhard . vogt
Fredrik Lundh schrieb: [EMAIL PROTECTED] wrote: Please consider that example: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. s = 'foo' f = lambda x: s f(None) 'foo' s = 'bar'

Re: Escapeism

2006-09-30 Thread Leonhard Vogt
But there is some ambiguity due to the the fact that applying '\7' to rawform() yields r'\a' and not r'\7'. So one needs more specification for disambiguation using e.g. an extra parameter. '\a'=='\7' True The two are actually the same thing, so how could a function decide whether to

Re: time.clock() or time.time()

2005-08-02 Thread Leonhard Vogt
[EMAIL PROTECTED] schrieb: What's the difference between time.clock() and time.time() (and please don't say clock() is the CPU clock and time() is the actual time because that doesn't help me at all :) clock (depending on the platform ?) measures the time spent by your program. Time gives you