Re: is_whatever_you_are_testing_for as method or property?

2014-12-13 Thread Steven D'Aprano
Mateusz Loskot wrote: On 12 December 2014 at 12:26, Chris Angelico ros...@gmail.com wrote: On Fri, Dec 12, 2014 at 10:21 PM, Mateusz Loskot mate...@loskot.net wrote: I've got several cases which are not obvious to me. For instance, class Foo has a boolean attribute, read-write, which I see

Re: list comprehension return a list and sum over in loop

2014-12-13 Thread Mark Lawrence
On 13/12/2014 03:04, KK Sasa wrote: Sorry, i should say I'm using pythonxy, maybe it imports other things. That is good to know but without any context it's rather difficult to relate it to anything. Some people may have photographic memories and so remember everything that's been said in

Re: Extension of while syntax

2014-12-13 Thread Steven D'Aprano
Nelson Crosby wrote: I was thinking a bit about the following pattern: value = get_some_value() while value in undesired_values: value = get_some_value() I've always hated code that looks like this. Partly due to the repetition, but partly also due to the fact that without being

Re: list comprehension return a list and sum over in loop

2014-12-13 Thread pecore
KK Sasa genwei...@gmail.com writes: Hi there, The list comprehension is results = [d2(t[k]) for k in xrange(1000)], where d2 is a function returning a list, say [x1,x2,x3,x4] for one example. So results is a list consisting of 1000 lists, each of length four. Here, what I want to get is the

Re: Creating interactive command-line Python app?

2014-12-13 Thread rfreundlich21
um, what if I want to USE a command line for python WITHOUT downloading or installing it -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Giampaolo Rodola'
On Thu, Dec 11, 2014 at 10:32 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Giampaolo Rodola' g.rod...@gmail.com writes: I still think the only *real* obstacle remains the lack of important packages such as twisted, gevent and pika which haven't been ported yet. What disqualifies

Re: Creating interactive command-line Python app?

2014-12-13 Thread Steven D'Aprano
rfreundlic...@colonial.net wrote: um, what if I want to USE a command line for python WITHOUT downloading or installing it Who are you talking to? What is the context? Like all software, you can't use Python apps without all their dependencies being installed. If you use the Linux

Re: Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Marko Rauhamaa
Giampaolo Rodola' g.rod...@gmail.com: What I'm saying is that for a very long time a considerable number of libraries haven't been ported to python 3 Ok, that's at least half the fault of the library developers. Names such as Twisted, gevent, eventlet, python-daemon and paramiko means that

Re: Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Steven D'Aprano
Marko Rauhamaa wrote: At work, Python 2.3 is the version in one environment Good grief! What's the OS you are using for that? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Marko Rauhamaa
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: Marko Rauhamaa wrote: At work, Python 2.3 is the version in one environment Good grief! What's the OS you are using for that? RHEL 4. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Grant Edwards
On 2014-12-10, Bruno Cauet brunoca...@gmail.com wrote: Nathaniel, I'm not sure about that: even if the code is 2- and 3-compatible you'll pick one runtime. Why do you say that? I have both installed. I use both. Sometimes it depends on which OS/distro I'm running, sometimes other reasons

Re: Creating interactive command-line Python app?

2014-12-13 Thread Akira Li
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: rfreundlic...@colonial.net wrote: um, what if I want to USE a command line for python WITHOUT downloading or installing it Who are you talking to? What is the context? Like all software, you can't use Python apps without all

Re: Python Script to convert firewall rules

2014-12-13 Thread Kashif Rana
On Saturday, December 13, 2014 6:31:34 AM UTC+4, Jason Friedman wrote: Thanks for the reply. Yes I can make the all possible keywords/values for both formate. But after that what gonna be the logic to convert one format to other format. Like to convert one line below are the keywords:

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Zachary Ware
On Sat, Dec 13, 2014 at 9:51 AM, Grant Edwards invalid@invalid.invalid wrote: On 2014-12-10, Bruno Cauet brunoca...@gmail.com wrote: Nathaniel, I'm not sure about that: even if the code is 2- and 3-compatible you'll pick one runtime. Why do you say that? I have both installed. I use both.

numpy question (fairly basic, I think)

2014-12-13 Thread Albert-Jan Roskam
Hi, I am new to numpy. I am reading binary data one record at a time (I have to) and I would like to store all the records in a numpy array which I pre-allocate. Below I try to fill the empty array with exactly one record, but it is filled with as many rows as there are columns. Why is this?

Re: Creating interactive command-line Python app?

2014-12-13 Thread Steven D'Aprano
Akira Li wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: rfreundlic...@colonial.net wrote: um, what if I want to USE a command line for python WITHOUT downloading or installing it Who are you talking to? What is the context? Like all software, you can't use

Re: numpy question (fairly basic, I think)

2014-12-13 Thread Steven D'Aprano
Albert-Jan Roskam wrote: Hi, I am new to numpy. I am reading binary data one record at a time (I have to) and I would like to store all the records in a numpy array which I pre-allocate. Below I try to fill the empty array with exactly one record, but it is filled with as many rows as

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-13 Thread Nick Coghlan
On 13 Dec 2014 05:19, Petr Viktorin encu...@gmail.com wrote: Also keep in mind that not all Python libraries are on PyPI. For non-Python projects with Python bindings (think video players, OpenCV, systemd, Samba), distribution via PyPI doesn't make much sense. And since the Python bindings

Re: Python Script to convert firewall rules

2014-12-13 Thread Jason Friedman
Thanks for the reply. I am learning python using CBT nuggets for python. But If you can refer me some good course, that should be practical then it would be great. For my requirement, if you can give me the best approach to start with or high level steps or give me some sample cod, I

Re: Python Script to convert firewall rules

2014-12-13 Thread Kashif Rana
Hi Jason Thank you very much. Appreciated ! But the first requirement was to convert format1 to format2 as below: set interface ethernet2/5 ip 10.17.10.1/24 (format 1) set interfaces ge-0/0/0 unit 0 family inet address 10.17.10.1/24 (format 2) (set, interface, ip) = (set, interfaces, family inet

[issue17128] OS X system openssl deprecated - installer should build local libssl

2014-12-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset 288b03b5c60d by Ned Deily in branch '3.4': Issue #17128: Use private version of OpenSSL for 3.x OS X 10.5+ installers. https://hg.python.org/cpython/rev/288b03b5c60d New changeset 1c249d0cab5d by Ned Deily in branch 'default': Issue #17128: Merge /

[issue23047] typo in pyporting.rst

2014-12-13 Thread Xavier de Gaye
New submission from Xavier de Gaye: In Doc/howto/pyporting.rst at line from __future__ import print_statement: s/print_statement/print_function/ -- assignee: docs@python components: Documentation messages: 232600 nosy: brett.cannon, docs@python, xdegaye priority: normal severity:

[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2014-12-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3a35638bce66 by Ned Deily in branch 'default': Issue #17636: Install new test directories. https://hg.python.org/cpython/rev/3a35638bce66 -- ___ Python tracker rep...@bugs.python.org

[issue23031] pdb crashes when jumping over with statement

2014-12-13 Thread Xavier de Gaye
Xavier de Gaye added the comment: This has been fixed by issue 14612 for version 2.7.4. -- nosy: +xdegaye ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23031 ___

[issue23031] pdb crashes when jumping over with statement

2014-12-13 Thread Dan
Changes by Dan potapovdan...@mail.ru: -- resolution: - out of date status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23031 ___

[issue23030] lru_cache manual get/put

2014-12-13 Thread Constantin
Constantin added the comment: It may be the case, that an lru_cache does not provide the best strategy for reliably caching many base cases in recursively written code. I suggest that someday we think about a different caching paradigm which fits this purpose and add it to functools e.g. as

[issue23048] abort when jumping out of a loop

2014-12-13 Thread Xavier de Gaye
New submission from Xavier de Gaye: With the following jump.py script: def foo(): import pdb; pdb.set_trace() while 1: pass return # this is line 5 foo() The following debugging session aborts on Python 3.5.0a0 (default:334c01aa7f93, Dec 3 2014, 16:20:19): $ python

[issue23047] typo in pyporting.rst

2014-12-13 Thread Chaitanya agrawal
Chaitanya agrawal added the comment: Typo corrected according to message232600. -- keywords: +patch nosy: +krypten Added file: http://bugs.python.org/file37438/issue23047.patch ___ Python tracker rep...@bugs.python.org

[issue23040] Better documentation for the urlencode safe parameter

2014-12-13 Thread Wojtek Ruszczewski
Wojtek Ruszczewski added the comment: Updated the patch, additionally changing be to contain in the first sentence. -- Added file: http://bugs.python.org/file37439/urlencode-safe-v2.diff ___ Python tracker rep...@bugs.python.org

[issue23041] csv needs more quoting rules

2014-12-13 Thread Skip Montanaro
Skip Montanaro added the comment: It doesn't look like a difficult change, but is it really needed? I guess my reaction is the same as Raymond's. Are there real-world uses where the current set of quoting styles isn't sufficient? -- ___ Python

[issue23047] typo in pyporting.rst

2014-12-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset 914e9092984e by Berker Peksag in branch '3.4': Issue #23047: Fix typo in pyporting.rst. https://hg.python.org/cpython/rev/914e9092984e New changeset 81a56c9e1e1c by Berker Peksag in branch 'default': Issue #23047: Fix typo in pyporting.rst.

[issue23047] typo in pyporting.rst

2014-12-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset f1f404f5422a by Berker Peksag in branch '2.7': Issue #23047: Fix typo in pyporting.rst. https://hg.python.org/cpython/rev/f1f404f5422a -- ___ Python tracker rep...@bugs.python.org

[issue23047] typo in pyporting.rst

2014-12-13 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the report, Xavier and thanks for the patch, Chaitanya. -- nosy: +berker.peksag resolution: - fixed stage: - resolved status: open - closed versions: +Python 2.7, Python 3.4 ___ Python tracker

[issue23004] mock_open() should allow reading binary data

2014-12-13 Thread Aaron Hill
Aaron Hill added the comment: I've created a new patch, which addresses the problem. Your example now currently returns [b'foo\n', b'bar\n'] -- Added file: http://bugs.python.org/file37440/mock-open-allow-binary-data-updated.patch ___ Python

[issue19698] Implement _imp.exec_builtin and exec_dynamic

2014-12-13 Thread Nick Coghlan
Nick Coghlan added the comment: Yes, if we don't get to it beforehand. I'd still like to take the draft Create/Exec C level hook design I came up with and turn it into a PEP, but I don't know when I'll get time. Maybe I should just put that together as a (very) rough draft and lob it at

[issue23017] string.printable.isprintable() returns False

2014-12-13 Thread Akira Li
Akira Li added the comment: C standard defines locale-specific *printing characters* that are [ -~] in C locale for implementations that use 7-bit US ASCII character set i.e., SP (space, 0x20) is a printing character in C (isprint() returns nonzero). There is isgraph() function that returns

[issue23048] abort when jumping out of a loop

2014-12-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: Building on OS X 10.10 with the head of the code tree (as of today), I cannot reproduce this. Also the disassembly looks fine: $ python3.5 jump.py /Users/raymond/tmp/jump.py(3)foo() - while 1: (Pdb) next /Users/raymond/tmp/jump.py(4)foo() - pass (Pdb)

[issue19527] Test failures with COUNT_ALLOCS

2014-12-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thenks Antoine for great idea proposed in comments on Rietveld. Following patch introduces strip_python_stdout() which strips COUNT_ALLOCS debug output from stdout (unfortunately this operation is not always unambiguous) and call it in assert_python_ok()

[issue22955] Pickling of methodcaller, attrgetter, and itemgetter

2014-12-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: functools.partial is a somewhat less than ideal comparison. The pure-Python version is not picklable, the Python and C versions return different things (the Python version is a function returning a function, the C version is a regular class and returns

[issue22955] Pickling of methodcaller, attrgetter, and itemgetter

2014-12-13 Thread Zachary Ware
Zachary Ware added the comment: Serhiy Storchaka added the comment: Reimplementations of the pure-Python itemgetter and attrgetter to automatically pickleable Python classes have a disadvantage. It makes the pickling incompatible between Python and C versions. This means that itemgetter

[issue9393] shelve.open/bsddb.hashopen exception with unicode paths

2014-12-13 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: test needed - needs patch versions: +Python 3.4, Python 3.5 -Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9393

[issue22823] Use set literals instead of creating a set from a list

2014-12-13 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: benjamin.peterson - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22823 ___

[issue22823] Use set literals instead of creating a set from a list

2014-12-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset c3f960cff3e6 by Serhiy Storchaka in branch '3.4': Issue #22823: Use set literals in lib2to3. https://hg.python.org/cpython/rev/c3f960cff3e6 New changeset d3e43f7ecca8 by Serhiy Storchaka in branch 'default': Issue #22823: Use set literals in

[issue22823] Use set literals instead of creating a set from a list

2014-12-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: That's all I think. Distutils is too conservative for such changes. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org

[issue22875] asyncio: call_soon() documentation unclear on timing

2014-12-13 Thread Guido van Rossum
Guido van Rossum added the comment: Docfix LGTM. On Fri, Dec 12, 2014 at 10:53 PM, Martin Panter rep...@bugs.python.org wrote: Martin Panter added the comment: I have been bitten by this when attempting to implement my own event loops. Parts of the “asyncio” code itself expects that the

[issue19949] Explicitly skip or mask skipped/disabled tests in test_xpickle

2014-12-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In updated patch the xpickle resource is tested before attempts to run Python executables. Also these checks are moved from decorator to the setUp() method. The result of have_python_version() now is memoized. Fixed running the test in unicode-disabled

[issue23048] abort when jumping out of a loop

2014-12-13 Thread Benjamin Peterson
Changes by Benjamin Peterson benja...@python.org: -- assignee: - benjamin.peterson nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23048 ___

[issue23048] abort when jumping out of a loop

2014-12-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset 09f938915c6f by Benjamin Peterson in branch '3.4': pop the loop block even for infinite while loops (closes #23048) https://hg.python.org/cpython/rev/09f938915c6f New changeset baa5258bef22 by Benjamin Peterson in branch '2.7': pop the loop block

[issue19698] Implement _imp.exec_builtin and exec_dynamic

2014-12-13 Thread Brett Cannon
Brett Cannon added the comment: sgtm -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19698 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21279] str.translate documentation incomplete

2014-12-13 Thread Terry J. Reedy
Terry J. Reedy added the comment: Many people may not know that IndexError and KeyError are subclasses of LookupError. I have not decided what to add yet, but I think we are close. -- ___ Python tracker rep...@bugs.python.org

[issue23011] Duplicate Paragraph in documentation for json module

2014-12-13 Thread Terry J. Reedy
Terry J. Reedy added the comment: Will reconsider if an actual duplication is presented. -- resolution: - not a bug stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23011

[issue23049] Fix functools.reduce code equivalent.

2014-12-13 Thread Terry J. Reedy
New submission from Terry J. Reedy: from functools import reduce def add(a,b): return a+b reduce(add, {}) Traceback (most recent call last): File C:\Programs\Python34\tem.py, line 3, in module reduce(add, {}) TypeError: reduce() of empty sequence with no initial value However, the

[issue23030] lru_cache manual get/put

2014-12-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: Sorry Constantin, I am rejecting this proposal or any variants of it. * As Nick pointed-out in the referenced thread, we provide two tools: a functools caching decorator that is tightly focused on the task of caching function calls and a collections

[issue23049] Fix functools.reduce code equivalent.

2014-12-13 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: docs@python - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23049 ___

[issue22735] Fix various crashes exposed through mro() customization

2014-12-13 Thread Benjamin Peterson
Benjamin Peterson added the comment: I will try to look eventually. -- assignee: - benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22735 ___

[issue23004] mock_open() should allow reading binary data

2014-12-13 Thread Demian Brecht
Demian Brecht added the comment: Thanks for the update, but this doesn't quite work either as you're assuming utf-8 (which is what .encode() and .decode() default to). For example, when using latin-1: m = mock_open(read_data= b'\xc6') with patch('__main__.open', m, create=True) : ...

[issue23041] csv needs more quoting rules

2014-12-13 Thread Chaitanya agrawal
Chaitanya agrawal added the comment: Used function PyUnicode_Check instead of PyString_Check -- keywords: +patch nosy: +krypten Added file: http://bugs.python.org/file37444/issue23041.patch ___ Python tracker rep...@bugs.python.org

[issue23041] csv needs more quoting rules

2014-12-13 Thread Chaitanya agrawal
Changes by Chaitanya agrawal chaitiagra...@gmail.com: Added file: http://bugs.python.org/file37445/issue23041_test.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23041 ___