[issue20992] reading individual bytes of multiple binary files using the Python module fileinput

2014-03-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: fileinput's semantics are heavily tied to lines, not bytes. And processing binary files byte by byte is rather inefficient; can you explain why this feature would be of general utility such that it would be worth including it in the standard library? It's

[issue20992] reading individual bytes of multiple binary files using the Python module fileinput

2014-03-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: On memory: Yeah, it could be if the file didn't include any newline characters. Same problem could apply if a text input file relied on word wrap in an editor and included very few or no newlines itself. There are non-fileinput ways of doing this, like I said

[issue20992] reading individual bytes of multiple binary files using the Python module fileinput

2014-03-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: And of course, missed another typo. open's first arg should be file, not filename. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20992

[issue19995] %c, %o, %x, %X accept non-integer values instead of raising an exception

2014-03-19 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowranger+pyt...@gmail.com: -- nosy: +josh.rosenberg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19995

[issue20895] Add bytes.empty_buffer and deprecate bytes(17) for the same purpose

2014-03-14 Thread Josh Rosenberg
Josh Rosenberg added the comment: I would think the argument for deprecation is that usually, people type bytes(7) or bytes(somesmallintvalue) expecting to create a length one bytes object using that value (happens by accident if you iterate a bytes object and forget it's an iterable of ints

[issue20895] Add bytes.empty_buffer and deprecate bytes(17) for the same purpose

2014-03-14 Thread Josh Rosenberg
Josh Rosenberg added the comment: Terry: You forgot to use a raw string for your timeit.repeat check, which is why it blew up. It was evaluating the \0 when you defined the statement string itself, not the contents. If you use r'b\0 * 7' it works just fine by deferring backslash escape

[issue20858] Enhancements/fixes to pure-python datetime module

2014-03-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: _check_int_field seems needlessly complex. When you want a value that is logically an integer (not merely capable of being coerced to an integer), you want object.__index__, per PEP 357, or to avoid explicit calls to special methods, use operator.index. Any

[issue19251] bitwise ops for bytes of equal length

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19251 ___ ___ Python-bugs

[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19915 ___ ___ Python-bugs

[issue14373] C implementation of functools.lru_cache

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14373 ___ ___ Python-bugs

[issue11107] Cache constant slice instances

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11107 ___ ___ Python-bugs

[issue17170] string method lookup is too slow

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17170 ___ ___ Python-bugs

[issue4356] Add key argument to bisect module functions

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4356 ___ ___ Python-bugs

[issue11406] There is no os.listdir() equivalent returning generator instead of list

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11406 ___ ___ Python-bugs

[issue16465] dict creation performance regression

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16465 ___ ___ Python-bugs

[issue20632] Define a new __key__ protocol

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20632 ___ ___ Python-bugs

[issue10977] Concrete object C API considered harmful to subclasses of builtin types

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10977 ___ ___ Python-bugs

[issue17862] itertools.chunks(iterable, size, fill=None)

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowran...@gmail.com: -- nosy: +ShadowRanger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17862 ___ ___ Python-bugs

[issue20858] Enhancements/fixes to pure-python datetime module

2014-03-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: That's actually an argument to fix the C datetime implementation. Right now, you get: from decimal import Decimal as d from datetime import datetime datetime(d(2000.5), 1, 2) datetime.datetime(2000, 1, 2, 0, 0) This is wildly inconsistent

[issue20861] datetime argument handling inconsistent; should accept logical integers, not coercible values

2014-03-06 Thread Josh Rosenberg
New submission from Josh Rosenberg: Per my comments on #20858, datetime's argument handling is inconsistent. By using the 'i' format code, non-integer types are being coerced to int, even as other equivalent non-integer types are accepted (sometimes in a lossy fashion). Example: from

[issue20858] Enhancements/fixes to pure-python datetime module

2014-03-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Oh, definitely. No reason to delay this just because I have my knickers in a twist on a tangential matter. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20858

[issue20861] datetime argument handling inconsistent; should accept logical integers, not coercible values

2014-03-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Thank you very much. Very helpful. I'll see about whipping up a preliminary patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20861

[issue18816] mmap.flush() is always synchronous, hurting performance

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowranger+pyt...@gmail.com: -- nosy: +josh.rosenberg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18816

<    3   4   5   6   7   8