[issue24667] OrderedDict.popitem()/__str__() raises KeyError
Fabian added the comment: It is consistent as in it happens on every run of the test suite. But unfortunately I haven't checked if it's always happening at the same place. Luckily we have 4 builds on Travis with 3.6 and in all it happened from the beginning and got 100 matches for “KeyError:”: * https://travis-ci.org/wikimedia/pywikibot-core/jobs/71537432#L274 * https://travis-ci.org/wikimedia/pywikibot-core/jobs/71626596#L274 * https://travis-ci.org/wikimedia/pywikibot-core/jobs/71636529#L274 * https://travis-ci.org/wikimedia/pywikibot-core/jobs/71637809#L274 * https://travis-ci.org/xZise/pywikibot-core/builds/71550286#L274 Maybe I can do additional analysis but I'm pretty sure for me locally I didn't get failures so soon. And no I wasn't aware about OrderedDict implemented in C. Now I haven't done tests in 3.5.0b3 (which seems to be the newest version of 3.5 available via pyenv at the moment) as it's relatively cumbersome and prevents me from doing any development on pywikibot at the same time. Anyway I still might do it and report whether I get the error too (unless OrderedDict is still implemented in Python in that version). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24667 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24485] Function source inspection fails on closures
Yury Selivanov added the comment: Meador, the patch looks OK. Could you please commit it yourself? -- assignee: - meador.inge ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Where is the c source code of the import mechanism that ignores invalid directory?
On 21/07/2015 16:35, Shiyao Ma wrote: Hi, It looks to me that the import system of Python will ignore invalid directories and cache the result in memory. For example, the following code: paste here: https://bpaste.net/show/b144deb42620 #!/usr/bin/env python3 import sys import os import shutil sys.path.append(./test) shutil.rmtree(./test, ignore_errors=True) try: import foo except ImportError: os.mkdir(./test) with open(./test/foo.py, w) as f: f.write(print(3)) import foo the second import foo will fail even though it's there. This is because when doing the first import foo, the directory .test doesn't exist, and Python ignores that directory forever. I am interested in the c side implementation of this ignoring part. Any body help me to pinpoint the exact c source location? Thanks. -- 吾輩は猫である。ホームーページはhttps://introo.me http://introo.me。 Start here https://hg.python.org/cpython/file/6629773fef63/Python/import.c -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Where is the c source code of the import mechanism that ignores invalid directory?
Yep. I followed from bltmodule.c(the import function) and got to the import.c file, and finally got lost. Regards. On Tue, Jul 21, 2015 at 12:16 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 21/07/2015 16:35, Shiyao Ma wrote: Hi, It looks to me that the import system of Python will ignore invalid directories and cache the result in memory. For example, the following code: paste here: https://bpaste.net/show/b144deb42620 #!/usr/bin/env python3 import sys import os import shutil sys.path.append(./test) shutil.rmtree(./test, ignore_errors=True) try: import foo except ImportError: os.mkdir(./test) with open(./test/foo.py, w) as f: f.write(print(3)) import foo the second import foo will fail even though it's there. This is because when doing the first import foo, the directory .test doesn't exist, and Python ignores that directory forever. I am interested in the c side implementation of this ignoring part. Any body help me to pinpoint the exact c source location? Thanks. -- 吾輩は猫である。ホームーページはhttps://introo.me http://introo.me。 Start here https://hg.python.org/cpython/file/6629773fef63/Python/import.c -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list -- 吾輩は猫である。ホームーページはhttps://introo.me http://introo.me。 -- https://mail.python.org/mailman/listinfo/python-list
[issue23591] Add IntFlags
Ethan Furman added the comment: My experience is that a module maintainer, or somebody claiming to speak for the module maintainer, can close any issue in their area at any time regardless of the number of core devs in favor of a change. Whatever. I'll leave this open and write up a spec of what IntFlags should look like in case somebody wants to write the patch for it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23591 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Can I copy/paste Python code?
On Monday, July 20, 2015 at 10:50:09 PM UTC-4, ryguy7272 wrote: I'm trying to copy some Python code from a PDF book that I'm reading. I want to test out the code, and I can copy it, but when I paste it into the Shell, everything is all screwed up because of the indentation. Every time I paste in any kind of code, it seems like everything is immediately left-justified, and then nothing works. Any idea how to make this work easily? Without re-typing hundreds of lines of code... Thanks to all. Thanks for all the help everyone!! -- https://mail.python.org/mailman/listinfo/python-list
[issue24653] Mock.assert_has_calls([]) is surprising for users
Robert Collins added the comment: Ok, so as a doc bug this should still be tracked here - I'm going to reopen it to reflect that, hope thats ok. -- assignee: - docs@python components: +Documentation nosy: +docs@python resolution: not a bug - status: closed - open title: Mock.assert_has_calls([]) incorrectly passes - Mock.assert_has_calls([]) is surprising for users ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24653 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Is there a way to install ALL Python packages?
On Tue, Jul 21, 2015 at 2:10 PM, tjohnson tandrewjohn...@outlook.com wrote: On 7/20/2015 10:57 PM, ryguy7272 wrote: I'd like to install ALL Python packages on my machine. Even if it takes up 4-5GB, or more, I'd like to get everything, and then use it when I need it. Now, I'd like to import packages, like numpy and pandas, but nothing will install. I figure, if I can just install everything, I can simply use it when I need it, and if I don't need it, then I just won't use it. I know R offers this as an option. I figure Python must allow it too. Any idea how to grab everything? Thanks all. As others have stated, this is not practical with Python. If you were to install every single package from PyPI, you'd end up with packages like funny 0.1 or Barun_Heehaw, which is described as A sample junk project. (No, I'm not joking.) The latter being, literally, a Hello world project and nothing else. -- https://mail.python.org/mailman/listinfo/python-list
[issue24651] Mock.assert* API is in user namespace
Carl Meyer added the comment: Er, I meant `AttributeError`, of course... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24651 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24651] Mock.assert* API is in user namespace
Carl Meyer added the comment: As a frequent and long-time user of mock, the `assert_*` methods being on the mock object itself has always struck me as an unfortunate wart on an otherwise great library. The change to raise `AssertionError` on `assert_*` and `assret_*` feels like piling an ugly band-aid on top of the wart. I'd love to see Robert's suggested solution of moving the assertion helpers to standalone functions. -- nosy: +carljm ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24651 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Should non-security 2.7 bugs be fixed?
On Tuesday, July 21, 2015 at 4:22:50 PM UTC-5, bream...@gmail.com wrote: It was actually Rustom who posted inaccurate data as only core-devs have commit rights. Well-well. We now find ourselves before the royal court of logic: If we are to take your statement as fact, then only two possibilities exist: (a) Mark is a core dev who has committed patches and is a bully. (b) Mark is not a core dev, and therefor can not commit anything, therefor he's a bully *AND* a hypocrite! Which is it? It would appear that your knowledge of the current development process is as good as your knowledge of European geography. So you've been lurking in that thread also? As with this thread, folks have mis-interpreted my words. When i get a chance to respond over there, you shall become enlightened and humbled. -- https://mail.python.org/mailman/listinfo/python-list
[issue12067] Doc: remove errors about mixed-type comparisons.
Martin Panter added the comment: Patch v15. No doc changes, but I refactored the test code: * Manually merged with recent changes * Separate assert_equality_only() and assert_total_order() test methods. Hopefully this is a bit simpler for people to understand and review, and avoids suggesting that partial ordering is tested. * Dropped subTest() instances with identical parameters. The basic stack trace can already distinguish these. * Eliminated is_value_comparable(); remove the ”meth” parameters from the call sites instead -- versions: +Python 3.6 Added file: http://bugs.python.org/file39970/issue12067-expressions-py3.5_v15.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Is there a way to install ALL Python packages?
On Monday, July 20, 2015 at 10:57:47 PM UTC-4, ryguy7272 wrote: I'd like to install ALL Python packages on my machine. Even if it takes up 4-5GB, or more, I'd like to get everything, and then use it when I need it. Now, I'd like to import packages, like numpy and pandas, but nothing will install. I figure, if I can just install everything, I can simply use it when I need it, and if I don't need it, then I just won't use it. I know R offers this as an option. I figure Python must allow it too. Any idea how to grab everything? Thanks all. Thanks for the tip. I just downloaded and installed Anaconda. I just successfully ran my first Python script. So, so happy now. Thanks again!! -- https://mail.python.org/mailman/listinfo/python-list
[issue24681] Put most likely test first is set_add_entry()
New submission from Raymond Hettinger: Since the *found_active* exit is like the *found_error* exit in that it makes no further use of *entry*, it can be moved before the table/entry_key check whose purpose is to make sure the *entry* pointer is still valid. This change doesn't apply to lookkey() which makes downstream use of the entry pointer. In constrast, set_add_entry() is fully self-contained now and only returns a 0 or -1 rather than a pointer into the set table. This puts the most likely test case first, putting it ahead of the two memory reloads in table/entry_key check. Also, add an else if to the initial freeslot check to make it match the corresponding else if in the linear probe loop. -- assignee: serhiy.storchaka components: Interpreter Core files: better_test_order.diff keywords: patch messages: 247086 nosy: rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Put most likely test first is set_add_entry() versions: Python 3.6 Added file: http://bugs.python.org/file39972/better_test_order.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24681 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24603] Update OpenSSL to 1.0.2d in Windows and OS X installer
Roundup Robot added the comment: New changeset 53c0c8914ad0 by Zachary Ware in branch '2.7': Issue #24603: Update Windows build to use OpenSSL 1.0.2d https://hg.python.org/cpython/rev/53c0c8914ad0 New changeset f4cd9ac378d7 by Zachary Ware in branch '3.4': Issue #24603: Update the Windows build to use OpenSSL 1.0.2d https://hg.python.org/cpython/rev/f4cd9ac378d7 New changeset 2930e23d729f by Zachary Ware in branch '3.5': Issue #24603: Update the Windows build to use OpenSSL 1.0.2d https://hg.python.org/cpython/rev/2930e23d729f New changeset 310613b993d4 by Zachary Ware in branch 'default': Issue #24603: Merge with 3.5 https://hg.python.org/cpython/rev/310613b993d4 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24603 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24682] Add Quick Start: Communications section to devguide
New submission from Carol Willing: Add a Quick Start: Communications section to devguide (or Q S: Community Interaction) as discussed on python-dev mailing list today. The Quick Start: Communications section should be brief, link to other sections in the devguide, and give contributor's guidance about mailing list usage. It is possible that new sections of the devguide will be created to provide additional detail and be referenced by the Quick Start: Communications section. Rename existing devguide/#quick-start 'Quick Start' to 'Quick Start: Code Development'. Thanks Terry Reedy for the name suggestions. -- assignee: willingc components: Devguide messages: 247090 nosy: ezio.melotti, willingc priority: normal severity: normal status: open title: Add Quick Start: Communications section to devguide type: enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24682 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Address field [was: Integers with leading zeroes]
On Wed, Jul 22, 2015 at 2:31 PM, Jason Friedman jsf80...@gmail.com wrote: Of course, most of the time, I advocate a single multi-line text field Address, and let people key them in free-form. No postcode field whatsoever. I'm curious about that statement. I could see accepting input as you describe above, but I'm thinking you'd want to *store* a postcode field. Actually, no. Apart from statisticking, there's not a lot I can do with a postcode. Due to the nature of international addressing, it's usually safest to go to one extreme or the other: either full-on address validation that knows about every delivery point in every nation that you support (viable if you support only one country, and that country's postal service offers an API - happens here in Australia), or no validation whatsoever, and a simple free-form field for people to enter what they will. Most of the times I've been setting things up, they're too low-end to justify the former, so I recommend the latter. Sure, there might be typos... but there might be those anyway, with a classic multi-part form. (I do recommend having a drop-down select box for the country, incidentally. That's easily validated.) Storing postcodes works nicely once you've settled that they're all part of a single country. When you want to do statistics on postcodes, it's not usually too hard to rip them out of the blob and work with them, but they're unreliable anyway unless you've gone the full-on validation route. So I tend to just not do the stats at all :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Can I copy/paste Python code?
On Tue, Jul 21, 2015 at 10:29 PM, Christian Gollwitzer aurio...@gmx.de wrote: On 21.07.2015 04:55, Chris Angelico wrote: On Tue, Jul 21, 2015 at 12:49 PM, ryguy7272 ryanshu...@gmail.com wrote: I'm trying to copy some Python code from a PDF book that I'm reading. I want to test out the code, and I can copy it, but when I paste it into the Shell, everything is all screwed up because of the indentation. Every time I paste in any kind of code, it seems like everything is immediately left-justified, and then nothing works. Any idea how to make this work easily? Without re-typing hundreds of lines of code... Sounds like a flaw in the PDF - it creates indentation in some way other than leading spaces/tabs. PDF never uses tabs and spaces for indentation. In a PDF file, typically all words are placed using a drawing operator individually, the space is made up by your eyes when see the file. While space characters exist in fonts, they are practically never used. Often even inside a word there are breaks, because of kerning corrections. When copying the data, the PDF reader has to guess where the word breaks are and how the strings belong together. Acrobat does a good job, but fails in this special situation. Sometimes it even fails for a narrow running font and copies the string without any word breaks. Ah. I've never dug into PDF's internal details, but the above explanation completely doesn't surprise me. Tip, to document publishers: Don't use PDF for anything containing Python code. Thanks! Actually, maybe don't use PDF at all. I keep having to help my Mum deal with stupid problems with PDF documents she gets, and I'm never sure whether the fault is with the PDF creation software, the human operating said software, or limitations in the file format itself. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to install ALL Python packages?
On Monday, July 20, 2015 at 10:57:47 PM UTC-4, ryguy7272 wrote: I'd like to install ALL Python packages on my machine. Even if it takes up 4-5GB, or more, I'd like to get everything, and then use it when I need it. Now, I'd like to import packages, like numpy and pandas, but nothing will install. I figure, if I can just install everything, I can simply use it when I need it, and if I don't need it, then I just won't use it. I know R offers this as an option. I figure Python must allow it too. Any idea how to grab everything? Thanks all. Ok, this makes sense. Thanks for the insight everyone!! -- https://mail.python.org/mailman/listinfo/python-list
Where is the c source code of the import mechanism that ignores invalid directory?
Hi, It looks to me that the import system of Python will ignore invalid directories and cache the result in memory. For example, the following code: paste here: https://bpaste.net/show/b144deb42620 #!/usr/bin/env python3 import sysimport osimport shutil sys.path.append(./test)shutil.rmtree(./test, ignore_errors=True) try: import fooexcept ImportError: os.mkdir(./test) with open(./test/foo.py, w) as f: f.write(print(3)) import foo the second import foo will fail even though it's there. This is because when doing the first import foo, the directory .test doesn't exist, and Python ignores that directory forever. I am interested in the c side implementation of this ignoring part. Any body help me to pinpoint the exact c source location? Thanks. -- 吾輩は猫である。ホームーページはhttps://introo.me http://introo.me。 -- https://mail.python.org/mailman/listinfo/python-list
[issue24669] inspect.getsource() returns the wrong lines for coroutine functions
Roundup Robot added the comment: New changeset f02c5bf59fbb by Yury Selivanov in branch '3.5': Issue #24669: Fix inspect.getsource() for 'async def' functions. https://hg.python.org/cpython/rev/f02c5bf59fbb New changeset 6629773fef63 by Yury Selivanov in branch 'default': Merge 3.5 (Issue #24669) https://hg.python.org/cpython/rev/6629773fef63 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24669 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24669] inspect.getsource() returns the wrong lines for coroutine functions
Yury Selivanov added the comment: Thanks, Kai! -- resolution: - fixed stage: patch review - resolved status: open - closed versions: +Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24669 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Can I copy/paste Python code?
Christian Gollwitzer aurio...@gmx.de writes: On 21.07.2015 04:55, Chris Angelico wrote: On Tue, Jul 21, 2015 at 12:49 PM, ryguy7272 ryanshu...@gmail.com wrote: [...] Every time I paste in any kind of code, it seems like everything is immediately left-justified, and then nothing works. snip Sounds like a flaw in the PDF - it creates indentation in some way other than leading spaces/tabs. PDF never uses tabs and spaces for indentation. In a PDF file, typically all words are placed using a drawing operator individually, the space is made up by your eyes when see the file. It's not really a PDF issue. It's to do with how the document is produced. I've just looked at a few PDF files and I have found all three layout methods used for code: positioning, spaces and tabs. Of course those that use spaces may be violating some PDF rule or other, but such files certainly exist in the wild. snip -- Ben. -- https://mail.python.org/mailman/listinfo/python-list
[issue22123] Provide a direct function for types.SimpleNamespace()
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: +berker.peksag ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22123 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Integers with leading zeroes
On 07/19/2015 07:39 AM, Steven D'Aprano wrote: In Python 2, integer literals with leading zeroes are treated as octal, so 09 is a syntax error and 010 is 8. This is confusing to those not raised on C-style octal literals, so in Python 3 leading zeroes are prohibited in int literals. Octal is instead written using the prefix 0o, similar to hex 0x and binary 0b. Consequently Python 3 makes both 09 and 010 a syntax error. However there is one exception: zero itself is allowed any number of leading zeroes, so 0 is a legal way to write zero as a base-10 int literal. Does anyone use that (mis)feature? Yes. I like to sometime write numbers with leading zeros. Sometimes these numbers represent codeblocks of a fixed number of digits. Always writing those numbers with this number of digits helps being aware of this. It is also easier for when you need to know how many leading zero's such a number has. -- https://mail.python.org/mailman/listinfo/python-list
Re: Can I copy/paste Python code?
In a message of Wed, 22 Jul 2015 00:48:06 +1000, Chris Angelico writes: Actually, maybe don't use PDF at all. I keep having to help my Mum deal with stupid problems with PDF documents she gets, and I'm never sure whether the fault is with the PDF creation software, the human operating said software, or limitations in the file format itself. ChrisA Lots of the problems are with the free reader, adobe acrobat. It is designed so that the user is kept very much in a straight-jacket which is a problem when your Mum needs, for instance, things to be in 36 point for her to be able to read things at all because she is nearly blind. Laura -- https://mail.python.org/mailman/listinfo/python-list
Re: Proposed keyword to transfer control to another function
On 07/19/2015 02:21 AM, Chris Angelico wrote: On Sun, Jul 19, 2015 at 9:32 AM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Personally I'd be fine with your initial syntax, but something else might be needed to get it past Guido. He didn't like my 'cocall f()' construct in PEP 3152, which is syntactically isomorphic to 'transfer f()'. Maybe it should get written up and rejected, then, to be something to point to any time anyone advocates TCO. Those who remember the history of pep 308 will not find that a strong deterrent. -- https://mail.python.org/mailman/listinfo/python-list
Re: Integers with leading zeroes
On 7/21/2015 10:58 AM, sohcahto...@gmail.com wrote: IMO, leading zeroes just looks like visual noise, and if I wanted to align numbers, I'd just use spaces. Aligning numbers using spaces doesn't always align -- using zeros does. Emile -- https://mail.python.org/mailman/listinfo/python-list
Re: Where is the c source code of the import mechanism that ignores invalid directory?
On Wed, Jul 22, 2015 at 2:44 AM, Shiyao Ma i...@introo.me wrote: Yep. I followed from bltmodule.c(the import function) and got to the import.c file, and finally got lost. What version of CPython are you looking at? If it's a sufficiently recent version, you may want to look at importlib instead. https://docs.python.org/3/library/importlib.html That'll be a LOT easier to work through. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Can I copy/paste Python code?
On Tue, 21 Jul 2015 at 17:16 Ben Bacarisse ben.use...@bsb.me.uk wrote: Christian Gollwitzer aurio...@gmx.de writes: On 21.07.2015 04:55, Chris Angelico wrote: Sounds like a flaw in the PDF - it creates indentation in some way other than leading spaces/tabs. PDF never uses tabs and spaces for indentation. In a PDF file, typically all words are placed using a drawing operator individually, the space is made up by your eyes when see the file. It's not really a PDF issue. It's to do with how the document is produced. I've just looked at a few PDF files and I have found all three layout methods used for code: positioning, spaces and tabs. Of course those that use spaces may be violating some PDF rule or other, but such files certainly exist in the wild. They're not violating any PDF rule. PDF as a format was not designed with this kind of usage in mind. The idea of a PDF is that contains as much information as is required to unambiguously represent the *appearance* of a document. It's really a vectorised image format (like SVG) but with a few extra document-like features (e.g. pages). -- Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: Proposed keyword to transfer control to another function
On Wed, Jul 22, 2015 at 3:33 AM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: On 07/19/2015 02:21 AM, Chris Angelico wrote: On Sun, Jul 19, 2015 at 9:32 AM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Personally I'd be fine with your initial syntax, but something else might be needed to get it past Guido. He didn't like my 'cocall f()' construct in PEP 3152, which is syntactically isomorphic to 'transfer f()'. Maybe it should get written up and rejected, then, to be something to point to any time anyone advocates TCO. Those who remember the history of pep 308 will not find that a strong deterrent. It doesn't have to be a deterrent. It just has to say Here's all the arguments we came up with in 2015, so find answers to those if you want to reopen the debate. It's effectively a way of rapidly onboarding the conclusions from a lengthy discussion, much more easily than pointing someone to the archive and expecting him/her to read through it all. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Noob in Python. Problem with fairly simple test case
El miércoles, 15 de julio de 2015, 14:12:08 (UTC+2), Chris Angelico escribió: On Wed, Jul 15, 2015 at 9:44 PM, Jason P. suscrici...@gmail.com wrote: I can't understand very well what's happening. It seems that the main thread gets blocked listening to the web server. My intent was to spawn another process for the server independent of the test. Obviously I'm doing something wrong. I've made several guesses commenting pieces of code (tearDown method for example) but I didn't manage to solve the problem(s). When you find yourself making guesses to try to figure out what's going on, here are two general tips: 1) Cut out as many pieces as you can. Test one small thing at a time. 2) If In Doubt, Print It Out! Stick print() calls into the code at key places, displaying the values of parameters or the results of intermediate calculations - or just saying Hi, I'm still here and I'm running!. For #1, I would recommend first just trying to get the web service going. Can you connect (using an external program) on port 8000 and receive a text/plain HTTP response saying Hello World!? Never mind about the test for the moment. And for #2, judicious placement of console output will help you figure out things you're not sure about. For instance, you're suspecting that the main thread is getting blocked handling the web server. Easy way to check: def setUp(self): # Start the forecast server self.server = ForecastServer() self.server.start(webservice.app) Just before you construct the server, print something out. After you've constructed it but before you call start(), print something out. And after starting it, print something out. Then run the program. If you see the first line and no other, then it's blocking during the construction. Other deductions I'm sure you can figure out. One small point: Probe even things that you think are trivial. In the above example, I cannot see any reason why constructing ForecastServer() could possibly block, because its init does nothing but set a flag. But you can get surprised by things sometimes - maybe the problem is actually that you're not running the code you think you are, but there's some other ForecastServer kicking in, and it's synchronous rather than subprocess-based. End-to-end testing is all very well, but when something goes wrong, the key is to break the program down into smaller parts. Otherwise, all you have is it doesn't work, which is one of the most useless error reports ever. If someone comes to python-list saying it doesn't work, we'll be asking him/her to give a lot more details; if your aunt asks you for help printing out a document because it doesn't work, you'll probably have to go over and watch her attempt it; and it's the same with your test cases - you make them tell you more details. Hope that helps! The techniques I'm offering are completely problem-independent, and even language-independent. IIDPIO debugging works in anything that gives you a console, which is pretty much everything - maybe it won't be print() but logging.debug(), but the same technique works. ChrisA Thanks for your comments Chris. I've come back to the problem today after a few days on trip. Fortunately someone in other mailing list pointed me that the join method was hanging the main thread. Without this inconvenience I can focus on the exercise's main goal. Despite the impression that surely I gave, I'm quite familiar with programming and general bug hunting rules. The problem is that I'm inexperienced with Python and the subtle details of multiple threads ;) Thanks! -- https://mail.python.org/mailman/listinfo/python-list
Re: Noob in Python. Problem with fairly simple test case
On Wed, Jul 22, 2015 at 3:38 AM, Jason P. suscrici...@gmail.com wrote: Despite the impression that surely I gave, I'm quite familiar with programming and general bug hunting rules. The problem is that I'm inexperienced with Python and the subtle details of multiple threads ;) Heh, it doesn't hurt to remind people of basic debugging techniques sometimes. Worst case, you come back and say Yep, I tried that, and here's the result. Best case, someone else (who doesn't know what you know) will come along with a superficially similar problem, will see the suggested technique, and even if the actual issue is quite different, will be better able to diagnose it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Integers with leading zeroes
On Tuesday, July 21, 2015 at 10:22:44 AM UTC-7, Antoon Pardon wrote: On 07/19/2015 07:39 AM, Steven D'Aprano wrote: In Python 2, integer literals with leading zeroes are treated as octal, so 09 is a syntax error and 010 is 8. This is confusing to those not raised on C-style octal literals, so in Python 3 leading zeroes are prohibited in int literals. Octal is instead written using the prefix 0o, similar to hex 0x and binary 0b. Consequently Python 3 makes both 09 and 010 a syntax error. However there is one exception: zero itself is allowed any number of leading zeroes, so 0 is a legal way to write zero as a base-10 int literal. Does anyone use that (mis)feature? Yes. I like to sometime write numbers with leading zeros. Sometimes these numbers represent codeblocks of a fixed number of digits. Always writing those numbers with this number of digits helps being aware of this. It is also easier for when you need to know how many leading zero's such a number has. IMO, leading zeroes just looks like visual noise, and if I wanted to align numbers, I'd just use spaces. -- https://mail.python.org/mailman/listinfo/python-list
Re: convert output to list(and nested dictionary)
str.split and re are a nice quick way to do it: def get_data(data): import re port_re = re.compile(r'(\w+)\((\S+-\S+)\)') cidr_re = re.compile(r'\[(.*?)\]') _, proto_port, cidr = data.rsplit(:, 2) port_match = port_re.search(proto_port) proto, port = port_match.group(1), port_match.group(2) port = port.split(-)[0] cidr_match = cidr_re.search(cidr) cidr = cidr_match.group(1) return dict(port=port, proto=proto, cidr=cidr) get_data(SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80) source: [67.184.225.222/32]) {'cidr': '67.184.225.222/32', 'proto': 'tcp', 'port': '80'} get_data(SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:-1(None-None) source: [sg-e632d982-995635159130]) {'cidr': 'sg-e632d982-995635159130', 'proto': '1', 'port': 'None'} You can alter this and add whatever extra checks you need as Chris A mentioned (when proto is -1 and port is None-None, or the icmp case). This is just a very crude example, but hopefully you get the drift. Most text parsing problems can easily be solved with these simple tools. Fire up your shell and test it - this is really the best way to learn how to do something like this. On Tue, Jul 21, 2015 at 5:12 PM, max scalf oracle.bl...@gmail.com wrote: Hello all, For Each SecurityGroup, how can i convert that into a List that in turn will have a dictionary of the cidr block, protocol type and the port...so from output below, the SecurityGroup called default had 2 rules...allowing TCP port from 80 and 5500 to the source IP and then SecurityGroup called Pub_HDP_SG had only one rule...so on and so forthhere is the output that i am trying to get out in the form of a list what I am planning to do is, take the list(and nested dictionary) and pass that to a function that will in turn spitout a cloudformation template using troposphere (something like http://imil.net/wp/2015/06/04/rock-your-cloudformation-with-troposphere-and-boto/ ) For Better Readablity (http://pastebin.com/rT6Aswwz) import boto.ec2 sgs = boto.ec2.connect_to_region('us-east-1').get_all_security_groups() for sg in sgs: for rule in sg.rules: print sg, sg.id, inbound:, rule, source:, rule.grants SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80) source: [67.184.225.222/32] SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(5500-5500) source: [67.184.225.222/32] SecurityGroup:Pub_HDP_SG sg-e632d982 inbound: IPPermissions:tcp(80-80) source: [0.0.0.0/0] SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound: IPPermissions:tcp(22-22) source: [0.0.0.0/0] SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound: IPPermissions:tcp(80-80) source: [0.0.0.0/0] SecurityGroup:RDP Rule - open everyone sg-42d58d27 inbound: IPPermissions:-1(None-None) source: [0.0.0.0/0] SecurityGroup:us-east-open-all sg-97ffa7f2 inbound: IPPermissions:tcp(22-22) source: [10.0.20.100/32] SecurityGroup:us-east-open-all sg-97ffa7f2 inbound: IPPermissions:tcp(53-53) source: [10.0.20.100/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:-1(None-None) source: [sg-e632d982-995635159130] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(22-22) source: [67.184.225.222/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(1024-65535) source: [10.0.20.100/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(80-80) source: [24.12.30.198/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:udp(138-138) source: [10.0.20.100/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:udp(53-53) source: [24.12.30.198/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(30015-30015) source: [0.0.0.0/0] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:icmp(-1--1) source: [10.0.20.100/32] SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None) source: [sg-c65a20a3-995635159130] SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None) source: [sg-99c4befc-995635159130] SecurityGroup:sg3-MySecurityGroup2-1HGPN4UF57XN6 sg-4ee73729 inbound: IPPermissions:tcp(22-22) source: [192.168.1.12/32] SecurityGroup:AWS-AMI-SG sg-35568d51 inbound: IPPermissions:tcp(22-22) source: [0.0.0.0/0] SecurityGroup:launch-wizard-2 sg-932255f6 inbound: IPPermissions:tcp(22-22) source: [10.0.20.100/32] SecurityGroup:launch-wizard-2 sg-932255f6 inbound: IPPermissions:tcp(443-443) source: [0.0.0.0/0] Here is the output i am looking for rule1 = [{ 'cidr': '67.184.225.222/32', 'proto': 'tcp', 'port': 80 },{ 'cidr': '67.184.225.222/32', 'proto': 'tcp', 'port': 5500 }] rule2 = [{ 'cidr': '[0.0.0.0/0', 'proto': 'tcp', 'port': 80 }] rule3 = [{ 'cidr': '0.0.0.0/0', 'proto': 'tcp', 'port': 22 },{
[issue24619] async/await parser issues
Nick Coghlan added the comment: Patch test cases look good to me. I'm so used to thinking of the tokenisation phase as a linear token stream that it never occurred to me to just count the function nesting directly to determine if the async def tokenisation rules are in effect - it's a very nice simplifying improvement. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24619 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: convert output to list(and nested dictionary)
Thank you all. I have gotten some great response, so i am going to play around with this and see how it turns out. As Pablo pointed out, best way to learn is to try it out and see how it goes. Thanks again and i will keep the list posted. On Tue, Jul 21, 2015 at 8:03 PM, Pablo Lucena plucen...@gmail.com wrote: str.split and re are a nice quick way to do it: def get_data(data): import re port_re = re.compile(r'(\w+)\((\S+-\S+)\)') cidr_re = re.compile(r'\[(.*?)\]') _, proto_port, cidr = data.rsplit(:, 2) port_match = port_re.search(proto_port) proto, port = port_match.group(1), port_match.group(2) port = port.split(-)[0] cidr_match = cidr_re.search(cidr) cidr = cidr_match.group(1) return dict(port=port, proto=proto, cidr=cidr) get_data(SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80) source: [67.184.225.222/32]) {'cidr': '67.184.225.222/32', 'proto': 'tcp', 'port': '80'} get_data(SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:-1(None-None) source: [sg-e632d982-995635159130]) {'cidr': 'sg-e632d982-995635159130', 'proto': '1', 'port': 'None'} You can alter this and add whatever extra checks you need as Chris A mentioned (when proto is -1 and port is None-None, or the icmp case). This is just a very crude example, but hopefully you get the drift. Most text parsing problems can easily be solved with these simple tools. Fire up your shell and test it - this is really the best way to learn how to do something like this. On Tue, Jul 21, 2015 at 5:12 PM, max scalf oracle.bl...@gmail.com wrote: Hello all, For Each SecurityGroup, how can i convert that into a List that in turn will have a dictionary of the cidr block, protocol type and the port...so from output below, the SecurityGroup called default had 2 rules...allowing TCP port from 80 and 5500 to the source IP and then SecurityGroup called Pub_HDP_SG had only one rule...so on and so forthhere is the output that i am trying to get out in the form of a list what I am planning to do is, take the list(and nested dictionary) and pass that to a function that will in turn spitout a cloudformation template using troposphere (something like http://imil.net/wp/2015/06/04/rock-your-cloudformation-with-troposphere-and-boto/ ) For Better Readablity (http://pastebin.com/rT6Aswwz) import boto.ec2 sgs = boto.ec2.connect_to_region('us-east-1').get_all_security_groups() for sg in sgs: for rule in sg.rules: print sg, sg.id, inbound:, rule, source:, rule.grants SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80) source: [67.184.225.222/32] SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(5500-5500) source: [67.184.225.222/32] SecurityGroup:Pub_HDP_SG sg-e632d982 inbound: IPPermissions:tcp(80-80) source: [0.0.0.0/0] SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound: IPPermissions:tcp(22-22) source: [0.0.0.0/0] SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound: IPPermissions:tcp(80-80) source: [0.0.0.0/0] SecurityGroup:RDP Rule - open everyone sg-42d58d27 inbound: IPPermissions:-1(None-None) source: [0.0.0.0/0] SecurityGroup:us-east-open-all sg-97ffa7f2 inbound: IPPermissions:tcp(22-22) source: [10.0.20.100/32] SecurityGroup:us-east-open-all sg-97ffa7f2 inbound: IPPermissions:tcp(53-53) source: [10.0.20.100/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:-1(None-None) source: [sg-e632d982-995635159130] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(22-22) source: [67.184.225.222/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(1024-65535) source: [10.0.20.100/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(80-80) source: [24.12.30.198/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:udp(138-138) source: [10.0.20.100/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:udp(53-53) source: [24.12.30.198/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(30015-30015) source: [0.0.0.0/0] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:icmp(-1--1) source: [10.0.20.100/32] SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None) source: [sg-c65a20a3-995635159130] SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None) source: [sg-99c4befc-995635159130] SecurityGroup:sg3-MySecurityGroup2-1HGPN4UF57XN6 sg-4ee73729 inbound: IPPermissions:tcp(22-22) source: [192.168.1.12/32] SecurityGroup:AWS-AMI-SG sg-35568d51 inbound: IPPermissions:tcp(22-22) source: [0.0.0.0/0] SecurityGroup:launch-wizard-2 sg-932255f6 inbound: IPPermissions:tcp(22-22) source: [10.0.20.100/32] SecurityGroup:launch-wizard-2 sg-932255f6 inbound: IPPermissions:tcp(443-443) source: [0.0.0.0/0] Here is the output i am looking for rule1
Re: Can I copy/paste Python code?
On Wed, 22 Jul 2015 03:25 am, Laura Creighton wrote: Lots of the problems are with the free reader, adobe acrobat. It is designed so that the user is kept very much in a straight-jacket which is a problem when your Mum needs, for instance, things to be in 36 point for her to be able to read things at all because she is nearly blind. Surely Acrobat gives you the ability to set the scaling factor of the displayed page? E.g. 25%, 50%, 100%, 200%, etc? -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Can I copy/paste Python code?
On Wed, Jul 22, 2015 at 11:03 AM, Michael Torrie torr...@gmail.com wrote: On 07/21/2015 06:12 PM, Grant Edwards wrote: I don't want to close the TOC panel. I want to collapse all the entries in the TOC tree widget _in_ the TOC panel. Ahh. Atril does not do this either. It can collapse the TOC to the first level items but not the tree itself. I'm curious as to what good collapsing the whole tree down to one node would be. Collapse everything, then open out just the one you want. More compact display. And yes, it's a minor problem in evince, though not too bad for my usage (I can close one sub-branch, just not the whole tree). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[issue24651] Mock.assert* API is in user namespace
Kevin Benton added the comment: What about other methods/properties like called, call_count, and reset_mock? It seems that they should be removed as well to be consistent with the reason for this change. -- nosy: +kevinbenton ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24651 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24680] typo in documentation, section extending python
Roundup Robot added the comment: New changeset 91b738cfdc2f by Zachary Ware in branch '2.7': Issue #24680: Remove random backslash. Patch by cdz. https://hg.python.org/cpython/rev/91b738cfdc2f New changeset cf0011b6ebbd by Zachary Ware in branch '3.4': Issue #24680: Remove random backslash. Patch by cdz. https://hg.python.org/cpython/rev/cf0011b6ebbd New changeset d7229f26dbdb by Zachary Ware in branch '3.5': Issue #24680: Merge with 3.4 https://hg.python.org/cpython/rev/d7229f26dbdb New changeset 96910e822266 by Zachary Ware in branch 'default': Closes #24680: Merge with 3.5 https://hg.python.org/cpython/rev/96910e822266 -- nosy: +python-dev resolution: - fixed stage: commit review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: convert output to list(and nested dictionary)
On Wed, Jul 22, 2015 at 7:12 AM, max scalf oracle.bl...@gmail.com wrote: SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80) source: [67.184.225.222/32] Here is the output i am looking for rule1 = [{ 'cidr': '67.184.225.222/32', 'proto': 'tcp', 'port': 80 },{ So if I'm understanding you correctly, one line (from your previous iteration) will become one dictionary, right? In that case, start by figuring out how to parse that line and produce that output. In the example I've quoted, it should be pretty easy (the 'rule' seems to have your proto and port, and your 'rule.grants' has the cidr), but looking over your data, I see some snags. Firstly, some of your port numbers are None-None or -1--1, and I'm not sure what those mean. (My guess: None-None occurs only when proto is -1, and -1--1 happens when proto is icmp, which doesn't use port numbers. But you'd have to investigate that.) Also, your cidr might be a list, rather than a single item. What do you do if it's empty, or if it has multiple? Third, your ports are very obviously a range (1024-65535 comes up), so you'll need to handle that. And finally, some of those rules look like things I would permit, and some look like things I'd reject. You may need to look into the rule definitions to see what you can find. But the first thing to try would be to get hold of one of those rule objects and start doing some introspection; dir(rule) and help(rule) would be where I'd start. Good luck! This shouldn't be too hard; the data seems to be all there already. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Integers with leading zeroes
On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano st...@pearwood.info wrote: Sometimes these numbers represent codeblocks of a fixed number of digits. Always writing those numbers with this number of digits helps being aware of this. It is also easier for when you need to know how many leading zero's such a number has. I'm not sure what you mean here. Python ints don't have a fixed number of digits. Sometimes your numbers carry specific payloads or structures. A few examples: Date: 20150722 [decimal] Unix permissions: 10777 [octal] MAC address: 0014a466fba9 [hex] In the MAC address example, it doesn't make sense to elide the leading zeroes. I can't currently think of a common, real-world example that uses decimal and isn't gong to push itself to the full eight digits, apart from Northern Territory postcodes with their silly 08nn pattern, but I'm sure they exist. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: convert output to list(and nested dictionary)
On Wed, 22 Jul 2015 07:12 am, max scalf wrote: Hello all, For Each SecurityGroup, how can i convert that into a List that in turn will have a dictionary of the cidr block, protocol type and the port... Start with this: def sg_to_list(sg): return [rule_to_dict(r) for r in sg.rules] def rule_to_dict(rule): d = {} # expected {'cidr': '0.0.0.0/0', 'proto': 'tcp', 'port': 80} d['cidr'] = rule.cidr d['proto'] = rule.proto d['port'] = rule.port return d and adjust until working. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
[issue24680] typo in documentation, section extending python
New submission from cdz: In section 3. Building C and C++ Extensions with distutils there is unnecessary \ in the middle of the line. Seems to be bulk (re)formatting issue. Simple patch fixing the issue is attached. -- assignee: docs@python components: Documentation files: extending_doc_typo.diff keywords: patch messages: 247080 nosy: cdz, docs@python priority: normal severity: normal status: open title: typo in documentation, section extending python type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file39971/extending_doc_typo.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21750] mock_open data is visible only once for the life of the class
Robert Collins added the comment: So the 1.1.4 behaviour matches that of a VFS most closely. But, see the earlier messages, it does do only and precisely because it breaks regular mock idioms. Thus I think we're better off with the new patch, which addresses the issue with reuse of the mocks in subclassed tests(with the patch decorator), as well as with repeated opens, while still preserving the basic structure and feel of 'Mock'. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21750 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12067] Doc: remove errors about mixed-type comparisons.
Berker Peksag added the comment: I think we can commit documentation and tests separately. I just did a quick review of the test changes and I will add some review comments later (sorry, lack of time :)). -- nosy: +berker.peksag ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12067 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Address field [was: Integers with leading zeroes]
Of course, most of the time, I advocate a single multi-line text field Address, and let people key them in free-form. No postcode field whatsoever. I'm curious about that statement. I could see accepting input as you describe above, but I'm thinking you'd want to *store* a postcode field. -- https://mail.python.org/mailman/listinfo/python-list
Re: Can I copy/paste Python code?
On 07/21/2015 06:12 PM, Grant Edwards wrote: I don't want to close the TOC panel. I want to collapse all the entries in the TOC tree widget _in_ the TOC panel. Ahh. Atril does not do this either. It can collapse the TOC to the first level items but not the tree itself. I'm curious as to what good collapsing the whole tree down to one node would be. -- https://mail.python.org/mailman/listinfo/python-list
Re: Integers with leading zeroes
On Wed, 22 Jul 2015 11:10 am, Chris Angelico wrote: On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano st...@pearwood.info wrote: Sometimes these numbers represent codeblocks of a fixed number of digits. Always writing those numbers with this number of digits helps being aware of this. It is also easier for when you need to know how many leading zero's such a number has. I'm not sure what you mean here. Python ints don't have a fixed number of digits. Sometimes your numbers carry specific payloads or structures. A few examples: Date: 20150722 [decimal] Unix permissions: 10777 [octal] MAC address: 0014a466fba9 [hex] I don't see the relevance of any of those examples. Only the date is kinda-sort in decimal, the others are in octal and hex and so need to be written as octal or hex numbers: perm = 0o10777 # not 25031 as the above will give addr = 0x0014a466fba9 # the above will give a syntax error The date example should be a string, not an integer. today = 20151231 tomorrow = today + 1 assert tomorrow == 20160101 # fails I guess you can have 0 as Unix permissions, there might even be a 0 MAC address, but would you write them in decimal as (etc.) when all the other perms and addresses are written in oct or hex? addresses = [ 0x0014a466fba9, 0x0014a00b3fb1, , 0x003744a9012a, ] In the MAC address example, it doesn't make sense to elide the leading zeroes. I can't currently think of a common, real-world example that uses decimal and isn't gong to push itself to the full eight digits, apart from Northern Territory postcodes with their silly 08nn pattern, but I'm sure they exist. Postcodes, or zip codes, also should be written as strings, even if they happen to be all digits. I'm still looking for an example of where somebody would write the int zero in decimal using more than one 0-digit. While I'm sure they are fascinating in and of themselves, examples of numbers written as strings, in hex or octal, non-zero numbers written without leading zeroes, or zero written with only a single digit don't interest me :-) -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Integers with leading zeroes
On Wed, Jul 22, 2015 at 12:14 PM, Steven D'Aprano st...@pearwood.info wrote: On Wed, 22 Jul 2015 11:10 am, Chris Angelico wrote: On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano st...@pearwood.info wrote: Sometimes these numbers represent codeblocks of a fixed number of digits. Always writing those numbers with this number of digits helps being aware of this. It is also easier for when you need to know how many leading zero's such a number has. I'm not sure what you mean here. Python ints don't have a fixed number of digits. Sometimes your numbers carry specific payloads or structures. A few examples: Date: 20150722 [decimal] Unix permissions: 10777 [octal] MAC address: 0014a466fba9 [hex] I don't see the relevance of any of those examples. Only the date is kinda-sort in decimal, the others are in octal and hex and so need to be written as octal or hex numbers: perm = 0o10777 # not 25031 as the above will give addr = 0x0014a466fba9 # the above will give a syntax error Right, I'm just giving examples of structured numbers. I don't have a good example of a decimal structured number, but there are good examples in other bases, and the possibility is there for someone to have one that makes sense in decimal. The date example should be a string, not an integer. today = 20151231 tomorrow = today + 1 assert tomorrow == 20160101 # fails All that proves is that there are certain operations that don't work on date-stored-as-integer. The same operations equally won't work on date-stored-as-string. If you want date arithmetic, you MUST use a proper date/time library; but if all you want is simple and efficient comparisons, integers work fine. So do strings, but integers are right-justified. If you imagine a situation in which it's not dates with four digit years, but some other starting figure - maybe it's the year in some arbitrary calendar on which today is the 6th of Cuspis in the year 411 of the Common Reckoning. Those dates can go back before year 100, so the date numbers would lose a digit compared to today's 4110206. Hence it's useful to be able to right-justify them. Dates aren't a great example (because good date/time libraries do exist), but they're more universally understood than domain-specific examples. I guess you can have 0 as Unix permissions, there might even be a 0 MAC address, but would you write them in decimal as (etc.) when all the other perms and addresses are written in oct or hex? addresses = [ 0x0014a466fba9, 0x0014a00b3fb1, , 0x003744a9012a, ] Right, so those aren't ideal examples either, because they're not decimal. Postcodes, or zip codes, also should be written as strings, even if they happen to be all digits. Hmm, maybe. I'm on the fence about that one. Of course, most of the time, I advocate a single multi-line text field Address, and let people key them in free-form. No postcode field whatsoever. I'm still looking for an example of where somebody would write the int zero in decimal using more than one 0-digit. While I'm sure they are fascinating in and of themselves, examples of numbers written as strings, in hex or octal, non-zero numbers written without leading zeroes, or zero written with only a single digit don't interest me :-) Frankly, I'm in broad agreement: using 000 to represent 0 isn't particularly useful, given that 0001 is an error. But since C-like languages (and Py2) use the leading zero to mean octal, and mathematics ignores the leading zero, there's no way to avoid confusing people other than by having an instant error. There's probably code out there that uses 000 to mean 0, but personally, I wouldn't be against deprecating it. One thing that's really REALLY annoying is running into something that uses virtually the same syntax to mean something almost, but not entirely, identical... and completely incompatible. If Py3 allowed 0009 to mean 9, we would have nightmares all over the place, even without Py2/Py3 conversion. Unadorned octal still shows up in one place in Py3, and that's string escapes: \33 '\x1b' b\33 b'\x1b' I hope this *never* gets changed to decimal or hex. If it's considered a problem, the only solution is to excise it altogether. Please do NOT do what BIND9 did, and have \033 mean 33 decimal... it bugged me no end when I tried to move some binary around between DNS and other systems... ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Integers with leading zeroes
On Wed, 22 Jul 2015 03:21 am, Antoon Pardon wrote: On 07/19/2015 07:39 AM, Steven D'Aprano wrote: In Python 2, integer literals with leading zeroes are treated as octal, so 09 is a syntax error and 010 is 8. This is confusing to those not raised on C-style octal literals, so in Python 3 leading zeroes are prohibited in int literals. Octal is instead written using the prefix 0o, similar to hex 0x and binary 0b. Consequently Python 3 makes both 09 and 010 a syntax error. However there is one exception: zero itself is allowed any number of leading zeroes, so 0 is a legal way to write zero as a base-10 int literal. Does anyone use that (mis)feature? Yes. I like to sometime write numbers with leading zeros. In Python 2, those numbers will be in octal: nums = [, 0001, 0002, 0003, 0004, 0005, 0006, 0007, # 0008 and 0009 are syntax errors 0010, ... ] In Python 3, using leading zeroes is always a syntax error, unless all the numbers are zero: # Okay nums = [, , , , ... ] # Fails nums = [, 0001, 0002, 0003, ...] I'm not interested in the Python 2 case with octal numbers. Can you show an example of how you would use this in Python 3? Or at least explain what benefit you get from typing out a block of all zeroes by hand, instead of (say) this? nums = [0]*10 Sometimes these numbers represent codeblocks of a fixed number of digits. Always writing those numbers with this number of digits helps being aware of this. It is also easier for when you need to know how many leading zero's such a number has. I'm not sure what you mean here. Python ints don't have a fixed number of digits. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: convert output to list(and nested dictionary)
On Wed, Jul 22, 2015 at 11:03 AM, Pablo Lucena plucen...@gmail.com wrote: str.split and re are a nice quick way to do it: def get_data(data): import re port_re = re.compile(r'(\w+)\((\S+-\S+)\)') cidr_re = re.compile(r'\[(.*?)\]') _, proto_port, cidr = data.rsplit(:, 2) port_match = port_re.search(proto_port) proto, port = port_match.group(1), port_match.group(2) port = port.split(-)[0] cidr_match = cidr_re.search(cidr) cidr = cidr_match.group(1) return dict(port=port, proto=proto, cidr=cidr) The textual output is coming from his quick little Python loop. No need to parse that when you can go to the underlying objects :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[issue24053] Define EXIT_SUCCESS and EXIT_FAILURE constants in sys
Martin Panter added the comment: FWIW I have wondered in the past why these constants were missing. I would be more likely to use them when checking an exit status than when setting one. I typically do “raise SystemExit()” or “raise SystemExit('Error message')”, which implicitly sets the status. My preference would be to put EXIT_SUCCESS and EXIT_FAILURE in the “os” module, next to the existing EX_ codes. But I guess the “sys” module would also work. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24053 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24680] typo in documentation, section extending python
Martin Panter added the comment: Nice and obvious fix, looks like it also applies to Python 2. -- nosy: +vadmium stage: - commit review versions: +Python 2.7, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24680] typo in documentation, section extending python
Zachary Ware added the comment: Fixed! Thanks for the report and patch, cdz, and thanks for the triage, Martin. -- nosy: +zach.ware ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24651] Mock.assert* API is in user namespace
Felipe added the comment: Not sure it's my place to comment here, but here are my 2 cents: I think Robert's proposal to have module functions is the only way to have a user-friendly and robust API, and it solves more than just the assert typo problem. (And yes, it would require moving the mock public API entirely to functions/classmethods). To me, there's an underlying fragility in mock since the current API for `Mock` is not cleanly separated from the mocked API. This issue creates the problem of the assert typos, and also creates problems with name conflicts (I've always thought the `.call_count` attribute was particularly likely to be clobbered). The only bullet-proof way I can think of to ensure such a conflict does not take place is to separate the namespaces altogether, by moving the data out of the Mock object and into a global structure. E.g., `mock.Mock` could have a class attribute (say `mock.Mock.call_log`) tracking all of the calls to all mocks, and there could be a series of classmethods to query this store. Unfortunately, this design goes seriously against the grain of OOP, but we're essentially back to Robert's proposal. A more OOP-friendly approach sacrifices the '100% clash-proof guarantee' and only provides a 'highly unlikely to clash' guarantee instead: Mangle the mock API namespace. Mock currently does this for its internal attributes (e.g., `._mock_parent`) but not for its public API (e.g., `.assert_called_once_with`). To remain user-friendly, of course we wouldn't require users to mangle names by hand, but would provide convenience functions to access these mangled attributes/methods, which puts us right back at Robert's proposal. -- nosy: +fov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24651 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Interactive, test-driven coding challenges (algorithms and data structures)
On Monday, 13 July 2015 16:50:54 UTC+5:30, donne@gmail.com wrote: Repo: https://github.com/donnemartin/interactive-coding-challenges Shortlink: https://bit.ly/git-code Hi Everyone, I created a number of interactive, test-driven coding challenges. I will continue to add to the repo on a regular basis. I'm hoping you find it useful as a fun, hands-on way to learn or to sharpen your skills on algorithms and data structures, while helping yourself prep for coding interviews and coding challenges. Let me know if you have any questions or comments. Contributions are welcome! -Donne wow! Cool the challenges are awesome. will try them to improve my Algorithm and Data Structures Skills. Just a suggestion. why don't you set Python Algorithm and Data Structures challenges for HackerRank.com or HackerEarth.com -- https://mail.python.org/mailman/listinfo/python-list
[issue24678] raiseExceptions typo fix in logging tests
Serhiy Storchaka added the comment: I would use test.support.swapattr(). -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21750] mock_open data is visible only once for the life of the class
Robert Collins added the comment: Fixup patch. I've tested this with the reported failures and they all work. -- Added file: http://bugs.python.org/file39967/issue-21750-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21750 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24667] OrderedDict.popitem()/__str__() raises KeyError
Fabian added the comment: Yes see the tests/README.rst. And afaik do you only need to have requests and six installed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24667 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24651] Mock.assert* API is in user namespace
Changes by Patrick Westerhoff patrickwesterh...@gmail.com: -- nosy: +poke ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24651 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24678] raiseExceptions typo fix in logging tests
New submission from Jacek Kołodziej: The typo in test_logging was discovered while working on #23883: in two tests the addCleanup call reverts the raiseEx*ec*ptions value (instead of raiseExceptions) in logging module and apparently that didn't manifest itself in any way. Patch attached. -- components: Tests files: test_logging_typo.patch keywords: patch messages: 247047 nosy: Unit03, vadmium, vinay.sajip priority: normal severity: normal status: open title: raiseExceptions typo fix in logging tests versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file39966/test_logging_typo.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21750] mock_open data is visible only once for the life of the class
Robert Collins added the comment: But - its worth discussing. Perhaps we should roll this all back, and just say 'use a vfs layer for tests like this'. The problem in doing that, is that the @patch def test_foo... use case is actually pretty common IME, and this conflicts with the @patch ... A = open() B = open() A.read() B.read() case where the reset in the open() side effect will cause B.read to end up returning ''. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21750 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24613] array.fromstring Use After Free
Serhiy Storchaka added the comment: Minimal example: import array a = array.array(B) a.fromstring(b'x'*0x1) a.fromstring(a) a.fromstring(a) In 3.x it doesn't work. An exception is raised: Traceback (most recent call last): File stdin, line 1, in module BufferError: cannot resize an array that is exporting buffers I think it would be better to raise an exception in 2.7 too. -- type: security - crash ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24613 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24678] raiseExceptions typo fix in logging tests
Serhiy Storchaka added the comment: LGTM. -- assignee: - serhiy.storchaka stage: - commit review type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24678] raiseExceptions typo fix in logging tests
Roundup Robot added the comment: New changeset 20e2b980bb87 by Serhiy Storchaka in branch '3.4': Issue #24678: Fixed raiseExceptions typo in logging tests. https://hg.python.org/cpython/rev/20e2b980bb87 New changeset 7a54e400155f by Serhiy Storchaka in branch '3.5': Issue #24678: Fixed raiseExceptions typo in logging tests. https://hg.python.org/cpython/rev/7a54e400155f New changeset 83b45ea19d00 by Serhiy Storchaka in branch 'default': Issue #24678: Fixed raiseExceptions typo in logging tests. https://hg.python.org/cpython/rev/83b45ea19d00 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Can I copy/paste Python code?
On 21/07/2015 18:25, Laura Creighton wrote: In a message of Wed, 22 Jul 2015 00:48:06 +1000, Chris Angelico writes: Actually, maybe don't use PDF at all. I keep having to help my Mum deal with stupid problems with PDF documents she gets, and I'm never sure whether the fault is with the PDF creation software, the human operating said software, or limitations in the file format itself. ChrisA Lots of the problems are with the free reader, adobe acrobat. It is designed so that the user is kept very much in a straight-jacket which is a problem when your Mum needs, for instance, things to be in 36 point for her to be able to read things at all because she is nearly blind. Laura All I know is that I read a review about Foxit Reader https://www.foxitsoftware.com/products/pdf-reader/ and I've never looked back. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Integers with leading zeroes
On Tuesday, July 21, 2015 at 11:07:43 AM UTC-7, Emile van Sebille wrote: On 7/21/2015 10:58 AM, sohcahto...@gmail.com wrote: IMO, leading zeroes just looks like visual noise, and if I wanted to align numbers, I'd just use spaces. Aligning numbers using spaces doesn't always align -- using zeros does. Emile You've got me confused. They should align just fine if you're using a fixed-width font. If you're not using a fixed-width font in your programming, then I don't know what to say to you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Can I copy/paste Python code?
On 2015-07-21, Laura Creighton l...@openend.se wrote: Lots of the problems are with the free reader, adobe acrobat. It is designed so that the user is kept very much in a straight-jacket which is a problem when your Mum needs, for instance, things to be in 36 point for her to be able to read things at all because she is nearly blind. That's not a problem with acrobat. That's not even a problem with PDF itself, it's the whole _intent_ of PDF: to specify _exactly_ what the document should look like and not allow the reader to muck up the formatting, fonts, colors, alignment, page size, etc. It's supposed to mimic as closely as possible ink on paper: PDF is for when you want the document to look exactly like you want it to look everwhere and for everybody. If you want the reader to be able to change the layout, fonts/sizes, colors, alignments, page dimensions, etc, then PDF is just plain the wrong format. Complaining about a PDF reader not being able to change the appearance of PDF documents is like complaining that glue is sticky, oil is slippery, and knives have sharp edges. -- Grant Edwards grant.b.edwardsYow! Make me look like at LINDA RONSTADT again!! gmail.com -- https://mail.python.org/mailman/listinfo/python-list
[issue24678] raiseExceptions typo fix in logging tests
Serhiy Storchaka added the comment: Thank you for your contribution Jacek. -- resolution: - fixed stage: commit review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24667] OrderedDict.popitem()/__str__() raises KeyError
Eric Snow added the comment: Thanks for the extra info. I'm going to see if I can reproduce the issue by running the pywikibot test suite locally. What's the best way to set that up? Are there instructions somewhere? As to the C implementation, it was first released (as a special exception) in 3.5b2. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24667 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21750] mock_open data is visible only once for the life of the class
Paul Koning added the comment: Sure, you can use a vfs. That's true for a lot of mock functions; the benefit of mock, including mock_open, is that it provides an easier and better packaged way. The behavior expected is be like a file. So in that last example, if you open it twice, you've got two views of the same file data, independent of each other, and reads of each file will see that data in full. A.read() has no effect on B.read(). I don't think I understand what the latest discussion/issue is all about. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21750 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24653] Mock.assert_has_calls([]) is surprising for users
Changes by Antti Haapala an...@haapala.name: -- nosy: +ztane ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24653 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Integers with leading zeroes
On Tuesday, July 21, 2015 at 11:38:53 AM UTC-7, sohca...@gmail.com wrote: On Tuesday, July 21, 2015 at 11:07:43 AM UTC-7, Emile van Sebille wrote: On 7/21/2015 10:58 AM, sohcahto...@gmail.com wrote: IMO, leading zeroes just looks like visual noise, and if I wanted to align numbers, I'd just use spaces. Aligning numbers using spaces doesn't always align -- using zeros does. Emile You've got me confused. They should align just fine if you're using a fixed-width font. If you're not using a fixed-width font in your programming, then I don't know what to say to you. I should probably state that I may use leading zeroes when using hexadecimal numbers. For example, I might write 0x000ABCDE, rather than 0xABCDE, but that's only if I'm using a lot of 32-bit values. If I only care about a single byte, I will use 0x01, for example. But for base-10, I would never use leading zeroes. -- https://mail.python.org/mailman/listinfo/python-list
[issue24678] raiseExceptions typo fix in logging tests
Jacek Kołodziej added the comment: s/swapattr/swap_attr/g :) Done. -- Added file: http://bugs.python.org/file39968/test_logging_typo.v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14373] C implementation of functools.lru_cache
Changes by Serhiy Storchaka storch...@gmail.com: -- priority: normal - release blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14373 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24651] Mock.assert* API is in user namespace
Changes by Antti Haapala an...@haapala.name: -- nosy: +ztane ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24651 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Should non-security 2.7 bugs be fixed?
On Tuesday, July 21, 2015 at 4:04:30 AM UTC+1, Rick Johnson wrote: On Sunday, July 19, 2015 at 9:17:11 PM UTC-5, Rustom Mody wrote: List of python committers: - 11081 Guido van Rossum [snip: long list] Thanks for posting this list of names. I had put in a pyFOIA request for this data a few years ago, but to my surprise, was flat out denied. I'm not sure how exhaustive this list may be, but publicly displaying the commit hierarchy within the Python community is very import for those who may want to get involved. [Talking to Mark Lawrence, Rustom said:] So... May I humbly ask where are your precious commits?? Thanks for putting Mark in his place. He has been brow beating folks on this list (myself included) for years, and i'll bet he now feels as tiny as D'Aprano did -- when GvR scolded him for disrespecting a Noob on Python-ideas. Read on, oh great stupid one. Yeah, i was watching! I'M *ALWAYS* WATCHING! ಠ_ಠ Now that Mark's lack of commit cred has been exposed, we can safely ignore his hollow and hypocritical bullying. And now that he has been de-fanged, he will be forced to seek employment elsewhere. Hmm, my suggestion is that he market himself as an on-call peanut butter removal service. A venture that will no doubt be successful, seeing that he has two heads up on his competition! Ever heard the saying engage brain before putting mouth into gear? It was actually Rustom who posted inaccurate data as only core-devs have commit rights. It would appear that your knowledge of the current development process is as good as your knowledge of European geography. I would say enjoy your future in the peanut butter removal service but it is quite clear that you haven't the skills needed to make it happen. In the mean time I'll quite happily carry on contributing to the Python community as best I can. Oh, and while I think about it, you'd better put that shovel down, or the hole will only get deeper. Have a nice day :) -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Schduling
On 21-7-2015 19:52, Madduri Anil kumar wrote: Hello Experts, I am new to Python Programming.I have to work on Python. I have a requirement to scheduling the script for every one hour. could you please let me know which packages will be more helpful for Scheduling. if you post any samples it would be more helpful. Thanks Regards, Anilkumar.M. Unless you have specific reasons to do this from within Python itself, I advise to use your operating system's task scheduler instead. Let it invoke the Python program on the desired interval. So, make a cron job for unixes or configure the task scheduler on Windows. Irmen -- https://mail.python.org/mailman/listinfo/python-list
Re: Can I copy/paste Python code?
On 2015-07-21, Emile van Sebille em...@fenx.com wrote: On 7/21/2015 1:32 PM, Grant Edwards wrote: But, it apears foxit reader is Windows-only so it's a moot point for Linux/Unix/Mac users. I've been happy with https://wiki.gnome.org/Apps/Evince on linux. I'm trying to switch from acroread to evince, bit it has a few serious usability problems for me: 1) You can't copy/paste text from evince _at_all_. At least it works right most of the time with acroread. I really like being able paste example commands or bits of code or a sentance or three from PDF docs into a shell or editor window. Pasting tables is a bit more work, but it can at least be done with acroread. 2) You can't print the current view. I find that invaluable for printing portions of documents (e.g. I want just a section of a C size schematic printed on letter sized paper, or just one table table from a manual sized to fill a 8.5x11 page). If it did have 'print view' then lack of a marquee zoom would become another inconvenience. 3) There's no way to collapse-all in the TOC panel. When I open a 1200 page document with 30 sections and several hundred sections and subsections, I don't want to see all of them all of the time. Closing them one at a time by hand is pretty tedious. I find that about 20-30% of the time I start up evince, I end up closing it and re-opening the document in acroread. -- Grant Edwards grant.b.edwardsYow! ... I have read the at INSTRUCTIONS ... gmail.com -- https://mail.python.org/mailman/listinfo/python-list
[issue24679] Windows embeddable Python zip file crashes (cannot find a dll)
Steve Dower added the comment: Afraid it's not possible - that error comes from the loader, so we haven't had a chance to run anything yet. One option would be to put some sort of readme into the zip, but that seems to be optimising for the wrong behavior. If I were legitimately embedding this from the zip file, that would be something I'd want to remove from my app distribution. But maybe it wouldn't be such a big deal - really need to get some data on people actually using this vs. getting it incorrectly. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24679] Windows embeddable Python zip file crashes (cannot find a dll)
Cody Piersall added the comment: Agreed. An ounce of data is worth a pound of theory as the saying goes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24679] Windows embeddable Python zip file crashes (cannot find a dll)
New submission from Cody Piersall: Whenever I tried to run the embeddable zip file from https://www.python.org/downloads/windows/ for Python 3.5.0b3, the program crashes with the message The program can't start because api-ms-win-crt-math-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem. I suspect that this happens because I don't have any version of Visual Studio on my computer, but I'm not sure what causes it. It happens with both the 32-bit and 64-bit zip file. Steps to reproduce: 1. Download the zip file https://www.python.org/ftp/python/3.5.0/python-3.5.0b3-embed-win32.zip 2. Extract the contents 3. Click on the Python executable 4. Do not have Visual Studio installed on your computer I am running Windows 7 Enterprise, 64-bit I have attached a screenshot of the error message. -- files: bug.PNG messages: 247063 nosy: Cody Piersall, steve.dower priority: normal severity: normal status: open title: Windows embeddable Python zip file crashes (cannot find a dll) Added file: http://bugs.python.org/file39969/bug.PNG ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24679] Windows embeddable Python zip file crashes (cannot find a dll)
R. David Murray added the comment: You shouldn't need visual studio to install python using the installer. What verison of windows are you using? -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24679] Windows embeddable Python zip file crashes (cannot find a dll)
R. David Murray added the comment: Woops, I see you already said and I missed it. We'll have to wait for Steve to take a look. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Python Schduling
Hello Experts, I am new to Python Programming.I have to work on Python. I have a requirement to scheduling the script for every one hour. could you please let me know which packages will be more helpful for Scheduling. if you post any samples it would be more helpful. Thanks Regards, Anilkumar.M. -- https://mail.python.org/mailman/listinfo/python-list
[issue24679] Windows embeddable Python zip file crashes (cannot find a dll)
Steve Dower added the comment: That's exactly the use case, and I might borrow your summary for the docs that I'll eventually write for it because you've summed it up really well. My biggest worry right now is that people will treat it as a portable install and run into exactly the issue that you hit. Putting embed in the name is my best idea for preventing that (next idea is removing the .exe files, but that would hurt legitimate uses). -- resolution: - not a bug stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24679] Windows embeddable Python zip file crashes (cannot find a dll)
Cody Piersall added the comment: Yeah, having embeddable in the name is a good hint, I think. It was almost enough for me to not even try downloading it. Is it possible / even worth the time to give a more helpful error message? I'm not sure that it's possible, based on when the dll is laoded, or if it were possible whether it's worth doing. It might require more code than it's worth to maintain. You'd have to... 1. In the main function in C, check whether you're running the embedded Python (probably with an #ifdef) 2. If so, check that the required CRT is found (which probably requires _another_ #ifdef for 32/64 bit, and maybe Python version) 3. If it isn't found, create a message box using the Windows API explaining the problem. Which may require including the GUI libraries into the Python executable, and I don't think those are small things. I'm not sure if that is either possible or desirable, though. Or if what I explained would even work; I'm not sure if the DLLs are loaded right when the executable starts, or only as needed whenever functions from the DLLs are called. And I have _no_ idea how to check for the presence of the CRT. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Is there a way to install ALL Python packages?
On 7/21/2015 11:19 AM, ryguy7272 wrote: On Monday, July 20, 2015 at 10:57:47 PM UTC-4, ryguy7272 wrote: I'd like to install ALL Python packages on my machine. Even if it takes up 4-5GB, or more, I'd like to get everything, and then use it when I need it. Now, I'd like to import packages, like numpy and pandas, but nothing will install. I figure, if I can just install everything, I can simply use it when I need it, and if I don't need it, then I just won't use it. I know R offers this as an option. I figure Python must allow it too. Any idea how to grab everything? Thanks all. Ok, this makes sense. Thanks for the insight everyone!! I forgot to mention in my previous post that there are Python bundles like Anaconda and Enthought available, which come with numerous packages preinstalled. You may want to check them out. -- https://mail.python.org/mailman/listinfo/python-list
[issue21750] mock_open data is visible only once for the life of the class
Robert Collins added the comment: @pkoning in Python3.3 == mock 1.0.1, m = mock_open(read_data='f') m().read() 'f' m().read() 'f' x = m() x.read() 'f' x.read() 'f' x = m() y = m() x.read() 'f' y.read() 'f' in 3.4 == mock 1.1.{0,1,2,3}, and 1.2.0 m = mock_open(read_data='f') m().read() 'f' m().read() '' x = m() x.read() '' x.read() '' x = m() y = m() x.read() 'f' y.read() '' Right now, in 3.5==mock 1.1.4 m = mock_open(read_data='f') m().read() 'f' m().read() 'f' x = m() x.read() 'f' x.read() '' x = m() y = m() x.read() 'f' y.read() 'f' With the patch I just attached: m = mock_open(read_data='f') m().read() 'f' m().read() 'f' x = m() x.read() 'f' x.read() '' x = m() y = m() x.read() 'f' y.read() '' All different points in the solution space :) HTH -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21750 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Can I copy/paste Python code?
On 21/07/2015 21:32, Grant Edwards wrote: On 2015-07-21, Mark Lawrence breamore...@yahoo.co.uk wrote: On 21/07/2015 18:25, Laura Creighton wrote: Lots of the problems are with the free reader, adobe acrobat. It is designed so that the user is kept very much in a straight-jacket which is a problem when your Mum needs, for instance, things to be in 36 point for her to be able to read things at all because she is nearly blind. All I know is that I read a review about Foxit Reader https://www.foxitsoftware.com/products/pdf-reader/ and I've never looked back. I'd have serious doubts about anybody who brags that their product has a Microsoft Offic 2013 Style Ribbon Toolbar. ;) But, it apears foxit reader is Windows-only so it's a moot point for Linux/Unix/Mac users. Who cares provided you can get a VMS version :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Can I copy/paste Python code?
On 7/21/2015 1:32 PM, Grant Edwards wrote: But, it apears foxit reader is Windows-only so it's a moot point for Linux/Unix/Mac users. I've been happy with https://wiki.gnome.org/Apps/Evince on linux. Emile -- https://mail.python.org/mailman/listinfo/python-list
[issue24679] Windows embeddable Python zip file crashes (cannot find a dll)
Changes by Cody Piersall cody.piers...@gmail.com: -- components: +Windows nosy: +paul.moore, tim.golden, zach.ware type: - crash ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
convert output to list(and nested dictionary)
Hello all, For Each SecurityGroup, how can i convert that into a List that in turn will have a dictionary of the cidr block, protocol type and the port...so from output below, the SecurityGroup called default had 2 rules...allowing TCP port from 80 and 5500 to the source IP and then SecurityGroup called Pub_HDP_SG had only one rule...so on and so forthhere is the output that i am trying to get out in the form of a list what I am planning to do is, take the list(and nested dictionary) and pass that to a function that will in turn spitout a cloudformation template using troposphere (something like http://imil.net/wp/2015/06/04/rock-your-cloudformation-with-troposphere-and-boto/ ) For Better Readablity (http://pastebin.com/rT6Aswwz) import boto.ec2 sgs = boto.ec2.connect_to_region('us-east-1').get_all_security_groups() for sg in sgs: for rule in sg.rules: print sg, sg.id, inbound:, rule, source:, rule.grants SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(80-80) source: [67.184.225.222/32] SecurityGroup:default sg-e1304484 inbound: IPPermissions:tcp(5500-5500) source: [67.184.225.222/32] SecurityGroup:Pub_HDP_SG sg-e632d982 inbound: IPPermissions:tcp(80-80) source: [0.0.0.0/0] SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound: IPPermissions:tcp(22-22) source: [0.0.0.0/0] SecurityGroup:sg3-MySecurityGroup-LB0QF9UQAOEF sg-4fe73728 inbound: IPPermissions:tcp(80-80) source: [0.0.0.0/0] SecurityGroup:RDP Rule - open everyone sg-42d58d27 inbound: IPPermissions:-1(None-None) source: [0.0.0.0/0] SecurityGroup:us-east-open-all sg-97ffa7f2 inbound: IPPermissions:tcp(22-22) source: [10.0.20.100/32] SecurityGroup:us-east-open-all sg-97ffa7f2 inbound: IPPermissions:tcp(53-53) source: [10.0.20.100/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:-1(None-None) source: [sg-e632d982-995635159130] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(22-22) source: [67.184.225.222/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(1024-65535) source: [10.0.20.100/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(80-80) source: [24.12.30.198/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:udp(138-138) source: [10.0.20.100/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:udp(53-53) source: [24.12.30.198/32] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:tcp(30015-30015) source: [0.0.0.0/0] SecurityGroup:wordpress-app-SG sg-99c4befc inbound: IPPermissions:icmp(-1--1) source: [10.0.20.100/32] SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None) source: [sg-c65a20a3-995635159130] SecurityGroup:default sg-c65a20a3 inbound: IPPermissions:-1(None-None) source: [sg-99c4befc-995635159130] SecurityGroup:sg3-MySecurityGroup2-1HGPN4UF57XN6 sg-4ee73729 inbound: IPPermissions:tcp(22-22) source: [192.168.1.12/32] SecurityGroup:AWS-AMI-SG sg-35568d51 inbound: IPPermissions:tcp(22-22) source: [0.0.0.0/0] SecurityGroup:launch-wizard-2 sg-932255f6 inbound: IPPermissions:tcp(22-22) source: [10.0.20.100/32] SecurityGroup:launch-wizard-2 sg-932255f6 inbound: IPPermissions:tcp(443-443) source: [0.0.0.0/0] Here is the output i am looking for rule1 = [{ 'cidr': '67.184.225.222/32', 'proto': 'tcp', 'port': 80 },{ 'cidr': '67.184.225.222/32', 'proto': 'tcp', 'port': 5500 }] rule2 = [{ 'cidr': '[0.0.0.0/0', 'proto': 'tcp', 'port': 80 }] rule3 = [{ 'cidr': '0.0.0.0/0', 'proto': 'tcp', 'port': 22 },{ 'cidr': '0.0.0.0/0', 'proto': 'tcp', 'port': 80 }] -- https://mail.python.org/mailman/listinfo/python-list
Re: Can I copy/paste Python code?
On 2015-07-21, Mark Lawrence breamore...@yahoo.co.uk wrote: On 21/07/2015 18:25, Laura Creighton wrote: Lots of the problems are with the free reader, adobe acrobat. It is designed so that the user is kept very much in a straight-jacket which is a problem when your Mum needs, for instance, things to be in 36 point for her to be able to read things at all because she is nearly blind. All I know is that I read a review about Foxit Reader https://www.foxitsoftware.com/products/pdf-reader/ and I've never looked back. I'd have serious doubts about anybody who brags that their product has a Microsoft Offic 2013 Style Ribbon Toolbar. ;) But, it apears foxit reader is Windows-only so it's a moot point for Linux/Unix/Mac users. -- Grant Edwards grant.b.edwardsYow! Hey, wait at a minute!! I want a gmail.comdivorce!! ... you're not Clint Eastwood!! -- https://mail.python.org/mailman/listinfo/python-list
[issue23287] ctypes.util.find_library needlessly call crle on Solaris
John Beck added the comment: First, there are two related but somewhat separate issues here. Regarding the patches attached to http://bugs.python.org/issue20664 they seem fine. In theory, they should not be needed, as though it is true that dump(1) moved from /usr/ccs/bin to /usr/bin in Solaris 11, /usr/ccs/bin still exists as a sym-link to /usr/bin. But the patches are written in a cautious manner, so the Right Thing [tm] should happen in all circumstances. Regarding my assertion that 'the default library path is a constant on Solaris: /lib/64:/usr/lib/64 in 64-bit mode and /lib:/usr/lib in 32-bit mode', I stand by that but will clarify what I meant by default. What I meant was this is what the system provides, though users may customize as needed. I hope that helps. If not, I'm happy to continue the conversation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23287 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24679] Windows embeddable Python zip file crashes (cannot find a dll)
Cody Piersall added the comment: Ah! That makes sense. I still think the embeddable Python could be useful, but I don't actually have a vested interest in it at the moment. Mostly I feel like it would be useful if Python is an implementation detail of an application, and you want to make sure that the user of your application doesn't mess up the Python installation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23574] datetime: support leap seconds
dlroo added the comment: If you are using mx.DateTime make certain you do not use the .strftime method. If you use .strftime method and have a 60th second in your DateTime object it will crash python with no error message. This occurs because the .strftime method is fully inherited from Python's datetime.datetime. -- nosy: +dlroo versions: +Python 2.7 -Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23574 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24485] Function source inspection fails on closures
Meador Inge added the comment: Will do. Thanks for the review. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com