[issue21944] Allow copying of CodecInfo objects

2014-07-09 Thread Robert Lehmann
New submission from Robert Lehmann: CodecInfo objects as retrieved from codecs.lookup currently throw an exception when trying to copy or pickle them. I have attached a patch with a fix and tests. -- components: Library (Lib) files: copy_codecinfo.patch keywords: patch messages

Asymmetry in globals __getitem__/__setitem__

2014-06-12 Thread Robert Lehmann
Hi all, I have noticed there is a slight asymmetry in the way the interpreter (v3.3.5, reproduced also in v3.5.x) loads and stores globals. While loading globals from a custom mapping triggers __getitem__ just fine, writing seems to silently ignore __setitem__. class Namespace(dict): def

[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: Your proposal seems two-fold: (a) make map/filter lazy and (b) have them as methods instead of functions. It seems Tim borrowed Guido's time machine and already implemented (a) in Python 3.x, see http://docs.python.org/py3k/library

[issue13435] Copybutton does not hide tracebacks

2011-11-19 Thread Robert Lehmann
New submission from Robert Lehmann lehman...@gmail.com: The recently added copybutton.js (r18bbfed9aafa) does not work with the 2.7 docs since they are deployed with JQuery 1.2 (which is shipped with Sphinx 0.6). Copybutton is an unobtrusive Javascript feature which adds a little button

[issue12325] regex matches incorrectly on literal dot (99.9% confirmed)

2011-06-13 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: I can not reproduce either of your findings. Could you provide us with your version information? re version 2.2.1, _sre 2.2.2, Python 2.6.6, Debian sid here. Also tested with Python 2.7.2rc1 (same RE). import re re.compile(r\.co\.uk

[issue10562] Change 'j' for imaginary unit into an 'i'

2010-12-03 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: I wonder whether there are many examples where scientific data is written in a form that Python's complex() constructor couldn't currently read, but would be able to read if it accepted 'i' in place of 'j'. I could not reproduce

[issue10576] Add a progress callback to gcmodule

2010-12-03 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: A few issues I'd like to raise: (1) Multiple callback chains. Is there any code in your existing use case of GC callbacks where you don't check for the phase argument and follow different code paths depending on it? If not, having two

[issue10598] curses fails to import on Solaris

2010-12-02 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: I have attached a fix and a regression test. -- keywords: +patch nosy: +lehmannro Added file: http://bugs.python.org/file19903/issue10598.patch ___ Python tracker rep...@bugs.python.org http

[issue9042] Gettext cache and classes

2010-09-02 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: Wouldn't constructing the key as a tuple of (class_, mofile) be much cleaner than making up an artificial key? -- nosy: +lehmannro ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue1766304] improve xrange.__contains__

2009-09-21 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: Thanks for your feedback. I added a few tests and changed the bits you criticized. -- Added file: http://bugs.python.org/file14945/range.patch ___ Python tracker rep...@bugs.python.org http

[issue1766304] improve xrange.__contains__

2009-09-20 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: I revised the patch for Python 3.1 and added notices to Misc/NEWS and the range documentation. (Changing Type to resource usage.) -- nosy: +lehmannro type: feature request - resource usage Added file: http://bugs.python.org

[issue5754] Shelve module writeback parameter does not act as advertised

2009-09-17 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: I think you're misquoting Python's shelve module documentation in your first sentence. The documentation says: By default modified objects are written only when assigned to the shelf [...]. If the optional writeback parameter is set to True

[issue6932] Open shelves fail when Python exits

2009-09-17 Thread Robert Lehmann
New submission from Robert Lehmann lehman...@gmail.com: I'm reopening issue5483 by Zhigang Wang (zhigang) as a separate bug. Shelves that are still open when Python terminates will try to sync. If writeback=True, this pickles cached items. In this example, serialization of Test() re-imports

[issue6932] Open shelves fail when Python exits

2009-09-17 Thread Robert Lehmann
Changes by Robert Lehmann lehman...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file14913/shelve-warning.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6932

[issue5483] [PATCH]Add FastDbfilenameShelf: shelf nerver sync cache even when writeback=True

2009-09-17 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: I addressed the other bug you were experiencing in issue6932. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5483

[issue5483] [PATCH]Add FastDbfilenameShelf: shelf nerver sync cache even when writeback=True

2009-09-16 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: If I understand you correctly, your proposal is the following: use Shelf.cache to cache *all* objects instead of only keeping live references. Your patch retains the cache forever instead of purging it on sync. (All these changes only apply

[issue6574] List the __future__ features in a table

2009-09-14 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: Implemented proposed changes. Additionally, I'd change line 13 to state either future statements or `future`:ref: instead of future_statements, which does not make sense in normal, unmarked text. -- Added file: http

[issue6574] List the __future__ features in a table

2009-09-14 Thread Robert Lehmann
Changes by Robert Lehmann lehman...@gmail.com: Added file: http://bugs.python.org/file14886/future.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6574

[issue6908] Minor markup error in hashlib docs

2009-09-14 Thread Robert Lehmann
New submission from Robert Lehmann lehman...@gmail.com: The documentation for hashlib.hash.digest_size/block_size (notice the hash) renders as documentation for hashlib.*_size, which does not exist. Fixed by explicitly declaring membership; patch attached. -- assignee: georg.brandl

[issue6911] Document changes in asynchat

2009-09-14 Thread Robert Lehmann
New submission from Robert Lehmann lehman...@gmail.com: asynchat.async_chat grew a _collect_incoming and a _get_data method in 2.6. The constructor has been extended to conform to asyncore.dispatcher's. This should be documented. Apart from that, fifo and simple_producer have been deprecated

[issue6911] Document changes in asynchat

2009-09-14 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: Excuse me -- fifo and simple_producer are indeed documented and need a deprecation notice. New patch attached (plus reworded paragraph about async_chat.__init__). -- Added file: http://bugs.python.org/file14889/asynchat-docs.patch

[issue6911] Document changes in asynchat

2009-09-14 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: I found another bug: async_chat.push still talks about automatically creating a simple_producer, which is no longer true. I added a fix to the patch. -- Added file: http://bugs.python.org/file14893/asynchat-docs.patch

[issue6916] Remove deprecated items from asynchat

2009-09-14 Thread Robert Lehmann
New submission from Robert Lehmann lehman...@gmail.com: The patches in issue1736190 deprecated fifo and simple_producers. These are safe for removal in Python 3.0. I attached a patch purging fifo and simple_producers from py3k code and tests. The docs are mostly trivial as well but also touched

Re: how to overload operator (a x b)?

2009-08-07 Thread Robert Lehmann
On Fri, 07 Aug 2009 08:50:52 -0400, Benjamin Kaplan wrote: On Fri, Aug 7, 2009 at 8:00 AM, dmitreydmitrey.kros...@scipy.org wrote: hi all, is it possible to overload operator  ? (And other like this one, eg =  =,  , =  =) Any URL/example? Thank you in advance, D. That isn't an

[issue6574] List the __future__ features in a table

2009-07-26 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: I composed a list of __future__ features and linked the respective PEPs. Even though the language reference would be a better place to store such general information (being PEP'd and all) I found the library reference's __future__.py

[issue6105] json.dumps doesn't respect OrderedDict's iteration order

2009-05-26 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: This only seems to be the case with the C implementation of json (_json). json.encoder.c_make_encoder = None json.dumps(OrderedDict(items)) '{one: 1, two: 2, three: 3, four: 4, five: 5}' I think the culprit is encoder_listencode_dict

[issue6019] Minor typos in ctypes docs

2009-05-14 Thread Robert Lehmann
New submission from Robert Lehmann lehman...@gmail.com: There are a few errors in the ctypes documentation covering function calls using the example of `libc.printf`. It's basically just typos but they are really confusing when trying to understand the examples. Patch to trunk is attached

[issue5034] itertools.fixlen

2009-01-23 Thread Robert Lehmann
Robert Lehmann lehman...@gmail.com added the comment: When I started writing this patch this was actually what I intended. But having ``fixlen(range(3), 2)`` return 0 1 2 struck me as odd. Renaming the function to `pad` would help there indeed. It depends on which use case is more common

[issue5034] itertools.fixlen

2009-01-22 Thread Robert Lehmann
New submission from Robert Lehmann lehman...@gmail.com: As raised recently on python-ideas [1]_, an itertools method fixing iterators to a certain length might be handy (where fixing is either cutting elements off or appending values). I appended a patch implementing this feature in Python/C

Re: no sign() function ?

2008-12-22 Thread Robert Lehmann
On Mon, 22 Dec 2008 12:31:44 +0100, Pierre-Alain Dorange wrote: I don't find any sign(x) function in the math library (return the sign of the value). I've read that math module is a wrapper to C math lib and that C math lib has not sign(), so... [snip] As my need is for a game and that i

Re: List Problem

2008-12-09 Thread Robert Lehmann
On Tue, 09 Dec 2008 21:40:08 -0800, dongzhi wrote: I have one problem for List. Like that: format='just a little test' part = format.split('') print part the result is : ['just ', 'a', ' ', '', 'little', '', ' test'] the list part have 7 element. If I execute part[1], I have got

Re: multiple breaks

2008-11-15 Thread Robert Lehmann
On Thu, 13 Nov 2008 02:16:32 -0800, Chris Rebert wrote: On Thu, Nov 13, 2008 at 2:07 AM, TP [EMAIL PROTECTED] wrote: In the following example, is this possible to affect the two iterators to escape the two loops once one j has been printed: Non-exception alternative: done = False for i

Re: My first Python program -- a lexer

2008-11-10 Thread Robert Lehmann
On Sun, 09 Nov 2008 15:53:01 +0100, Thomas Mlynarczyk wrote: Arnaud Delobelle schrieb: Adding to John's comments, I wouldn't have source as a member of the Lexer object but as an argument of the tokenise() method (which I would make public). The tokenise method would return what you

Re: Snippets management

2008-11-06 Thread Robert Lehmann
On Wed, 05 Nov 2008 19:55:51 -0600, Edwin wrote: Hi there, I've been looking for a snippet manager and found PySnippet but it requires PyGTK. Do you know any other option that doesn't need much? [snip] If you're looking for a snippet manager for actually *using* it (not educational

Re: contextlib.nested()

2008-11-06 Thread Robert Lehmann
On Thu, 06 Nov 2008 01:02:34 -0800, brasse wrote: Hello! I have been running in to some problems when using contextlib.nested(). My problem arises when using code similar to this: from __future__ import with_statement from contextlib import nested class Foo(object): def

Re: Snippets management

2008-11-06 Thread Robert Lehmann
On Thu, 06 Nov 2008 05:23:25 -0600, Edwin wrote: [snip] As I'm learning Python sometimes I look for different approaches to the same problem so I use Git branches in order to save every try. It's just that I'm looking for a 'global' place in my system where I can save code ideas and useful

Re: Triple-quoted strings hath not the Python-nature

2008-10-21 Thread Robert Lehmann
On Tue, 21 Oct 2008 21:58:57 +1300, Lawrence D'Oliveiro wrote: If triple-quoted strings had the Python-nature, then they would take indentation into account. Thus: this is a multi-line string. would be equivalent to this\n is a\n multi-line\nstring. and not

Re: Overloading operators

2008-10-15 Thread Robert Lehmann
On Wed, 15 Oct 2008 14:34:14 +0200, Mr.SpOOn wrote: Hi, in a project I'm overloading a lot of comparison and arithmetic operators to make them working with more complex classes that I defined. Sometimes I need a different behavior of the operator depending on the argument. For example, if

[issue4058] markup in What's New in 2.6

2008-10-06 Thread Robert Lehmann
New submission from Robert Lehmann [EMAIL PROTECTED]: The markup in the Doc/whatsnew/2.6.rst document is somewhat messy in some places. I fixed indentation (spaces to tabs -- made some things readable in the docutils output but not in the source), code samples (- notation to Python prompt

[issue4059] sqlite3 docs incomplete

2008-10-06 Thread Robert Lehmann
New submission from Robert Lehmann [EMAIL PROTECTED]: The sqlite3 documentation misses Row and Cursor.description. Additionally it does not use the best markup in all places (missing links, basically, and forgotten .. class:: statements). A patch is attached. -- assignee: georg.brandl

Re: Comparing float and decimal

2008-09-23 Thread Robert Lehmann
On Tue, 23 Sep 2008 07:20:12 -0400, D'Arcy J.M. Cain wrote: I'm not sure I follow this logic. Can someone explain why float and integer can be compared with each other and decimal can be compared to integer but decimal can't be compared to float? In comparisons, `Decimal` tries to convert

[issue3669] sqlite3.Connection.iterdump docs pythonicity

2008-08-24 Thread Robert Lehmann
New submission from Robert Lehmann [EMAIL PROTECTED]: The `sqlite3` docs are a little unpythonic. When using `str.join` on `Connection.iterdump`, the example in the docs manually unpacks the generator using a LC. I propose this'd be improved. Patch attached. Same applies to the py3k docs, it's

Re: variable question

2008-07-11 Thread Robert Lehmann
On Fri, 11 Jul 2008 20:13:04 -0700, happy wrote: Can a variable be considered the simplest of the data structures. I am tutoring some kids about basics of programming using python. Not an expert in computer sciences, but am a python enthusiast. Why do you need this additional layer of

Re: Name lookup inside class definition

2008-06-18 Thread Robert Lehmann
On Tue, 17 Jun 2008 23:05:56 -0700, WaterWalk wrote: Hello. Consider the following two examples: class Test1(object): att1 = 1 def func(self): print Test1.att1// ok class Test2(object): att1 = 1 att2 = Test2.att1 // NameError: Name Test2 is not defined It

Re: Ternary operator alternative in Ptyhon

2008-06-18 Thread Robert Lehmann
On Tue, 17 Jun 2008 23:18:51 -0700, kretik wrote: I'm sure this is a popular one, but after Googling for a while I couldn't figure out how to pull this off. Let's say I have this initializer on a class: def __init__(self, **params): Why not ``__init__(self, mykey=None)`` in the

[issue2816] Quote-type recognition bug

2008-05-11 Thread Robert Lehmann
Robert Lehmann [EMAIL PROTECTED] added the comment: It seems single-quoted doesn't mean the actual quotation sign used but rather how many you used. Compare the multiline triple quote syntax: $ cat foo.py bar $ python foo.py File foo.py, line 3 ^ SyntaxError: EOF while scanning triple

Re: generator functions: why won't this work?

2008-04-04 Thread Robert Lehmann
On Wed, 02 Apr 2008 19:04:30 -0300, Gabriel Genellina wrote: En Wed, 02 Apr 2008 14:11:30 -0300, [EMAIL PROTECTED] escribió: On Apr 1, 10:42 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 01 Apr 2008 23:56:50 -0300, [EMAIL PROTECTED] escribió:    yield *iterable could be used as

[issue2529] list/generator comprehension parser doesn't match spec

2008-04-01 Thread Robert Lehmann
Robert Lehmann [EMAIL PROTECTED] added the comment: Your example is parsed as [e for i in (j in ['a','b','c'])] and since `j` is not defined, you get a NameError. If it was defined, you would still be iterating a boolean (which is not defined). Grammatically, this is the following (just

Re: Running a python program as main...

2008-03-26 Thread Robert Lehmann
On Wed, 26 Mar 2008 13:05:55 -0300, Gabriel Genellina wrote: En Wed, 26 Mar 2008 11:12:21 -0300, waltbrad [EMAIL PROTECTED] escribió: Stumbling through Mark Lutz's Programming Python 3rd, he gives an example of a program that will automatically configure environment settings and launch

[issue2201] Documentation Section 4.4

2008-02-28 Thread Robert Lehmann
Robert Lehmann added the comment: In the example code from the tutorial you gave, there was still a comma separator between the string 'equals' and the reference `x`. This is missing when you entered the code, that's why Python is throwing an exception there. -- nosy: +lehmannro

[issue2120] broken links in advocacy HOWTO

2008-02-15 Thread Robert Lehmann
Robert Lehmann added the comment: Right, the second link requires a tilde -- I just tried the first one (which works without). You should change all lines to be 80 characters wide maximum, though (can quickly be done by any commiter, not worth a new patch IMO). The dash thing looks okay

[issue2120] broken links in advocacy HOWTO

2008-02-14 Thread Robert Lehmann
Robert Lehmann added the comment: Aye, this patch removes the spaces and re-aligns the paragraph of the latter link. -- nosy: +lehmannro Added file: http://bugs.python.org/file9434/spaces.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org

[issue1758] Wrong link in documentation

2008-01-07 Thread Robert Lehmann
Robert Lehmann added the comment: This problem has been removed in the current version of the documentation (http://docs.python.org/dev/install/index.html) -- old docs aren't updated. It has an own section now (http://docs.python.org/dev/bugs.html). Issue can be closed. -- nosy