[issue21593] Clarify re.search documentation first match
Joshua Landau added the comment: This should also be applied to regex.search's docstring. https://docs.python.org/3.5/library/re.html#re.regex.search -- resolution: fixed - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21593 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14399] zipfile and creat/update comment
Mark Dickinson added the comment: Just for the record, David's comment at msg158136 is apposite: We've had trouble in the past with a conversion to new style class breaking people's code. People are less likely to be subclassing ZipFile, though, so it is probably OK. We just spent some time this morning fixing a bug in some internal software; the cause was precisely this unexpected change from old-style class to new-style class in a bugfix release. And indeed, we were subclassing ZipFile. :-( -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14399 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23699] Add a macro to ease writing rich comparisons
Barry A. Warsaw added the comment: @rhettinger: OTOH, a macro can provide uniformity and correctness. If (as appears evident from the patch) those 10 lines of boilerplate are actually implemented subtly differently each time, bugs can be easily introduced. So a well written and documented macro can be both more readable and more correct. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14399] zipfile and creat/update comment
R. David Murray added the comment: :( :( OK, next time this comes up I won't say it will probably be OK. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14399 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24193] Make LOGGING_FORMAT of assertLogs configurable
New submission from Berker Peksag: It would be useful if we could change the logging format of assertLogs when we use it: with self.assertLogs('foo', level='INFO', format='%(message)s') as cm: logging.getLogger('foo').info('first message') self.assertEqual(cm.output, ['first message']) Or maybe with a class attribute like maxDiff: logFormat = '%(message)s' -- components: Library (Lib) messages: 243182 nosy: berker.peksag, ezio.melotti, michael.foord, rbcollins priority: normal severity: normal stage: needs patch status: open title: Make LOGGING_FORMAT of assertLogs configurable type: enhancement versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24193 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24192] unexpected system error with pep420 style namespace packages
New submission from Ronald Oussoren: The script below creates a basic PEP 420 style package with a single module in it ('package.sub') and tries to import that module With 3.5 the script runs without problems and prints 42 (as expected). With a 3.5 (fresh checkout as of 2015-05-14) I get an SystemError: $ python3.5 demo.py Traceback (most recent call last): File demo.py, line 10, in module import package.mod File frozen importlib._bootstrap, line 958, in _find_and_load File frozen importlib._bootstrap, line 947, in _find_and_load_unlocked File frozen importlib._bootstrap, line 657, in _load_unlocked File frozen importlib._bootstrap, line 575, in module_from_spec File frozen importlib._bootstrap, line 519, in _init_module_attrs SystemError: Parent module '' not loaded, cannot perform relative import ### import os os.mkdir('path1') os.mkdir('path1/package') with open('path1/package/mod.py', 'w') as fp: fp.write('print(42)\n') import site site.addsitedir('path1') import package.mod -- components: Interpreter Core messages: 243181 nosy: ronaldoussoren priority: normal severity: normal status: open title: unexpected system error with pep420 style namespace packages versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24188] Signature objects not hashable
Antoine Pitrou added the comment: Oh, great! Thank you. -- resolution: - out of date stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24188 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24188] Signature objects not hashable
Yury Selivanov added the comment: Signatures and Parameters are already hash able in 3.5. Please close the issue. -- nosy: +Yury.Selivanov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24188 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24192] unexpected system error with pep420 style namespace packages
Changes by Eric V. Smith e...@trueblade.com: -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24192] unexpected system error with pep420 style namespace packages
R. David Murray added the comment: I presume you meant that it works with 3.4? -- nosy: +brett.cannon, eric.snow, r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24194] tokenize yield an ERRORTOKEN if an identifier uses Other_ID_Start or Other_ID_Continue
New submission from Joshua Landau: This is valid: ℘· = 1 print(℘·) # 1 But this gives an error token: from io import BytesIO from tokenize import tokenize stream = BytesIO(℘·.encode(utf-8)) print(*tokenize(stream.read), sep=\n) # TokenInfo(type=56 (ENCODING), string='utf-8', start=(0, 0), end=(0, 0), line='') # TokenInfo(type=53 (ERRORTOKEN), string='℘', start=(1, 0), end=(1, 1), line='℘·') # TokenInfo(type=53 (ERRORTOKEN), string='·', start=(1, 1), end=(1, 2), line='℘·') # TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0), end=(2, 0), line='') This is a continuation of http://bugs.python.org/issue9712. I'm not able to reopen the issue, so I thought I should report it anew. It is tokenize that is wrong - Other_ID_Start and Other_ID_Continue are documented to be valid: https://docs.python.org/3.5/reference/lexical_analysis.html#identifiers -- components: Library (Lib) messages: 243188 nosy: Joshua.Landau priority: normal severity: normal status: open title: tokenize yield an ERRORTOKEN if an identifier uses Other_ID_Start or Other_ID_Continue type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24194 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12018] No tests for ntpath.samefile, ntpath.sameopenfile
R. David Murray added the comment: Given that several comments say this should be done, and your analysis indicates it is done, I think it should be safe to close it :) Thanks for the nudge. -- nosy: +r.david.murray resolution: - fixed stage: test needed - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12018 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23699] Add a macro to ease writing rich comparisons
Marc-Andre Lemburg added the comment: On 14.05.2015 13:29, Petr Viktorin wrote: Marc-Andre, Barry, you expressed interest in the macro on the mailing list; do you still think it's a good idea? Yes. The fact that the macro can save us more than a hundred lines of code in Python itself is proof enough that it's useful to have. Only once concept to learn, fewer bugs, one place to apply change (should they become necessary), etc. etc. This is a standard case of refactoring to simplify code and also a standard case where we use macros in Python. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24190] BoundArguments facility to inject defaults
Yury Selivanov added the comment: Well, the docs example only binds explicit defaults in function signature. Implicit defaults for *args and **kwargs (`()` and `{}`) aren't usually useful (in my opinion). Do you guys have any good use case for such method? I use the Signature API extensively for argument types validation and for serialization of RPC calls, but I never needed this functionality from BoundArguments. -- nosy: +brett.cannon, larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24190 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24190] BoundArguments facility to inject defaults
Yury Selivanov added the comment: FWIW it wasn't as easy as I thought it would be :) You were right, docs example is very basic. Please take a look at the attached patch. -- assignee: - yselivanov keywords: +patch stage: - patch review Added file: http://bugs.python.org/file39372/sig_ba_default.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24190 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24181] test_fileio crash, 3.5, Win 7
Steve Dower added the comment: Express for Desktop still takes about 4GB... I'm going to up the urgency of a sensibly sized package for people who just need the compiler. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24181 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24191] BoundArguments.signature not documented
Roundup Robot added the comment: New changeset 1012a8138fcb by Yury Selivanov in branch '3.4': Issue 24191: Document BoundArguments.signature https://hg.python.org/cpython/rev/1012a8138fcb New changeset 970454df99cd by Yury Selivanov in branch 'default': Issue 24191: Document BoundArguments.signature https://hg.python.org/cpython/rev/970454df99cd -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Survey -- Move To Trash function in Python?
On 05/14/2015 08:45 AM, Steven D'Aprano wrote: I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a Move file to trash function would be useful? Never. Would you like to see that in the standard library, even if it meant that the library had feature-freeze and could gain no more functionality? Nope. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Building CPython
On 14/05/2015 17:09, Chris Angelico wrote: On Fri, May 15, 2015 at 1:51 AM, BartC b...@freeuk.com wrote: OK, the answer seems to be No then - you can't just trivially compile the C modules that comprise the sources with the nearest compiler to hand. So much for C's famous portability! (Actually, I think you already lost me on your first line.) If you want to just quickly play around with CPython's sources, I would strongly recommend getting yourself a Linux box. Either spin up some actual hardware with actual Linux, or grab a virtualization engine like VMWare, VirtualBox, etc, etc, and installing into a VM. With a Debian-based Linux (Debian, Ubuntu, Mint, etc), you should simply be able to: sudo apt-get build-dep python3 Actually I had VirtualBox with Ubuntu, but I don't know my way around Linux and preferred doing things under Windows (and with all my own tools). But it's now building under Ubuntu. (Well, I'm not sure what it's doing exactly; the instructions said type make, then make test, then make install, and it's still doing make test. I hope there's a quicker way of re-building an executable after a minor source file change, otherwise doing any sort of development is going to be impractical.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list
Re: Survey -- Move To Trash function in Python?
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a Move file to trash function would be useful? Would you like to see that in the standard library, even if it meant that the library had feature-freeze and could gain no more functionality? It's bad enough when things are filesystem-dependent but this is OS-dependent or even desktop-version-dependent in the case of Linux distros, so not easy. E.g. in the case of KDE4, the command-line is: $ kioclient move filename trash:/ ...and for KDE3 it was: $ kfmclient move filename trash:/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Building CPython
On 14/05/2015 18:11, Chris Angelico wrote: On Fri, May 15, 2015 at 3:02 AM, BartC b...@freeuk.com wrote: I hope there's a quicker way of re-building an executable after a minor source file change, otherwise doing any sort of development is going to be impractical.) The whole point of 'make' is to rebuild only the parts that need to be rebuilt (either they've changed, or they depend on something that was changed). Sometimes practically everything needs to be rebuilt, if you do some really fundamental change, but generally not. The three parts to the build process are: 1) make - actually generate an executable. Takes ages the first time, will be a lot quicker if you haven't changed much. 2) make test - run the entire test suite. Takes just as long every time, but most of it won't have changed. 3) make install (needs root access, so probably 'sudo make install') - install this as your primary build of Python. When you start tinkering, I suggest just running make; rerunning the test suite isn't necessary till you're all done, and even then it's only important for making sure that your change hasn't broken anything anywhere else. Test your actual changes by simply running the freshly-built Python - most likely that'll be ./python. OK, thanks. I didn't even know where the executable was put! Now I don't need 'make install', while 'make test' I won't bother with any more. Making a small change and typing 'make' took 5 seconds, which is reasonable enough (although I had to use the copy of the source in Windows to find where the main.c file I needed was located). Now Python 3.4.3 says Bart's Python. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list
Re: a python pitfall
I saw the following example at http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments and did not believe the output produced and had to try it for myself Pylint (and perhaps other Python linters) would, I think, warn you that you were using a mutable object as a default. It's more obvious that the list is being reused if you call foo with different values each time. Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Looking for direction
On 05/13/2015 06:23 PM, Steven D'Aprano wrote: On Thu, 14 May 2015 09:24 am, 20/20 Lab wrote: I'm a beginner to python. Reading here and there. Written a couple of short and simple programs to make life easier around the office. That being said, I'm not even sure what I need to ask for. I've never worked with external data before. I have a LARGE csv file that I need to process. 110+ columns, 72k rows. I managed to write enough to reduce it to a few hundred rows, and the five columns I'm interested in. That's not large. Large is millions of rows, or tens of millions if you have enough memory. What's large to you and me is usually small to the computer. You should use the csv module for handling the CSV file, if you aren't already doing so. Do you need a url to the docs? I actually stumbled across the csv module after coding enough to make a list of lists. So that is more the reason I approached the list; Nothing like spending hours (or days) coding something that already exists and just dont know about. Now is were I have my problem: myList = [ [123, XXX, Item, Qty, Noise], [72976, YYY, Item, Qty, Noise], [123, XXX ItemTypo, Qty, Noise]] Basically, I need to check for rows with duplicate accounts row[0] and staff (row[1]), and if so, remove that row, and add it's Qty to the original row. I really dont have a clue how to go about this. Is the order of the rows important? If not, the problem is simpler. processed = {} # hold the processed data in a dict for row in myList: account, staff = row[0:2] key = (account, staff) # Put them in a tuple. if key in processed: # We've already seen this combination. processed[key][3] += row[3] # Add the quantities. else: # Never seen this combination before. processed[key] = row newlist = list(processed.values()) Does that help? It does, immensely. I'll make this work. Thank you again for the link from yesterday and apologies for hitting the wrong reply button. I'll have to study more on the usage and implementations of dictionaries and tuples. -- https://mail.python.org/mailman/listinfo/python-list
Re: Looking for direction
- On Thu, May 14, 2015 3:35 PM CEST Dennis Lee Bieber wrote: On Wed, 13 May 2015 16:24:30 -0700, 20/20 Lab l...@pacbell.net declaimed the following: Now is were I have my problem: myList = [ [123, XXX, Item, Qty, Noise], [72976, YYY, Item, Qty, Noise], [123, XXX ItemTypo, Qty, Noise]] Basically, I need to check for rows with duplicate accounts row[0] and staff (row[1]), and if so, remove that row, and add it's Qty to the original row. I really dont have a clue how to go about this. The number of rows change based on which run it is, so I couldnt even get away with using hundreds of compare loops. If someone could point me to some documentation on the functions I would need, or a tutorial it would be a great help. This appears to be a matter of algorithm development -- there won't be an pre-made function for it. The closest would be the summing functions (control break http://en.wikipedia.org/wiki/Control_break ) of a report writer application. The short gist would be: SORT the data by the account field Initialize sum using first record loop read next record if end of data output sum record exit if record is same account as sum add quantity to sum else output sum record reset sum to the new record Granted -- loading the data into an SQL capable database would make this simple... select account, sum(quantity) from table order by account You could also use pandas. Read the data in a DataFrame, create a groupby object, use the sum() and the first() methods. http://pandas.pydata.org/pandas-docs/version/0.15.2/groupby.html -- https://mail.python.org/mailman/listinfo/python-list
Re: Building CPython
On 05/14/2015 01:02 PM, BartC wrote: On 14/05/2015 17:09, Chris Angelico wrote: On Fri, May 15, 2015 at 1:51 AM, BartC b...@freeuk.com wrote: OK, the answer seems to be No then - you can't just trivially compile the C modules that comprise the sources with the nearest compiler to hand. So much for C's famous portability! (Actually, I think you already lost me on your first line.) If you want to just quickly play around with CPython's sources, I would strongly recommend getting yourself a Linux box. Either spin up some actual hardware with actual Linux, or grab a virtualization engine like VMWare, VirtualBox, etc, etc, and installing into a VM. With a Debian-based Linux (Debian, Ubuntu, Mint, etc), you should simply be able to: sudo apt-get build-dep python3 Actually I had VirtualBox with Ubuntu, but I don't know my way around Linux and preferred doing things under Windows (and with all my own tools). But it's now building under Ubuntu. (Well, I'm not sure what it's doing exactly; the instructions said type make, then make test, then make install, and it's still doing make test. I hope there's a quicker way of re-building an executable after a minor source file change, otherwise doing any sort of development is going to be impractical.) That's what make is good for. It compares the datestamps of the source files against the obj files (etc.) and recompiles only when the source is newer. (It's more complex, but that's the idea) -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
[issue24191] BoundArguments.signature not documented
Changes by Yury Selivanov yseliva...@gmail.com: -- resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Survey -- Move To Trash function in Python?
On 2015-05-14, Dave Farrance davefarra...@omitthisyahooandthis.co.uk wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a Move file to trash function would be useful? Would you like to see that in the standard library, even if it meant that the library had feature-freeze and could gain no more functionality? It's bad enough when things are filesystem-dependent but this is OS-dependent or even desktop-version-dependent in the case of Linux distros, so not easy. Or even file-manager dependent. I think some desktops support multiple file-manager (at least XFCE always used to) -- and there's probably no requirement that they all handle trash the same way. For this to work right you're going to need to be able to figure out which desktop you're using: Linux systems often have multiple desktops available. Most of mine only have one, but some of them have as many as three. Then you might have to determine which file-manager you're using. Some of my desktops use file browsers that don't have any concept of trash. And some of them don't have any file-browsers or trash folders at all. Sounds pretty nasty... -- Grant Edwards grant.b.edwardsYow! MMM-MM!! So THIS is at BIO-NEBULATION! gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Instead of deciding between Python or Lisp for a programming intro course...What about an intro course that uses *BOTH*? Good idea?
No, Common LISP does, but as the website says Common LISP is a multi-paradigm langauge. It's trying to be everything to everybody, just like Python tried to do in the other direction, making everything an object. Python was trying to be too pure, while LISP was trying to be too universal: be everything to everyone -- you might say batteries included. True LISP [...] Ah, the No True Scotsman fallacy. You know that Lisp compiler you're using? That's not *true* Lisp, because *true* Lisp doesn't have [insert feature here]. While schools use the term variable and there are letters like x, y, z. These should not be considered variables in any sense that you know. They (generally) are not assigned to. They are placeholders holding state. They don't change once the program starts running. Again, you're speaking of Common LISP. Such a lisp also wants to do OOP, but it's like lipstick on a pig. You really love that metaphor, don't you? You keep using it, and variations like a pig made of lipstick. I suggest you don't understand the metaphor. My apologies. I thought better after I posted the message. It's more like putting lipstick on a *boy*. LISP, indeed, is not a pig. Yes, and LISP is neither. Although LISP is a functional style, that is only by appearance. It's completely different from Haskell, which I would describe as a true functional language. The difference is how the program is lexed in the mind or on the machine. But that's too difficult to explain on this thread. Just because something is difficult to explain doesn't make it correct. It's difficult to explain how the Atlantic Ocean merely looks, tastes and feels like salt water while actually being filled with strawberry yoghurt. That doesn't make it true. Something which is difficult to explain might be deeply profound, but is far more likely to be rubbish. That's all fine and good, Steven. But the academically and politically correct thing to do in that case, is withhold judgement. Perhaps you don't know what to do with yourself if I'm right, so your remaining recourse is to defences rather than inquiry. The opposite of iterative programming is recursive programming. No it isn't. Iteration and recursion are, in a very deep sense, actually the same thing, they're certainly not opposites. That is a fact which genuinely is profound. My God, you and Lawrence have gone off the deep end. What you're telling me is that you've never programmed something on digital hardware. That, fucking C, you've never even counted on your FINGERS!! And the idea of lambdas were already encoded by the use of special expressions, set-off by parenthesis. So they practically *defined* the concept of lambdas. LISP is also the reason why we're cursed with the terrible name lambda for anonymous functions rather than something more mnemonic (like function). No, you haven't understood, padawan. Lambda *is* the function, not it's definition. Perhaps you will understand what I mean by that, perhaps you won't. It's subtle. Subtle like a kick to the head. Well, at least you got the kick. It's only be understanding your error, can you then proceed to a greater truth. More concretely, programming in an iterative language is like programming f(x, y, z...), where f is the idea your wanting to implement and x,y,z are inputs. Since the are input by user interaction, they are VARIABLE. A type of interactive program (not a Turing tape, either I might add). A program in LISP is simply f, or more to their nomemclature: lambda. It's like the difference of saying f(x) = x + 1, or saying f = /x.x+1 (where / is the Greek lambda character). Do you see the subtle difference? They both appear to have variables, but they are not the same. To repeat myself from two years ago: Here endeth the lesson. You may be seated. If you wish to change our minds, you're going to have to demonstrate objective, verifiable facts and not just allude to how your ideas are too subtle and clever for us. Hopefully that helps. But if I thought my ideas were too subtle or clever for you I wouldn't keep responding to you. Mark -- https://mail.python.org/mailman/listinfo/python-list
Re: Building CPython
On Fri, May 15, 2015 at 3:02 AM, BartC b...@freeuk.com wrote: Actually I had VirtualBox with Ubuntu, but I don't know my way around Linux and preferred doing things under Windows (and with all my own tools). But it's now building under Ubuntu. (Well, I'm not sure what it's doing exactly; the instructions said type make, then make test, then make install, and it's still doing make test. I hope there's a quicker way of re-building an executable after a minor source file change, otherwise doing any sort of development is going to be impractical.) The whole point of 'make' is to rebuild only the parts that need to be rebuilt (either they've changed, or they depend on something that was changed). Sometimes practically everything needs to be rebuilt, if you do some really fundamental change, but generally not. The three parts to the build process are: 1) make - actually generate an executable. Takes ages the first time, will be a lot quicker if you haven't changed much. 2) make test - run the entire test suite. Takes just as long every time, but most of it won't have changed. 3) make install (needs root access, so probably 'sudo make install') - install this as your primary build of Python. When you start tinkering, I suggest just running make; rerunning the test suite isn't necessary till you're all done, and even then it's only important for making sure that your change hasn't broken anything anywhere else. Test your actual changes by simply running the freshly-built Python - most likely that'll be ./python. Working that way is fairly quick - you can tweak some C code, see the results, and go back and tweak some more, all without pausing for a sword fight. But once you go and rerun the full test suite, well... that's when it's time for some: https://xkcd.com/303/ ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Looking for direction
On 2015-05-14 09:57, 20/20 Lab wrote: On 05/13/2015 06:23 PM, Steven D'Aprano wrote: I have a LARGE csv file that I need to process. 110+ columns, 72k rows. I managed to write enough to reduce it to a few hundred rows, and the five columns I'm interested in. I actually stumbled across the csv module after coding enough to make a list of lists. So that is more the reason I approached the list; Nothing like spending hours (or days) coding something that already exists and just dont know about. Now is were I have my problem: myList = [ [123, XXX, Item, Qty, Noise], [72976, YYY, Item, Qty, Noise], [123, XXX ItemTypo, Qty, Noise]] Basically, I need to check for rows with duplicate accounts row[0] and staff (row[1]), and if so, remove that row, and add it's Qty to the original row. I really dont have a clue how to go about this. processed = {} # hold the processed data in a dict for row in myList: account, staff = row[0:2] key = (account, staff) # Put them in a tuple. if key in processed: # We've already seen this combination. processed[key][3] += row[3] # Add the quantities. else: # Never seen this combination before. processed[key] = row newlist = list(processed.values()) It does, immensely. I'll make this work. Thank you again for the link from yesterday and apologies for hitting the wrong reply button. I'll have to study more on the usage and implementations of dictionaries and tuples. In processing the initial CSV file, I suspect that using a csv.DictReader would make the code a bit cleaner. Additionally, as you're processing through the initial file, unless you need the intermediate data, you should be able to do it in one pass. Something like HEADER_ACCOUNT = account HEADER_STAFF = staff HEADER_QTY = Qty processed = {} with open(data.csv) as f: reader = csv.DictReader(f) for row in reader: if should_process_row(row): account = row[HEADER_ACCOUNT] staff = row[HEADER_STAFF] qty = row[HEADER_QTY] try: row[HEADER_QTY] = qty = int(qty) except Exception: # not a numeric quantity? continue # from Steven's code key = (account, staff) if key in processed: processed[key][HEADER_QTY] += qty else: processed[key][HEADER_QTY] = row so_something_with(processed.values()) I find that using names is a lot clearer than using arbitrary indexing. Barring that, using indexes-as-constants still would add further clarity. -tkc . -- https://mail.python.org/mailman/listinfo/python-list
a python pitfall
Hello friends: I saw the following example at http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments and did not believe the output produced and had to try it for myself def foo(a,b,c=[]): c.append(a) c.append(b) print(c) foo(1,1) foo(1,1) foo(1,1) produces: [1, 1] [1, 1, 1, 1] [1, 1, 1, 1, 1, 1] One would expect the following output: [1, 1] [1, 1] [1, 1] Doesn't this valid the zen of python: Explicit is better than implicit. ? Thanks! Billy -- https://mail.python.org/mailman/listinfo/python-list
[issue24181] test_fileio crash, 3.5, Win 7
Terry J. Reedy added the comment: I download vc_community.exe by just clicking and giving a save directory. When started, it says 9GB with options unchecked (10 GB before I unchecked one). (At which point I quit.) Downloading just Express for Desktop requires an MS account. It seems odd to need more (an account) to get half. It is unclear what type of account is needed -- the old free MS Now account, or the normally paid developer account. Skipping for now rather than proceed further. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24181 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Building CPython
On Fri, May 15, 2015 at 3:32 AM, BartC b...@freeuk.com wrote: OK, thanks. I didn't even know where the executable was put! Now I don't need 'make install', while 'make test' I won't bother with any more. Making a small change and typing 'make' took 5 seconds, which is reasonable enough (although I had to use the copy of the source in Windows to find where the main.c file I needed was located). Now Python 3.4.3 says Bart's Python. Haha. I don't usually bother rebranding my builds of things; though that's partly because normally I'm making very few changes, and all in the hope that they'll be accepted upstream anyway. Incidentally, a quick 'make' can range anywhere from a fraction of a second to quite a long time, depending mainly on the speed of your hard drive and the performance of your disk cache. On my Linux, a null make (ie when literally nothing has changed - just rerunning make) takes about half a second, and that's dealing with a module that's failing to build. When you rebuild lots of times all at once, you'll pretty much be working in RAM the whole time, assuming you have enough of it available. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[issue24189] Parameter doesn't expose its index
Yury Selivanov added the comment: OK, I'm closing this one. -- resolution: - rejected stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24181] test_fileio crash, 3.5, Win 7
Terry J. Reedy added the comment: Thanks for the warning. I was expecting 'expansion', but 5 GB (what site says for ...Desktop) is a big chunk of the 17 GM I have left on C: (111GB SSD). (Do you have any idea how much free space I will need for Win 10 upgrade?) So I think I will reverse myself and wait to install and suggest holding off on forced upgrade. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24181 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Survey -- Move To Trash function in Python?
On Thu, May 14, 2015 at 8:11 PM, Grant Edwards invalid@invalid.invalid wrote: On 2015-05-14, Dave Farrance davefarra...@omitthisyahooandthis.co.uk wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a Move file to trash function would be useful? Would you like to see that in the standard library, even if it meant that the library had feature-freeze and could gain no more functionality? It's bad enough when things are filesystem-dependent but this is OS-dependent or even desktop-version-dependent in the case of Linux distros, so not easy. Or even file-manager dependent. I think some desktops support multiple file-manager (at least XFCE always used to) -- and there's probably no requirement that they all handle trash the same way. Actually, there is. There are actual STANDARDS in Linux desktops. One of them is the Trash Specification: http://standards.freedesktop.org/trash-spec/trashspec-1.0.html This spec is implemented by Xfce, KDE, GNOME, PCManFM and probably many others. And if you are looking for a mostly-compliant Python library/app (and a shameless plug): https://pypi.python.org/pypi/trashman/1.5.0 -- Chris Warrick https://chriswarrick.com/ PGP: 5EAAEA16 -- https://mail.python.org/mailman/listinfo/python-list
Re: Building CPython
On 5/14/2015 1:11 PM, Chris Angelico wrote: 2) make test - run the entire test suite. Takes just as long every time, but most of it won't have changed. The test runner has an option, -jn, to run tests in n processes instead of just 1. On my 6 core pentium, -j5 cuts time to almost exactly 1/5th of otherwise. -j10 seems faster but have not times it. I suspect that 'make test' does not use -j option. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
[issue24189] Parameter doesn't expose its index
Yury Selivanov added the comment: Do you have any good use case for this? In one of the first iterations of PEP 362 we had Parameter.index. However, we later redesigned the object to work as a building block -- immutable, and explicitly detached from its parent Signature. This way there is nothing wrong in taking a parameters from one signature, and using them to build a new one. And since (I think) I'm doing this kind of things in my own code, adding this attribute (or even reference to the parent Signature) to Parameter might break things, or even introduce strange side effects. Another reason is that we don't preserve the order of keyword arguments. And having things like '*args' further disconnects parameters indexes from arguments indexes. We can add an 'index(name)' or 'index(param)' method to the Signature class, but I don't know any good use case why would we need that. -- nosy: +brett.cannon, larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24189] Parameter doesn't expose its index
Yury Selivanov added the comment: What do you mean? In Signature or in BoundArguments? I would hope that Signature keeps it. I mean during the actual call, as **kwargs aren't ordered. I think having indexes for parameters would make sense for a language like JS or C, where there are no keyword arguments, and indexes of parameters match indexes of arguments. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24184] PEP 492: Add AsyncIterator and AsyncIterable to collections.abc
Roundup Robot added the comment: New changeset 4347ce7acd84 by Yury Selivanov in branch 'default': Issue 24184: Add AsyncIterator and AsyncIterable to collections.abc. https://hg.python.org/cpython/rev/4347ce7acd84 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24184 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Building CPython
BartC b...@freeuk.com: That's a shame because I wanted to tinker with the main dispatcher loop to try and find out what exactly is making it slow. Nothing that seems obvious at first sight. My guess is the main culprit is attribute lookup in two ways: * Each object attribute reference involves a dictionary lookup. * Each method call involves *two* dictionary lookups plus an object creation. Tell us what you find out. Marko -- https://mail.python.org/mailman/listinfo/python-list
[issue24181] test_fileio crash, 3.5, Win 7
Steve Dower added the comment: Just so you're not too surprised - that vc_community.exe is a downloader that will eventually need 6-8GB :( I'm working with the teams involved to try and get a compiler-only release, but for now the smallest installation that should work is Express for Desktop (from https://www.visualstudio.com/downloads/visual-studio-2015-downloads-vs.aspx, under the Visual Studio 2015 expander at the lower left). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24181 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23995] msvcrt could not be imported
Steve Dower added the comment: Was waiting for agreement or opposition, but I intended to close it within 24 hours if nothing was raised :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23995 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24189] Parameter doesn't expose its index
Antoine Pitrou added the comment: Le 14/05/2015 17:40, Yury Selivanov a écrit : Do you have any good use case for this? Passing a parameter around without having to pass the index separately :-) In one of the first iterations of PEP 362 we had Parameter.index. However, we later redesigned the object to work as a building block -- immutable, and explicitly detached from its parent Signature. This way there is nothing wrong in taking a parameters from one signature, and using them to build a new one. I see. That might be annoying in that case, indeed. Another reason is that we don't preserve the order of keyword arguments. What do you mean? In Signature or in BoundArguments? I would hope that Signature keeps it. And having things like '*args' further disconnects parameters indexes from arguments indexes. Not necessarily. In my case, I treat a stararg parameter as a single parameter. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Survey -- Move To Trash function in Python?
I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a Move file to trash function would be useful? Would you like to see that in the standard library, even if it meant that the library had feature-freeze and could gain no more functionality? -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Survey -- Move To Trash function in Python?
On 2015-05-14, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a Move file to trash function would be useful? How would you even define what move to trash means in a standard way? Even withing the limited context of something like a mail client, it's meaning varies depending on mail store format or which IMAP server you're talking to. Or are you assuming the only thing that can be moved to trash is a file? Would you like to see that in the standard library, even if it meant that the library had feature-freeze and could gain no more functionality? -- Grant Edwards grant.b.edwardsYow! I'm having fun at HITCHHIKING to CINCINNATI gmail.comor FAR ROCKAWAY!! -- https://mail.python.org/mailman/listinfo/python-list
[issue24189] Parameter doesn't expose its index
Yury Selivanov added the comment: As mentioned in the issue, when re-implementing function calls, you have to flatten the arguments into a simple argument list [..] Then you probably need indexes for BoundArguments, not Parameters. (*) at least for pure Python functions, where the arguments are simply pushed sequentially on the ceval stack TBH I think this is a very special use case. I'm -0.5 on including this to the stdlib. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23985] Crash when deleting slices from duplicated bytearray
Changes by Steve Dower steve.do...@microsoft.com: -- nosy: -steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23985 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24189] Parameter doesn't expose its index
Antoine Pitrou added the comment: Le 14/05/2015 17:49, Yury Selivanov a écrit : What do you mean? In Signature or in BoundArguments? I would hope that Signature keeps it. I mean during the actual call, as **kwargs aren't ordered. I think having indexes for parameters would make sense for a language like JS or C, where there are no keyword arguments, and indexes of parameters match indexes of arguments. As mentioned in the issue, when re-implementing function calls, you have to flatten the arguments into a simple argument list (because the function parameters are actually a sequence (*), despite Python's rich function call possibilities). (*) at least for pure Python functions, where the arguments are simply pushed sequentially on the ceval stack -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Building CPython
On Fri, May 15, 2015 at 1:51 AM, BartC b...@freeuk.com wrote: OK, the answer seems to be No then - you can't just trivially compile the C modules that comprise the sources with the nearest compiler to hand. So much for C's famous portability! (Actually, I think you already lost me on your first line.) That's a shame because I wanted to tinker with the main dispatcher loop to try and find out what exactly is making it slow. Nothing that seems obvious at first sight. (The comments even talk about improving branch prediction on certain architectures, even though the performance is a couple of magnitudes away from that kind of optimisation being relevant.) C's portability isn't really sufficient for building a huge project, so what you generally end up with is a huge slab of common code that doesn't change from platform to platform, plus a (relatively) tiny section of platform-specific code, such as makefiles/project files, linker definitions, and so on. When you start hacking on CPython, you don't generally have to consider which platform you're aiming at, as long as you're building on one of the ones that's well supported; trying to port Python to a new compiler on a known OS is actually about as much work as porting it to a known compiler on a new OS. (I know this, because I've attempted both - using mingw on Windows, and gcc on OS/2. It's a big job either way.) If you want to just quickly play around with CPython's sources, I would strongly recommend getting yourself a Linux box. Either spin up some actual hardware with actual Linux, or grab a virtualization engine like VMWare, VirtualBox, etc, etc, and installing into a VM. With a Debian-based Linux (Debian, Ubuntu, Mint, etc), you should simply be able to: sudo apt-get build-dep python3 to get all the build dependencies for Python 3; that, plus the source code, should be enough to get you a'building. Similar simplicities are available for other Linux distros, but I'll let someone else recommend them. Even when you have all the appropriate build tools, Windows can be at times a pain for building software on. The general philosophy of Windows is that you should normally be taking ready-made binaries; the general philosophy of Linux is that it's perfectly normal to spin up your own binaries from the distributed source code. It's not impossible to build on Windows, by any means, but be prepared for extra hassles and less support from the OS than you might like. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[issue24184] PEP 492: Add AsyncIterator and AsyncIterable to collections.abc
Yury Selivanov added the comment: Thank you Guido for the review! Committed to the default branch. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24184 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24189] Parameter doesn't expose its index
Antoine Pitrou added the comment: Given the drawback you mentioned above, I agree that this may be a hard sell :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24190] BoundArguments facility to inject defaults
Antoine Pitrou added the comment: Le 14/05/2015 17:45, Yury Selivanov a écrit : Well, the docs example only binds explicit defaults in function signature. Implicit defaults for *args and **kwargs (`()` and `{}`) aren't usually useful (in my opinion). When the defaults are filled I expect ba.arguments to be complete, that is have a value for every signature parameter. Otherwise I have to special-case *args and **kwargs. Do you guys have any good use case for such method? A use case was given in issue22998. My use case is JIT-compiling functions and function calls in Numba. We reimplement the function calls ourselves, so need a complete mapping of arguments to values. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24190 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24190] BoundArguments facility to inject defaults
Antoine Pitrou added the comment: That sounds good to me, thank you! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24190 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24190] BoundArguments facility to inject defaults
Yury Selivanov added the comment: Do you guys have any good use case for such method? A use case was given in issue22998. My use case is JIT-compiling functions and function calls in Numba. We reimplement the function calls ourselves, so need a complete mapping of arguments to values. This is a great use case ;-) Let's add it. I propose the following method: BoundArguments.apply_defaults() It will iterate through its parent Signature's parameters and assign default values to BoundArguments.arguments (when an arg is missing), including setting '()' for *args, and '{}' for **kwargs. If you're OK with this, I can draft a patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24190 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24182] test_tcl assertion failure, 2.7, Win 7
Terry J. Reedy added the comment: The one bundled with 2.7, which now is 8.5.15.0. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24182 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24191] BoundArguments.signature not documented
Yury Selivanov added the comment: Good catch! Please take a look at the attached patch. -- keywords: +patch Added file: http://bugs.python.org/file39371/sig_ba_docs.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24185] Add Function for Sending File to Trash (or Recycling Bin)
Steven D'Aprano added the comment: This has been discussed on Python-Ideas some time ago, possibly more than once. See here for one such (short) discussion: https://mail.python.org/pipermail/python-ideas/2013-April/020148.html I think that move-to-trash functionality is quite useful, I needed something like that the other day, but there are at least two trash systems on Linux (although one is quite old and may not be used in recent systems), plus Windows, OS X, Android, iOS, etc. So it isn't a trivial piece of code, and it should spend some time as a third-party module first, at least until it reaches a stable and mature state. Since it's been more than two years since the discussion above, perhaps it is worth considering it again (assuming that the library is stable and mature). Are you interested in taking this discussion to python-ideas? -- nosy: +steven.daprano ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24185 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23085] update internal libffi copy to 3.2.1
Fabio Perez added the comment: Ping -- nosy: +fabiovmp ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23085 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23089] Update libffi config files
Fabio Perez added the comment: Ping -- nosy: +fabiovmp ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23089 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Building CPython
On 13/05/2015 23:34, Terry Reedy wrote: On 5/13/2015 3:36 PM, BartC wrote: I'm interested in playing with the CPython sources. I need to be able to build under Windows, but don't want to use make files (which rarely work properly), nor do a 6GB installation of Visual Studio Express which is what seems to be needed (I'm hopeless with complicated IDEs anyway). Once installed hg or tortoisehg (I use this) and VSE are installed and repository cloned, are half done. At command prompt, with top directory of repository as current directory enter tools\scripts\external.bat Double-clicking file in Explorer does not work. Usually only needs to be done once per branch after x.y.0 release as dependencies are usually not updated for bugfix releases. Then in same directory enter pcbuild\python.sln or double click in Explorer or open VSE and open this file. Hit F7, wait until get line like == Build: 1 succeeded, 0 failed, 24 up-to-date, 1 skipped, hit F5, pin python_d to taskbar (optional, but handy), and go. OK, the answer seems to be No then - you can't just trivially compile the C modules that comprise the sources with the nearest compiler to hand. So much for C's famous portability! (Actually, I think you already lost me on your first line.) That's a shame because I wanted to tinker with the main dispatcher loop to try and find out what exactly is making it slow. Nothing that seems obvious at first sight. (The comments even talk about improving branch prediction on certain architectures, even though the performance is a couple of magnitudes away from that kind of optimisation being relevant.) Perhaps I was hoping there were some options turned on by default which, if disabled, would suddenly double the speed of simple benchmarks. Now I won't be able to find out... -- Bartc -- https://mail.python.org/mailman/listinfo/python-list
Re: Survey -- Move To Trash function in Python?
On Fri, May 15, 2015 at 1:49 AM, Grant Edwards invalid@invalid.invalid wrote: On 2015-05-14, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a Move file to trash function would be useful? How would you even define what move to trash means in a standard way? Even withing the limited context of something like a mail client, it's meaning varies depending on mail store format or which IMAP server you're talking to. Or are you assuming the only thing that can be moved to trash is a file? AIUI this is specifically about files. I have never used such a feature, and generally found them to be more annoying than useful. The times when I want to mark a file for deletion either now or at some undefined time in the future (at the file system's discretion) are approximately zero; either I want the file, or I can delete it immediately. Given that actually-removed files can usually be undeleted if their disk space hasn't been reclaimed, I don't think trash cans really help much. Plus, I think it's a UI insanity when a console program dumps something in the trash, which to me has always felt like a GUI file manager tool. That said, though, I think a standardized API for trashing files is not a bad thing; and it's not something that will need huge API changes, so the costs of feature-freeze would be low. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[issue24181] test_fileio crash, 3.5, Win 7
Steve Dower added the comment: It's just a free account - any Hotmail, live.com or outlook.com email will do. The Microsoft equivalent of having a Google or Facebook account. (An MSDN Subscription is the other usual option, though that's associated with a Microsoft account anyway. I don't think there are actually any other account types these days.) I haven't looked too closely at Win 10, but I'd be surprised if you could install it with only 17GB. It's possible that it would clean up a lot of the existing Windows files and not take that much though, I really don't know right now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24181 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: a python pitfall
On Thu, May 14, 2015 at 12:06 PM, Billy Earney billy.ear...@gmail.com wrote: Hello friends: I saw the following example at http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments and did not believe the output produced and had to try it for myself See also https://docs.python.org/3/faq/programming.html#why-are-default-values-shared-between-objects -- https://mail.python.org/mailman/listinfo/python-list
Re: a python pitfall
On 14/05/2015 19:06, Billy Earney wrote: Hello friends: I saw the following example at http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments Thanks for this link, the title Engineering Fantasy could have been made for the troll who's just arrived back here after a couple of years being absent. and did not believe the output produced and had to try it for myself def foo(a,b,c=[]): c.append(a) c.append(b) print(c) foo(1,1) foo(1,1) foo(1,1) produces: [1, 1] [1, 1, 1, 1] [1, 1, 1, 1, 1, 1] One would expect the following output: [1, 1] [1, 1] [1, 1] One wouldn't expect the above because one knows better :) This comes up every few months, has probably come up every few months since Python was first let loose on the world, will probably keep coming up every few months, and will cease coming up when Python is no longer used as something better has taken its place or the planet no longer exists, whichever comes first. The most recent I recall was just six days ago http://comments.gmane.org/gmane.comp.python.general/776290 Doesn't this valid the zen of python: Explicit is better than implicit. ? Thanks! Billy -- 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: Survey -- Move To Trash function in Python?
On 05/14/2015 11:43 AM, Chris Warrick wrote: And if you are looking for a mostly-compliant Python library/app (and a shameless plug): https://pypi.python.org/pypi/trashman/1.5.0 The docs listed link to Package Builder. How is that related to TrashMan? -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
[issue24197] minidom parses comments wrongly
New submission from Paweł: from xml.dom import minidom html = html body !-- img src=/images/obraz--super.jpg/ -- /body /html minidom.parseString(html) Result: Traceback (most recent call last): File minidom.py, line 10, in module minidom.parseString(html) File /usr/lib/python2.7/xml/dom/minidom.py, line 1928, in parseString return expatbuilder.parseString(string) File /usr/lib/python2.7/xml/dom/expatbuilder.py, line 940, in parseString return builder.parseString(string) File /usr/lib/python2.7/xml/dom/expatbuilder.py, line 223, in parseString parser.Parse(string, True) xml.parsers.expat.ExpatError: not well-formed (invalid token): line 3, column 34 Tested versions: 2.7.6, 2.7.3 Reason: -- between obraz and super; -- components: XML messages: 243222 nosy: Wanat priority: normal severity: normal status: open title: minidom parses comments wrongly type: crash versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24197 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24195] Add `Executor.filter`
Ram Rachum added the comment: Also, I notice Python 3.5 feature freeze is a bit over a week away, and I hope we can get that in so it could go in Python 3.5. (Assuming it goes in at all.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24195 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Building CPython
On 14/05/2015 17:29, Marko Rauhamaa wrote: BartC b...@freeuk.com: That's a shame because I wanted to tinker with the main dispatcher loop to try and find out what exactly is making it slow. Nothing that seems obvious at first sight. My guess is the main culprit is attribute lookup in two ways: * Each object attribute reference involves a dictionary lookup. * Each method call involves *two* dictionary lookups plus an object creation. Tell us what you find out. I'm just starting but I can tell you that it isn't because debug mode (Py_DEBUG defined) was left on by mistake! What is interesting however is that on the very simple test I'm doing (a while loop incrementing a variable up to 100 million), the timings under Windows are: Python 2.5 9.2 seconds Python 3.1 13.1 Python 3.4.317.0 Python 3.4.314.3 (under Ubuntu on same machine, using the version I built today) That's quite a big range! PyPy does it in 0.7 seconds. The same program within my own *simple* bytecode interpreter (not for Python) has a fastest time of 1.5 seconds but makes use of ASM. A version 100% in (gcc) C can manage 2 seconds. So far I haven't find anything that explains the discrepancy (the languages are different, mine is simpler, but the Python code isn't doing anything that complicated, only LOAD_FASTs and such, and LOAD_FAST is apparently just an array access. But the nearly 2:1 difference between new and old Python versions is also intriguing. def whiletest(): i=0 while i=1: i=i+1 whiletest() -- Bartc -- https://mail.python.org/mailman/listinfo/python-list
[issue24196] Fail to create file if name starts with prn.
New submission from Boris: f=open('prn.txt','w') Traceback (most recent call last): File pyshell#80, line 1, in module f=open('prn.txt','w') FileNotFoundError: [Errno 2] No such file or directory: 'prn.txt' Names that fail: prn. prn.txt prn.yourmmama.txt ... Names that do not fail: prn prn_.txt npr.txt ... Happens on Windows 7, Python3.3, both 32 bit and 64 bit This should be easy to replicate. -- components: IO messages: 243219 nosy: borisompol priority: normal severity: normal status: open title: Fail to create file if name starts with prn. type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24196 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22547] Implement an informative `BoundArguments.__repr__`
Changes by Yury Selivanov yseliva...@gmail.com: -- resolution: - fixed stage: - resolved status: open - closed type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22547 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22547] Implement an informative `BoundArguments.__repr__`
Roundup Robot added the comment: New changeset a64a2e87 by Yury Selivanov in branch 'default': Issue 22547: Implement informative __repr__ for inspect.BoundArguments https://hg.python.org/cpython/rev/a64a2e87 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22547 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23995] msvcrt could not be imported
eryksun added the comment: Testing getpass shouldn't be that difficult if you use ctypes to call WriteConsoleInput [1]. For example: from ctypes import * from ctypes.wintypes import * kernel32 = WinDLL('kernel32') IN, OUT, INOUT = 1, 2, 3 KEY_EVENT = 0x0001 STD_INPUT_HANDLE = -10 STD_OUTPUT_HANDLE = -11 STD_ERROR_HANDLE = -12 INVALID_HANDLE_VALUE = HANDLE(-1).value class KEY_EVENT_RECORD(Structure): class UCHAR(Union): _fields_ = (('UnicodeChar', WCHAR), ('AsciiChar', CHAR)) _fields_ = (('bKeyDown', BOOL), ('wRepeatCount', WORD), ('wVirtualKeyCode', WORD), ('wVirtualScanCode', WORD), ('uChar', UCHAR), ('dwControlKeyState', DWORD)) class INPUT_RECORD(Structure): class EVENT(Union): _fields_ = (('KeyEvent', KEY_EVENT_RECORD),) _fields_ = (('EventType', WORD), ('Event', EVENT)) PINPUT_RECORD = POINTER(INPUT_RECORD) class HANDLE_IHV(HANDLE): @classmethod def _check_retval_(cls, retval): if retval.value == INVALID_HANDLE_VALUE: raise WinError(get_last_error()) return retval.value def errcheck_bool(result, func, args): if not result: raise WinError(get_last_error()) return args def WINAPI(name, dll, restype, *argspec): if argspec: argtypes = tuple(p[0] for p in argspec) paramflags = tuple(p[1:] for p in argspec) else: argtypes = paramflags = () prototype = WINFUNCTYPE(restype, *argtypes, use_last_error=True) func = prototype((name, dll), paramflags) if restype in (BOOL, HANDLE): func.errcheck = errcheck_bool setattr(dll, name, func) WINAPI('GetStdHandle', kernel32, HANDLE_IHV, (DWORD, IN, 'nStdHandle')) WINAPI('WriteConsoleInputW', kernel32, BOOL, (HANDLE, IN, 'hConsoleInput'), (PINPUT_RECORD, IN, 'lpBuffer'), (DWORD, IN, 'nLength'), (LPDWORD,OUT,'lpNumberOfEventsWritten')) def write_console_input(s): hInput = kernel32.GetStdHandle(STD_INPUT_HANDLE) recs = (INPUT_RECORD * len(s))() for c, rec in zip(s, recs): rec.EventType = KEY_EVENT rec.Event.KeyEvent.bKeyDown = True rec.Event.KeyEvent.wRepeatCount = 1 rec.Event.KeyEvent.uChar.UnicodeChar = c return kernel32.WriteConsoleInputW(hInput, recs, len(recs)) if __name__ == '__main__': import getpass test_input = 'Console test input.\n' n = write_console_input(test_input) assert n == len(test_input) read_input = getpass.getpass() assert read_input == test_input.rstrip() This requires that python.exe is run with an attached console (conhost.exe), i.e. the process can't be created as a DETACHED_PROCESS [2] nor can it be run using pythonw.exe without first calling AllocConsole. [1]: https://msdn.microsoft.com/en-us/library/ms687403 [2]: https://msdn.microsoft.com/en-us/library/ms684863 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23995 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23184] Unused imports, variables, file in IDLE
Terry J. Reedy added the comment: I got hg working and pushed the patch I had in January as a980da5f79f9, 5386aedf3ac9, 15701e89d710, and 3fa58e779308. Having forgotten that this issue was on the tracker (rather than just idle-sig post), I omitted the issue number and acknowledgement for the initial patch. I will add both when I add a new entry. I am working on another patch to include maxOsSupport and other changes found by pyflakes. I will add in the 'frame' change, the double use *is* confusing. pyflakes identifies files with * imports with a note that this prevents checks. I try to removed them when adding tests. I might do more just to make files checkable. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23184 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24195] Add `Executor.filter`
New submission from Ram Rachum: `Executor.filter` is to `filter` what `Executor.map` is to `map`. See Python-ideas thread: https://groups.google.com/forum/#!topic/python-ideas/EBOC5YCWPyo Patch attached. I don't know how to run the Python test suite (I'm guessing it involves building Python and I don't know how to do that.) Please tell me whether the tests I wrote pass. I'm guessing that other than that, the main thing missing in my patch is documentation. If there's agreement that this feature is desirable and the implementation is good, I'll be happy to write the docs. Let me know. -- components: Library (Lib) files: 1.patch keywords: patch messages: 243217 nosy: cool-RR priority: normal severity: normal status: open title: Add `Executor.filter` type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file39373/1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24195 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24195] Add `Executor.filter`
Paul Moore added the comment: You should add docs for the new method, as well. -- nosy: +paul.moore ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24195 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24196] Fail to create file if name starts with prn.
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24196 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24185] Add Function for Sending File to Trash (or Recycling Bin)
Virgil Dupras added the comment: For further references, there's also https://mail.python.org/pipermail/python-ideas/2014-December/030547.html which is a deeper discussion and brings even more arguments against it. Even though I'd love to have some of my code integrated into the core, arguments against its inclusion are pretty strong. -- nosy: +vdupras ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24185 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24198] please align the platform tag for windows
Steve Dower added the comment: Currently we have the form Python version-os, and the _ is within the OS field. There are no released final versions with these tags, so we can go ahead and change them however we like. Not sure exactly what you mean by the ABITAGS - Windows has no ABITAGS to my knowledge. Since I assume they're going to remain hard-coded into PC/pyconfig.h, I'm quite happy for anyone to go in and change them. While I started off thinking they were a great idea, I'm not so enamoured anymore and don't really mind how they look. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24198 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24195] Add `Executor.filter`
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24195 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24196] Fail to create file if name starts with prn.
Changes by Antoine Pitrou pit...@free.fr: -- stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24196 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24198] please align the platform tag for windows
New submission from Matthias Klose: Steve, I'd like to align the platform tag across platforms to something uniform. For POSIX systems we currently use the form base cpu-os-abi. This is derived from the autoconf host definition. Currently the windows builds use win32, win_ia64, win_arm, win_amd64. Would you consider (in descending priority): - to replace the _ with a -. The autoconf host definition use the dash as a separator, while the _ is used inside the single fields. - to change the order to base cpu-os - to use the cpu names i386, x86_64, ia64 and arm (and maybe for the future aarch64). It maybe doesn't make sense to change these where these tags exist in released versions, but it would be nice to have some common scheme used for the major platforms. Note that Darwin uses this too, but chooses to only encode the os. Also it would be nice to see the ABITAGS used for windows as well. -- components: Windows messages: 243223 nosy: doko, ned.deily, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: please align the platform tag for windows versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24198 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24196] Fail to create file if name starts with prn.
Martin Panter added the comment: I could be wrong, but I thought this was normal Windows behaviour, not related to Python. Same probably applies to other special names like NUL, COM1. -- components: +Windows nosy: +tim.golden, vadmium, zach.ware ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24196 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24196] Fail to create file if name starts with prn.
Steve Dower added the comment: It's a name reserved by Windows - see https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx#file_and_directory_names If you have a full (and 100% resolved) path, you can prefix it with \\?\ (plus escaping) to access a file by that name, but I wouldn't recommend it as you'll probably break Explorer. In any case, this is an OS limitation and not a Python issue. -- resolution: - not a bug ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24196 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23812] asyncio.Queue.put_nowait(), followed get() task cancellation leads to item being lost
Changes by Yury Selivanov yseliva...@gmail.com: -- priority: normal - deferred blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23812 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24157] test_urandom_fd_reopened failure if OS X crash reporter default set to Developer
Ned Deily added the comment: OK, that explains the failure. You must have set the OS X crash reporter default to Developer mode on that machine at some point. In that case, code that is now in the SuppressCrashReport context manager in Lib/test/support/__init__.py checks for that setting by shelling out on OS X to /usr/bin/defaults for each use of the context manager in tests and, if set to Developer, outputs that message to stdout. So that will interfere with a test like this where the contents of stdout is used as part of the test. But the code seems problematic in a couple of other respects. You can still get some crash popups even if the preference is not set to Developer. Also if the preference has never been set, you get a spurious error message to stderr for each test case that uses the context manager: 2015-05-14 14:34:44.185 defaults[90018:2205666] The domain/default pair of (/Users/nad/Library/Preferences/com.apple.CrashReporter, DialogType) does not exist My initial reaction without full testing of the effects of the Crash Reporter settings would be to: (1) not print a message to stdout since none of the other non-OS X cases do; (2) cache the results of the initial /usr/bin/defaults call. As a workaround, you could comment out the print. https://developer.apple.com/library/mac/technotes/tn2004/tn2123.html -- nosy: +ronaldoussoren stage: - needs patch title: test_urandom_fd_reopened failure on Mac OS X - test_urandom_fd_reopened failure if OS X crash reporter default set to Developer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24157 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Building CPython
On 2015-05-14 22:55, BartC wrote: On 14/05/2015 17:29, Marko Rauhamaa wrote: BartC b...@freeuk.com: That's a shame because I wanted to tinker with the main dispatcher loop to try and find out what exactly is making it slow. Nothing that seems obvious at first sight. My guess is the main culprit is attribute lookup in two ways: * Each object attribute reference involves a dictionary lookup. * Each method call involves *two* dictionary lookups plus an object creation. Tell us what you find out. I'm just starting but I can tell you that it isn't because debug mode (Py_DEBUG defined) was left on by mistake! What is interesting however is that on the very simple test I'm doing (a while loop incrementing a variable up to 100 million), the timings under Windows are: Python 2.5 9.2 seconds Python 3.1 13.1 Python 3.4.317.0 Python 3.4.314.3 (under Ubuntu on same machine, using the version I built today) That's quite a big range! PyPy does it in 0.7 seconds. The same program within my own *simple* bytecode interpreter (not for Python) has a fastest time of 1.5 seconds but makes use of ASM. A version 100% in (gcc) C can manage 2 seconds. So far I haven't find anything that explains the discrepancy (the languages are different, mine is simpler, but the Python code isn't doing anything that complicated, only LOAD_FASTs and such, and LOAD_FAST is apparently just an array access. But the nearly 2:1 difference between new and old Python versions is also intriguing. def whiletest(): i=0 while i=1: i=i+1 whiletest() Python 2.x has int and long; Python 3 has int, which is the old 'long'. Try Python 2 with longs. -- https://mail.python.org/mailman/listinfo/python-list
[issue23184] Unused imports, variables, file in IDLE
Terry J. Reedy added the comment: News entry, not new entry (Cannot edit commit messages) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23184 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23227] Generator's finally block not run if close() called before first iteration
Changes by Martin Panter vadmium...@gmail.com: -- resolution: - not a bug stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23227 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24192] unexpected system error with pep420 style namespace packages
Eric Snow added the comment: The problem is right where the traceback says. Apparently there is a gap in the namespace package tests that I slipped through with my recent work to split out path-based import. I'll work up a patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - not a bug status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24198] please align the platform tag for windows
Matthias Klose added the comment: no, I mean something like the attached patch. get_platform() is dependent on the environment, not the platform that python was built for (e.g. it tells you x86_64 when running a 32bit python) on a 64bit kernel). -- keywords: +patch Added file: http://bugs.python.org/file39374/windows-tags.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24198 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24198] please align the platform tag for windows
Ned Deily added the comment: OK, but I still don't understand your comment about OS X. get_platform() on OS X in general returns info about the platform build environment (e.g. the implied set of all OS versions and CPU archs supported), not about the specific machine environment this instance is executing in. Is there something you think should be changed? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24198 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24157] test_urandom_fd_reopened failure if OS X crash reporter default set to Developer
Skip Montanaro added the comment: OK, that explains the failure. You must have set the OS X crash reporter default to Developer mode on that machine at some point. Thanks. I certainly don't remember doing anything like that. (I'm not a Mac user at such a sophisticated level.) At any rate, I set it to server and verified that the crash reporter stopped being displayed. Skip -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24157 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Survey -- Move To Trash function in Python?
On Fri, 15 May 2015 01:49 am, Grant Edwards wrote: On 2015-05-14, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a Move file to trash function would be useful? How would you even define what move to trash means in a standard way? There are standard locations for the trash on Linux, Windows and OS X. I presume that there are standard locations on the other main OSes, such as Android, iOS, any Unix which supports the Free Desktop Standard(?), etc. Anything else can either remain unsupported, or can use a caller-defined location. Even withing the limited context of something like a mail client, it's meaning varies depending on mail store format or which IMAP server you're talking to. Or are you assuming the only thing that can be moved to trash is a file? I'm specifically referring to files, hence move FILE to trash. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
[issue24198] please align the platform tag for windows
Ned Deily added the comment: @doko, are you referring to the results of {sysconfig,distutils.util}.get_platform()? What effect would this have on third-party packages that currently support multiple versions of Python? Also, if get_platform() is meant, I don't understand the comment Darwin uses this too, but chooses to only encode the os. On OS X for get_platform(), we provide a string of the form: macosx-ABI-UNIVERSAL_CPU_ARCHS where ABI is derived from the minimum OS X level deployment target and UNIVERSAL_CPU_ARCHS is a name that identifies the set of CPU architectures included in the fat binaries for this build. Common examples: macosx-10.5-fat - runs on 10.5 or later systems with Intel-32 or PPC-32 support macosx-10.6-intel - runs on 10.6 or later systems with Intel-32 (i386) or Intel-64 (x86_64) support macosx-10.10-x86_64 - runs on 10.10 or later with only Intel-64 support -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24198 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24198] please align the platform tag for windows
Steve Dower added the comment: The patch makes it a little clearer, but I'd prefer the OS to be win32 rather than just win. Win32 is the name of the API set that Python is built against - it's as close to an ABI for the operating system as we ever get. (For contrast, WinRT is the only other API set, and it's not entirely compatible with Win32 even though there is some overlap. Python currently doesn't support WinRT except in the custom builds used for PTVS for IoT at http://ms-iot.github.io/content/Downloads.htm - it's a bit tricky to get to the dl from there though...) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24198 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Survey -- Move To Trash function in Python?
On Fri, May 15, 2015 at 11:37 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 15 May 2015 01:49 am, Grant Edwards wrote: On 2015-05-14, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a Move file to trash function would be useful? How would you even define what move to trash means in a standard way? There are standard locations for the trash on Linux, Windows and OS X. I presume that there are standard locations on the other main OSes, such as Android, iOS, any Unix which supports the Free Desktop Standard(?), etc. Anything else can either remain unsupported, or can use a caller-defined location. Point to note: Inclusion in the Python standard library would cement its *API*, but not its OS and desktop support. A call like trash.retrieve(oops_i_deleted_this) will either succeed or raise an error; it can change from raising to succeeding for a given platform without breaking anyone's code. So it wouldn't be a problem to start out supporting only the most major platforms (or not even all of them), and expand later. Much as I detest the operation itself, I do think this is something worth papering over. The multiprocessing module papers over a whole lot of platform quirks, and all we have left is make sure your main module is importable if you use this on Windows; a trashing module could deal with all the differing ways of trashing things, and leave us with trashing may not work on certain file systems. (Though when it comes to the bikeshedding phase, I'm sure there'll be some who say if it can't be trashed, just hard delete it, and others who say if it can't be trashed, raise an exception. And neither is truly wrong.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: a python pitfall
On Fri, 15 May 2015 04:06 am, Billy Earney wrote: Hello friends: I saw the following example at http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments and did not believe the output produced and had to try it for myself def foo(a,b,c=[]): c.append(a) c.append(b) print(c) foo(1,1) foo(1,1) foo(1,1) produces: [1, 1] [1, 1, 1, 1] [1, 1, 1, 1, 1, 1] One would expect the following output: [1, 1] [1, 1] [1, 1] Really? Why would you expect that? The *body* of the function is executed every time the function runs. The *definition* of the function is executed once, and only once, when the function is first defined. Setting the default value of a parameter is part of the definition, not the body, and so it happens once only, not every time. It truly would be surprising if the function recalculated the default value every time. Since the default value for c is a list, you are mutating the *same list* each time. This question comes up repeatedly. It's a FAQ, and the most recent time was less than a week ago: https://mail.python.org/pipermail/python-list/2015-May/703043.html See, in particular, my response: https://mail.python.org/pipermail/python-list/2015-May/703065.html Doesn't this valid the zen of python: Explicit is better than implicit. ? I think you mean invalidate. No, this has nothing to do with explicitness or implicitness. Regardless of whether Python uses early binding or late binding of the default parameter, it is still equally explicit. The problem occurs because people assume one binding model (which is entirely inconsistent with everything else in Python) and get it wrong: people assume that function defaults are late binding, but they are not. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
[issue23184] Unused imports, variables, file in IDLE
Terry J. Reedy added the comment: More idlelib fixes. Will push after reviewing. pyflakes shows extraneous items in idle_test also. -- Added file: http://bugs.python.org/file39375/@unused.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23184 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com