Pygments 2.0 released
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm happy to announce the release of Pygments 2.0. Pygments is a generic syntax highlighter written in Python. There is a lot of news in the 2.0 release, please have a look at the changelog http://pygments.org/docs/changelog. There are over 50 new languages or markups supported, and a few interesting new features. The most important feature from a development point of view is single-source compatibility with Python 2 and 3, with the range of supported Python versions restricted to 2.6+ and 3.3+. Report bugs and feature requests in the issue tracker: http://bitbucket.org/birkenfeld/pygments-main/issues. Thanks go to all the contributors of these lexers, and to all those who reported bugs and waited patiently for this release, and as always many thanks also to Tim Hatch for his continued care for Pygments. Download it from http://pypi.python.org/pypi/Pygments, or look at the demonstration at http://pygments.org/demo. Enjoy, Georg -BEGIN PGP SIGNATURE- Version: GnuPG v2 iEYEARECAAYFAlRftA8ACgkQN9GcIYhpnLAfPQCfWph8/NGbrED/4cKI33xvlUhF Ym0Anjtdw4TP43P+4OcyaSePs/q3jgRm =C+OH -END PGP SIGNATURE- -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Pint 0.6 (Units in Python)
Hi, We are happy to announce Pint 0.6. Pint is a Python package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement. Check out the blog post for more details about this release: http://python-in-the-lab.blogspot.com.ar/2014/11/pint-06-faster-and-with-better-non.html You can get pint using pip: $ pip install pint or get the source code: https://github.com/hgrecco/pint and check the docs: http://pint.readthedocs.org/ Thanks to the people that contributed bug reports, suggestions and patches since 0.5. In particular to Matthieu Dartiailh, Ryan Kingsbury, Joel Mohler, Virgil Dupras, Jonas Olson, John David Reaver and Peter Grayson. A big thanks should be given to David Linke who did an awesome work with offset units (Please let me know if I am forgetting someone!) What is Pint? --- Pint is Python package to define, operate and manipulate physical quantities: the product of a numerical value and a unit of measurement. It allows arithmetic operations between them and conversions from and to different units. It supports a lot of numpy mathematical operations without monkey patching or wrapping numpy. It is distributed with a comprehensive list of physical units, prefixes and constants. Due to it’s modular design, you can extend (or even rewrite!) the complete list without changing the source code. It has a complete test coverage. It runs in Python 2.6+ and 3.2+ with no other dependency. It licensed under BSD. Highlights --- * Unit parsing: prefixed and pluralized forms of units are recognized without explicitly defining them. In other words: as the prefix kilo and the unit meter are defined, Pint understands kilometers. This results in a much shorter and maintainable unit definition list as compared to other packages. * Standalone unit definitions: units definitions are loaded from a text file which is simple and easy to edit. Adding and changing units and their definitions does not involve changing the code. * Advanced string formatting: a quantity can be formatted into string using PEP 3101 syntax. Extended conversion flags are given to provide symbolic, latex and pretty formatting. * Free to choose the numerical type: You can use any numerical type (fraction, float, decimal, numpy.ndarray, etc). NumPy is not required but supported. * NumPy integration: When you choose to use a NumPy ndarray, its methods and ufuncs are supported including automatic conversion of units. For example numpy.arccos(q) will require a dimensionless q and the units of the output quantity will be radian. * Handle temperature: conversion between units with different reference points, like positions on a map or absolute temperature scales. * Small codebase: easy to maintain codebase with a flat hierarchy. * Dependency free: it depends only on Python and it’s standard library. * Python 2 and 3: a single codebase that runs unchanged in Python 2.6+ and Python 3.2+. Enjoy! Hernán -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
locale.getlocale() in cmd.exe vs. Idle
Hi, Why do I get different output for locale.getlocale() in Idle vs. cmd.exe? # IDLE Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type copyright, credits or license() for more information. import locale locale.getdefaultlocale() ('nl_NL', 'cp1252') locale.getlocale() ('Dutch_Netherlands', '1252') # I need this specific notation # cmd.exe or Ipython C:\Users\albertjanpython Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import locale locale.getdefaultlocale() ('nl_NL', 'cp1252') locale.getlocale() (None, None) # using setlocale does work (one of these instances when I answer my own question while writing to the Python list) C:\Users\albertjanpython Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import locale locale.setlocale(locale.LC_ALL, ) 'Dutch_Netherlands.1252' locale.getlocale() ('Dutch_Netherlands', '1252') Thank you! Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ -- https://mail.python.org/mailman/listinfo/python-list
ssl error with the python mac binary
Hey, I've been using the latest mac ppc/i386 binaries from python.org (https://www.python.org/ftp/python/2.7.8/python-2.7.8-macosx10.5.dmg). From what I can tell this version is linked against a pretty old version of OpenSSL (OpenSSL 0.9.7l 28 Sep 2006) which doesn't seem to be able to handle new sha-256 certificates. For example I'm unable to use pip (I guess the certificate was updated recently) Searching for gnureadline Reading https://pypi.python.org/simple/gnureadline/ Download error on https://pypi.python.org/simple/gnureadline/: [Errno 1] _ssl.c:510: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm -- Some packages may not be found! Am I right in thinking this is an issue with the build of python itself? Is there a way I can upgrade the version of OpenSSL linked with python- or force the python build to look elsewhere for the library? Or will I have to build my own from source? Thanks! Paul -- https://mail.python.org/mailman/listinfo/python-list
Re: Booksigning Party at PyCon This Year!
My kids want to celebrate Halloween party at one of the best party venue. Can you please help us and recommend me best Halloween party nyc https://www.toshislivingroom.com/t/best-halloween-party-nyc.php with good food supplies arrangements? -- View this message in context: http://python.6.x6.nabble.com/Booksigning-Party-at-PyCon-This-Year-tp935988p5077004.html Sent from the Python - python-list mailing list archive at Nabble.com. -- https://mail.python.org/mailman/listinfo/python-list
A syntax question
I don't understand the following phenomenon. Could someone kindly explain it? Thanks in advance. M. K. Shen - count=5 def test(): print(count) if count==5: count+=0 ### Error message if this line is active, otherwise ok. print(count) return test() -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On Mon, 10 Nov 2014 12:07:58 +0100, Mok-Kong Shen wrote: I don't understand the following phenomenon. Could someone kindly explain it? Thanks in advance. M. K. Shen - count=5 def test(): print(count) if count==5: count+=0 ### Error message if this line is active, otherwise ok. print(count) return test() My crystal ball is currently in for repair and is not expected back in the foreseeable future. What result are you getting that you don't understand what do you expect? What is the error message you get? Post the full traceback -- The POP server is out of Coke -- https://mail.python.org/mailman/listinfo/python-list
Re: Python script that does batch find and replace in txt files
On Sun, 09 Nov 2014 17:49:29 -0800, Syed Khalid wrote: Albert, Code is not removing empty lines containing blank characters and not removing leading and trailing spaces present in each line. import glob, codecs, re, os regex = re.compile(rAge: |Sex: |House No: ) # etc etc for txt in glob.glob(D:/Python/source/*.txt): with codecs.open(txt, encoding=utf-8) as f: oldlines = f.readlines() for i, line in enumerate(oldlines): if Elector's Name: in line: break newlines = [regex.sub(, line).strip().replace(-, _) for line in oldlines[i:]] with codecs.open(txt + _out.txt, wb, encoding=utf-8) as w: w.write(os.linesep.join(newlines)) Kindly do the needful kindly read the code to understand how it is operating then make the necessary changes/additions yourself comp.lang.python is no a free coding shop -- Nobody ever ruined their eyesight by looking at the bright side of something. -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
My crystal ball is currently in for repair and is not expected back in the foreseeable future. Without a crystal ball, this prediction might be not well founded. -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
You may want to read: https://docs.python.org/3/faq/programming.html?highlight=global#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value from the Python docs Programming FAQ section. It explains your problem pretty well. As others have hinted at, always provide concrete Python error messages and tracebacks instead of vague descriptions. Best, Wolfgang On 11/10/2014 12:07 PM, Mok-Kong Shen wrote: I don't understand the following phenomenon. Could someone kindly explain it? Thanks in advance. M. K. Shen - count=5 def test(): print(count) if count==5: count+=0 ### Error message if this line is active, otherwise ok. print(count) return test() -- https://mail.python.org/mailman/listinfo/python-list
Re: Python modules
In article i0h06a9pj8h3olo5rnrgc64i7ckpvtv...@4ax.com, Steve Hayes hayes...@telkomsa.net wrote: I have a book on Python that advocates dividing programs into modules, and importing them when needed. Yes, this is a good idea. Breaking your program down into modules, each of which does a small set of closely related things, makes it easier to manage. You can test each module in isolation. When you look at your version control log, you can see just the changes which apply to just that module. When somebody new joins the team, they can learn about each module one at a time. None of this is specific to Python. Good software engineering practice is to break large applications into manageable pieces. The vocabulary may change from language to language (module, package, class, library, dll, etc), but the basic concept is the same. But I understand that Python is an interpreted language, and If I wrote a program in Python like that, and wanted to run it on another computer, how would it find all the modules to import at run-time, unless I copied the whole directory structure over to the other computer? Yes, exactly. When you deploy your application someplace, you need to include all the things it depends on. In the simple case of a few python files (say, a main program and a few modules that you're written), the easiest thing to do might be to just clone your source repository on the other machine and run it directly from that. Another possibility would be to package up all the files in some sort of archive (tar, zip, whatever) and unpack that wherever you need it. You will also have to set up a correct environment. This usually means having an appropriate version of Python already installed, plus whatever third-party modules you use. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python modules
On Tue, Nov 11, 2014 at 12:36 AM, Roy Smith r...@panix.com wrote: Yes, exactly. When you deploy your application someplace, you need to include all the things it depends on. In the simple case of a few python files (say, a main program and a few modules that you're written), the easiest thing to do might be to just clone your source repository on the other machine and run it directly from that. Even in less simple cases, that's often a good way to run things. As long as your source repo has no large binary files in it, it'll be reasonably small; for 400KB of source code and ~1600 commits spanning ~3 years of history, around about 2MB. When your deployment is a source clone, it's really easy to pull changes and see what's new; and if you ever find a bug on a deployment machine (maybe a different OS from your usual dev system), you can make a patch right there and send it along. There's no huge okay, let's make a new release now overhead - you just keep committing (maybe pushing) changes, same as you do any other time, and perhaps tag some commit with a version number. Very very easy. I recommend it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On Mon, Nov 10, 2014 at 6:39 AM, Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote: You may want to read: https://docs.python.org/3/faq/programming.html?highlight=global#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value from the Python docs Programming FAQ section. It explains your problem pretty well. As others have hinted at, always provide concrete Python error messages and tracebacks instead of vague descriptions. Best, Wolfgang On 11/10/2014 12:07 PM, Mok-Kong Shen wrote: I don't understand the following phenomenon. Could someone kindly explain it? Thanks in advance. M. K. Shen - count=5 def test(): print(count) if count==5: count+=0 ### Error message if this line is active, otherwise ok. print(count) return test() -- https://mail.python.org/mailman/listinfo/python-list Your problem is that count is not local. You are reading count from an outer scope. When you try to increment count in your function, it can't because it doesn't exist. Don't use globals. -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On 2014-11-10, David Palao dpalao.pyt...@gmail.com wrote: My crystal ball is currently in for repair and is not expected back in the foreseeable future. Without a crystal ball, this prediction might be not well founded. That isn't a prediction. It's an explicit statement of no prediction. He said that it is not expected back rather than expected not to be back. They're two different things. The former asserts a _lack_ of expection/prediction. The latter asserts an expectation/prediction. -- Grant Edwards grant.b.edwardsYow! Am I in Milwaukee? at gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On Tue, Nov 11, 2014 at 1:35 AM, Joel Goldstick joel.goldst...@gmail.com wrote: Your problem is that count is not local. You are reading count from an outer scope. When you try to increment count in your function, it can't because it doesn't exist. Don't use globals. False analysis, I'm afraid. The problem is that the assignment will, in the absence of a global declaration, cause the name count to indicate a local variable - so it won't ever be read from outer scope. However, the OP's issue is better solved by sharing tracebacks than by us peering into crystal balls; mine's showing a very clear image at the moment, but it might well be incorrect. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On Mon, 10 Nov 2014 14:44:53 +, Grant Edwards wrote: On 2014-11-10, David Palao dpalao.pyt...@gmail.com wrote: My crystal ball is currently in for repair and is not expected back in the foreseeable future. Without a crystal ball, this prediction might be not well founded. That isn't a prediction. It's an explicit statement of no prediction. He said that it is not expected back rather than expected not to be back. They're two different things. The former asserts a _lack_ of expection/prediction. The latter asserts an expectation/prediction. It was only a a joke maybe it was a bit to subtle -- A light wife doth make a heavy husband. -- Wm. Shakespeare, The Merchant of Venice -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On Mon, 10 Nov 2014 14:54:55 +, alister wrote: On Mon, 10 Nov 2014 14:44:53 +, Grant Edwards wrote: On 2014-11-10, David Palao dpalao.pyt...@gmail.com wrote: My crystal ball is currently in for repair and is not expected back in the foreseeable future. Without a crystal ball, this prediction might be not well founded. That isn't a prediction. It's an explicit statement of no prediction. He said that it is not expected back rather than expected not to be back. They're two different things. The former asserts a _lack_ of expection/prediction. The latter asserts an expectation/prediction. It was only a a joke maybe it was a bit to subtle I didn't expect the Spanish inquisition (Damn wish Id though of that before sending the last post) -- One picture is worth more than ten thousand words. -- Chinese proverb -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
Joel Goldstick wrote: On Mon, Nov 10, 2014 at 6:39 AM, Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote: You may want to read: https://docs.python.org/3/faq/programming.html?highlight=global#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value from the Python docs Programming FAQ section. It explains your problem pretty well. As others have hinted at, always provide concrete Python error messages and tracebacks instead of vague descriptions. Best, Wolfgang On 11/10/2014 12:07 PM, Mok-Kong Shen wrote: I don't understand the following phenomenon. Could someone kindly explain it? Thanks in advance. M. K. Shen - count=5 def test(): print(count) if count==5: count+=0 ### Error message if this line is active, otherwise ok. print(count) return test() -- https://mail.python.org/mailman/listinfo/python-list Your problem is that count is not local. You are reading count from an outer scope. When you try to increment count in your function, it can't because it doesn't exist. Don't use globals. That's what most would expect, but the error is already triggered by the first print(count) Python decides at compile-time that count is a local variable if there is an assignment (name binding) to count anywhere in the function's scope -- even if the corresponding code will never be executed: x = 42 def test(): ... print(x) ... if 0: x = 42 ... test() Traceback (most recent call last): File stdin, line 1, in module File stdin, line 2, in test UnboundLocalError: local variable 'x' referenced before assignment This is different from the class body where the global namespace is tried when a lookup in the local namespace fails: x = 42 class A: ... print(x) ... x += 1 ... 42 x 42 A.x 43 Historical ;) note: In Python 2 you could trigger a similar behaviour with exec: def f(a): ... if a: exec x = 42 ... print x ... x = global f(True) 42 f(False) global -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On Mon, Nov 10, 2014 at 9:54 AM, Chris Angelico ros...@gmail.com wrote: On Tue, Nov 11, 2014 at 1:35 AM, Joel Goldstick joel.goldst...@gmail.com wrote: Your problem is that count is not local. You are reading count from an outer scope. When you try to increment count in your function, it can't because it doesn't exist. Don't use globals. False analysis, I'm afraid. The problem is that the assignment will, in the absence of a global declaration, cause the name count to indicate a local variable - so it won't ever be read from outer scope. However, the OP's issue is better solved by sharing tracebacks than by us peering into crystal balls; mine's showing a very clear image at the moment, but it might well be incorrect. ChrisA -- https://mail.python.org/mailman/listinfo/python-list Interesting. Thanks for pointing that out -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On 2014-11-10, alister alister.nospam.w...@ntlworld.com wrote: On Mon, 10 Nov 2014 14:44:53 +, Grant Edwards wrote: On 2014-11-10, David Palao dpalao.pyt...@gmail.com wrote: My crystal ball is currently in for repair and is not expected back in the foreseeable future. Without a crystal ball, this prediction might be not well founded. That isn't a prediction. It's an explicit statement of no prediction. He said that it is not expected back rather than expected not to be back. They're two different things. The former asserts a _lack_ of expection/prediction. The latter asserts an expectation/prediction. It was only a a joke maybe it was a bit to subtle I know, but in c.l.p, even jokes get nicely pednatic answers. ;) -- Grant Edwards grant.b.edwardsYow! The FALAFEL SANDWICH at lands on my HEAD and I gmail.combecome a VEGETARIAN ... -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On Tue, Nov 11, 2014 at 3:11 AM, Grant Edwards invalid@invalid.invalid wrote: I know, but in c.l.p, even jokes get nicely pednatic answers. And in c.l.p, odd jokes get even more pedantic spelling corrections. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
RE: [Distutils] Call for information - What assumptions can I make about Unix users' access to Windows?
Ben Finney wrote: Steve Dower steve.do...@microsoft.com writes: Ben Finney wrote: The restrictions of the license terms make MS Windows an unacceptable risk on any machine I'm responsible for. Just out of interest, which restrictions would those be? It has been a long time since I bothered to read any of the numerous license texts from Microsoft, so I can't cite specific clauses. From memory, unacceptable restrictions include: * Restricting the instance to specific hardware, instead of leaving it up to the recipient to run the work they paid for on any hardware they choose. If by specific hardware you mean the one-license-per-user-per-machine rule, you probably want to consider Windows Server, which has a more flexible license in this respect (or maybe not - it might just allow multiple users on one license/machine. I haven't checked this). * Forbidding reverse-engineering of the OS to see how it behaves. Yeah, I doubt that restriction is moving anywhere. It's standard for closed-source software, and as I understand it's intended to legally protect trade secrets and patents (i.e. we tried our hardest to keep this a trade secret). I've never heard of anyone being pursued for doing it though, except to be offered a job working on Windows :) * Forbidding collaboration with other recipients to discover how the OS behaves. Other recipients are explicitly excluded - for use by one person at a time[1] - so the rest of this point doesn't really make any sense to me. That said, it does trigger some memories of when I was contributing to ReactOS years ago... is this one of their suggestions about how to avoid taint? (Or maybe from Wine?) Those guys have obtained their own legal advice which is going to be aimed at preventing a court case (not just preventing a loss - preventing it from happening in the first place) and so it's going to be based on an interpretation of the license and be more defensive than most people need to worry about. * Refusal to disclose the source code for the running OS to the recipient. Again, it's part of the business and legal model. If you really want access to the source code, you can pay for it, but most people and businesses can't afford it or don't want it that badly. (There are also technical reasons why the source code can't easily be disclosed - how many hundreds of gigabytes of code are you willing to download and wade through? Yes, it's that big.) * Forbidding the recipient from getting their choice of vendor to make improvements to the OS and collaborate with other recipients on the improvements. I know this used to exist, as there were a number of RT/embedded OSs available that were based on Windows. I think at this point they've all been absorbed into Microsoft though. * Arrogating control of the running OS to a party other than the license recipient, including the ability to (at Microsoft's sole discretion) deny applications to run, and to disable features of the OS. * Arrogating data collection to Microsoft and undisclosed third parties, tracking broad classes of activity on the OS and sending the logs to a server not of the recipient's choosing. It seems you fundamentally disagree with the 'licensing' model and would prefer an 'ownership' model. That's fine, but it's not the business model Windows operates under and that is unlikely to ever change. Even if I were CEO, I'd have a hard time changing that one :) Does this prevent you from creating a VM on a cloud provider on your own account? If I need to accept restrictions such as the above, I don't see that the location of the instance (nor the fees charged) has any affect on these concerns. The risks discussed above are not mitigated. If the licensing is a real issue, I'm in a position where I can have a positive impact on fixing it, so any info you can provide me (on- or off-list) about your concerns is valuable. Thank you for this offer, I am glad to see willingness expressed to solve these restrictions. I hope you can achieve software freedom for all recipients of Microsoft operating systems. Until then, the risk is too great to anyone to whom I have professional responsibilities, and my advice must continue to be that they avoid accepting such restrictions. That's a fair enough position, and without people taking that stance, Linux (and practically every OS that's based on it) wouldn't be anywhere near as usable as it is today. I'm also fully aware of people with the exact opposite stance who give the exact opposite advice, so there's room in this world for all of us. I'm sorry I can't do any better than the few responses above - these are big issues that run to the core of how Microsoft does business, and not only am I incapable of changing them, I'm nowhere near capable of fully understanding how it all fits together. Thanks for being willing to engage, though. It's always valuable to hear alternative points of
Re: What does zip mean?
On 11/09/2014 11:44 AM, satishmlm...@gmail.com wrote: What does zip return in the following piece of code? To help you understanding what is the `zip` builtin, please forget about PKZip etc and think about the _zip fastener_ or _zipper_ in your bag or in your trousers In the bag you have two sequences of teeth that the zipper binds together in interlocking pairs In your program you have two lists, whose elements `zip` returns bound together in pairs -- https://mail.python.org/mailman/listinfo/python-list
Re: What does zip mean?
On 2014-11-10, giacomo boffi giacomo_bo...@inwind.it wrote: On 11/09/2014 11:44 AM, satishmlm...@gmail.com wrote: What does zip return in the following piece of code? To help you understanding what is the `zip` builtin, please forget about PKZip etc and think about the _zip fastener_ or _zipper_ in your bag or in your trousers In the bag you have two sequences of teeth that the zipper binds together in interlocking pairs No, you don't. That's not how a zipper works. Each tooth from side A, isn't bound with one from side B. It's bound with _two_ of them from side B. And each of those is in turn bound with an additional tooth from side A, and so on... In your program you have two lists, whose elements `zip` returns bound together in pairs What the zipper on a coat does is convert two separate sequences into a single sequence where the members alternate between the two input sequences. IOW if we want to do something analogous to a zipper fastener it should do this: zip([a,b,c,d,e,f],[1,2,3,4,5,6]) = [a,1,b,2,c,3,d,4,e,5,f,6] Item '1' is bound equally to item 'a' and 'b'. Item 'b' is bound equally to item '1' and '2'. -- Grant Edwards grant.b.edwardsYow! I joined scientology at at a garage sale!! gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Natural use of cmp= in sort
Hi, I do agree with Raymond H. about the relative merits of cmp= and key= in sort/sorted, but I decided to also not let natural uses of cmp= pass silently. In answering this question, http://stackoverflow.com/a/26850434/10562 about ordering subject to inequalities it seemed natural to use the cmp= argument of sort rather than key=. The question is about merging given inequalities to make 1 inequality such that the inequalities also stays true. Here is a copy of my code: Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type copyright, credits or license() for more information. ineq = f4 f2 f3 f4 f1 f3 f4 f2 f1 f2 f1 f3 print(ineq) f4 f2 f3 f4 f1 f3 f4 f2 f1 f2 f1 f3 greater_thans, all_f = set(), set() for line in ineq.split('\n'): tokens = line.strip().split()[::2] for n, t1 in enumerate(tokens[:-1]): for t2 in tokens[n+1:]: greater_thans.add((t1, t2)) all_f.add(t1) all_f.add(t2) sorted(all_f, cmp=lambda t1, t2: 0 if t1==t2 else ...(1 if (t1, t2) not in greater_thans else -1)) ['f4', 'f2', 'f1', 'f3'] -- https://mail.python.org/mailman/listinfo/python-list
I don't read docs and don't know how to use Google. What does the print function do?
Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. -- https://mail.python.org/mailman/listinfo/python-list
Re: Natural use of cmp= in sort
Paddy wrote: Hi, I do agree with Raymond H. about the relative merits of cmp= and key= in sort/sorted, but I decided to also not let natural uses of cmp= pass silently. In answering this question, http://stackoverflow.com/a/26850434/10562 about ordering subject to inequalities it seemed natural to use the cmp= argument of sort rather than key=. The question is about merging given inequalities to make 1 inequality such that the inequalities also stays true. Here is a copy of my code: Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type copyright, credits or license() for more information. ineq = f4 f2 f3 f4 f1 f3 f4 f2 f1 f2 f1 f3 print(ineq) f4 f2 f3 f4 f1 f3 f4 f2 f1 f2 f1 f3 greater_thans, all_f = set(), set() for line in ineq.split('\n'): tokens = line.strip().split()[::2] for n, t1 in enumerate(tokens[:-1]): for t2 in tokens[n+1:]: greater_thans.add((t1, t2)) all_f.add(t1) all_f.add(t2) sorted(all_f, cmp=lambda t1, t2: 0 if t1==t2 else ...(1 if (t1, t2) not in greater_thans else -1)) ['f4', 'f2', 'f1', 'f3'] I'm not sure this works. I tried: $ cat paddy.py ineq = f4 f2 f3 f4 f1 f3 f4 f2 f1 f2 f1 f3 f3 f5 greater_thans = set() all_f = set() for line in ineq.split('\n'): tokens = line.strip().split()[::2] for n, t1 in enumerate(tokens[:-1]): for t2 in tokens[n+1:]: greater_thans.add((t1, t2)) all_f.add(t1) all_f.add(t2) print all_f print greater_thans print sorted(all_f, cmp=lambda t1, t2: 0 if t1==t2 else (1 if (t1, t2) not in greater_thans else -1)) $ PYTHONHASHSEED=0 python paddy.py set(['f1', 'f2', 'f3', 'f4', 'f5']) set([('f1', 'f3'), ('f2', 'f1'), ('f2', 'f3'), ('f4', 'f3'), ('f4', 'f2'), ('f4', 'f1'), ('f3', 'f5')]) ['f4', 'f2', 'f1', 'f3', 'f5'] $ PYTHONHASHSEED=1 python paddy.py set(['f5', 'f4', 'f3', 'f2', 'f1']) set([('f1', 'f3'), ('f2', 'f3'), ('f2', 'f1'), ('f4', 'f1'), ('f3', 'f5'), ('f4', 'f3'), ('f4', 'f2')]) ['f5', 'f4', 'f2', 'f1', 'f3'] -- https://mail.python.org/mailman/listinfo/python-list
Re: I don't read docs and don't know how to use Google. What does the print function do?
sohcahto...@gmail.com wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. I'm sorry I have to decline your kind offer unless you also let me do your dishes and walk your dog. -- https://mail.python.org/mailman/listinfo/python-list
Re: Natural use of cmp= in sort
On Mon, Nov 10, 2014 at 12:19 PM, Peter Otten __pete...@web.de wrote: I'm not sure this works. I tried: Here's a simpler failure case. ineq = f2 f3 ... f3 f1 [Previously posted code elided] greater_thans set([('f3', 'f1'), ('f2', 'f3')]) sorted(all_f, cmp=lambda t1, t2: 0 if t1==t2 else ... (1 if (t1, t2) not in greater_thans else -1)) ['f1', 'f2', 'f3'] Note that the greater_thans set is missing the implication by transitivity that f2 f1, so the given cmp function would inconsistently return -1 for both comparisons cmp('f1', 'f2') and cmp('f2', 'f1'). -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
In article mailman.15627.1415636743.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Tue, Nov 11, 2014 at 3:11 AM, Grant Edwards invalid@invalid.invalid wrote: I know, but in c.l.p, even jokes get nicely pednatic answers. And in c.l.p, odd jokes get even more pedantic spelling corrections. ChrisA a n d i m a g i n a r y j o k e s g e t r o t a t e d -- https://mail.python.org/mailman/listinfo/python-list
Re: I don't read docs and don't know how to use Google. What does the print function do?
In article b509998d-c547-4638-8810-0388c0894...@googlegroups.com, sohcahto...@gmail.com wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. This post is a sine of the times. -- https://mail.python.org/mailman/listinfo/python-list
Design and Build Software Engineer Opportunity
My name is Charles Weitzer. I do recruiting for machine learning teams worldwide. One of my clients is a startup quantitative hedge fund located in Northern, California. The founders previous worked together at one of the most successful quantitative hedge funds in the world in New York City. Now they are ready to do it again. The team would like to hire an extremely talented design and build software engineer as soon as possible.. They are rebuilding their current trading strategy and system and also designing a new strategy. You could work on either or both. The title and level of seniority are very flexible. Their team has made unpublished discoveries in the field of machine learning and in other areas as well. This is an opportunity to leverage these discoveries in a real world environment. Here is their description of the position: ** Design and Build Software Engineer Fast-growing quantitative trading firm seeks an exceptional software engineer. You will design and build new production trading systems, machine learning infrastructure, data integration pipelines, and large-scale storage systems. We seek a candidate with a proven track record of building correct, well-designed software, solving hard problems, and delivering complex projects on time. You should preferably have experience designing and implementing fault-tolerant distributed systems. Experience with building large-scale data infrastructure, stream processing systems, or latency-sensitive programs is a bonus. We are getting big fast. Willingness to take initiative, and a gritty determination to productize, are essential. Join a team that includes faculty at premier universities and PhD's from top-tier schools, led by the founder and CEO of a successful Internet infrastructure startup. You will have a high impact, and you can expect frequent interaction with the researchers, officers, and founders. Compensation and benefits are highly competitive. Qualifications: * Experience developing with C/C++/Python/Go in a Linux environment with a focus on performance, concurrency, and correctness. * Experience working in TCP/IP networking, multithreading and server development. * Experience working with common Internet protocols (IP, TCP/UDP, SSL/TLS, HTTP, SNMP, etc.) * Experience architecting and designing highly-available critical systems. * Experience architecting and designing large-scale data management infrastructure. * Experience working in large codebases and building modular, manageable code. Useful Skills: * Experience with debugging and performance profiling, including the use of tools such as strace, valgrind, gdb, tcpdump, etc. * Experience with build and test automation tools. * Experience working with well-defined change management processes. * Has experience hunting down RDBMS performance problems, understands indexing options, can read an execution/explain plan, has some experience with ORM and optimization at the code layer, etc. * Experience with messaging queues (such as RabbitMQ and Redis), as well as distributed caching systems. ** This group is currently managing a very healthy amount of capital. And their job description above is really just a starting point in terms of possible responsibilities and seniority. They can be very flexible for the right person. If you are interested, let me know the best way to get in touch and we can discuss details. Talk soon, Charles Weitzer CEO\Senior Recruiter Charles Weitzer and Associates, Inc. Global Financial Recruiting Services char...@charlesweitzer.com Voice: USA (510) 558-9182 -- https://mail.python.org/mailman/listinfo/python-list
Re: I don't read docs and don't know how to use Google. What does the print function do?
On Mon, Nov 10, 2014 at 2:49 PM, Roy Smith r...@panix.com wrote: In article b509998d-c547-4638-8810-0388c0894...@googlegroups.com, sohcahto...@gmail.com wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. This post is a sine of the times. Don't go off on a tangent. -- https://mail.python.org/mailman/listinfo/python-list
Re: I don't read docs and don't know how to use Google. What does the print function do?
On 10/11/2014 19:24, Peter Otten wrote: sohcahto...@gmail.com wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. I'm sorry I have to decline your kind offer unless you also let me do your dishes and walk your dog. Quote Of The Day/Week/Month/Year/Decade/Millenium* * please delete whichever you feel is appropriate -- 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: A syntax question
On 10/11/2014 11:31, David Palao wrote: My crystal ball is currently in for repair and is not expected back in the foreseeable future. Without a crystal ball, this prediction might be not well founded. Especially in the future when sombody asks Who the hell was he replying to?. -- 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: I don't read docs and don't know how to use Google. What does the print function do?
On 11/10/2014 11:59 AM, Larry Martell wrote: On Mon, Nov 10, 2014 at 2:49 PM, Roy Smith r...@panix.com wrote: In article b509998d-c547-4638-8810-0388c0894...@googlegroups.com, sohcahto...@gmail.com wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. This post is a sine of the times. Don't go off on a tangent. Please! We don't need all this hyperbole! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: A syntax question
On 2014-11-10 20:08, Mark Lawrence wrote: On 10/11/2014 11:31, David Palao wrote: My crystal ball is currently in for repair and is not expected back in the foreseeable future. Without a crystal ball, this prediction might be not well founded. Especially in the future when sombody asks Who the hell was he replying to?. That might be a concern if the mail.python.org archive failed, and all usenet archives fell offline. Since the threading wasn't broken, it's a simple matter of looking at the previous message in the thread, as referenced in the appropriate headers: In-Reply-To: bf18w.682041$9R5.556154@fx29.am4 References: m3q6ae$m8p$1...@news.albasani.net bf18w.682041$9R5.556154@fx29.am4 where that particular message can be found. Any competent mailer or news client should handle threading without the user even thinking about it. It might also be more of a concern if there was actual question/answer content rather than just a little throw-away humor. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: locale.getlocale() in cmd.exe vs. Idle
On 11/10/2014 4:22 AM, Albert-Jan Roskam wrote: Hi, Why do I get different output for locale.getlocale() in Idle vs. cmd.exe? # IDLE Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type copyright, credits or license() for more information. import locale locale.getdefaultlocale() ('nl_NL', 'cp1252') locale.getlocale() ('Dutch_Netherlands', '1252') # I need this specific notation # cmd.exe or Ipython C:\Users\albertjanpython Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import locale locale.getdefaultlocale() ('nl_NL', 'cp1252') locale.getlocale() (None, None) # using setlocale does work (one of these instances when I answer my own question while writing to the Python list) C:\Users\albertjanpython Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import locale locale.setlocale(locale.LC_ALL, ) 'Dutch_Netherlands.1252' locale.getlocale() ('Dutch_Netherlands', '1252') Idle runs code in an environment that is slightly altered from the standard python startup environment'. idlelib.IOBinding has this ''' # Try setting the locale, so that we can find out # what encoding to use try: import locale locale.setlocale(locale.LC_CTYPE, ) ''' idlelib.run, which runs in the user-code subprocess, imports IOBinding. Setting LC_CTYPE is sufficient for getlocale() to not return null values. C:\Users\Terrypython -c import locale; print(locale.getlocale()) (None, None) C:\Users\Terrypython -c import locale; locale.setlocale(locale.LC_CTYPE, ''); print(locale.getlocale()) ('English_United States', '1252') -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: What does zip mean?
Grant Edwards wrote: What the zipper on a coat does is convert two separate sequences into a single sequence where the members alternate between the two input sequences. True, the zipper analogy isn't quite accurate. It's hard to think of an equally concise and suggestive name, however. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: I don't read docs and don't know how to use Google. What does the print function do?
On 2014-11-10, sohcahto...@gmail.com sohcahto...@gmail.com wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. That's the saddest troll I've seen in ages. -- Grant Edwards grant.b.edwardsYow! I just forgot my whole at philosophy of life!!! gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: What does zip mean?
On 10Nov2014 17:19, Grant Edwards invalid@invalid.invalid wrote: On 2014-11-10, giacomo boffi giacomo_bo...@inwind.it wrote: To help you understanding what is the `zip` builtin, please forget about PKZip etc and think about the _zip fastener_ or _zipper_ in your bag or in your trousers In the bag you have two sequences of teeth that the zipper binds together in interlocking pairs No, you don't. That's not how a zipper works. Each tooth from side A, isn't bound with one from side B. It's bound with _two_ of them from side B. And each of those is in turn bound with an additional tooth from side A, and so on... This is true, but the analogy is still the correct one:-) Your nitpicking will not help the OP. Cheers, Cameron Simpson c...@zip.com.au WFO: the normal throttle position for Denizens, squids, and unfortunates on 50cc Honda step-throughs. -- https://mail.python.org/mailman/listinfo/python-list
Re: I don't read docs and don't know how to use Google. What does the print function do?
On Mon, 10 Nov 2014 10:56:18 -0800, sohcahtoa82 wrote: ... I know software engineers make lots of money so I want to be one. I hear that pretty boy male escorts can make even more money than software engineers. They also don't need to learn how to program, which is something software engineers do need to do, so it sounds as if you'd be better off signing up with an escort agency. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: I don't read docs and don't know how to use Google. What does the print function do?
On Monday, November 10, 2014 1:01:05 PM UTC-8, Grant Edwards wrote: On 2014-11-10, sohcahtoa82 sohcahtoa82 wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. That's the saddest troll I've seen in ages. Either you and I have a different definition of what a troll is, or your ability to detect parody and recognize a joke is a bit off. -- https://mail.python.org/mailman/listinfo/python-list
Re: I don't read docs and don't know how to use Google. What does the print function do?
On Mon, Nov 10, 2014 at 2:45 PM, sohcahto...@gmail.com wrote: On Monday, November 10, 2014 1:01:05 PM UTC-8, Grant Edwards wrote: On 2014-11-10, sohcahtoa82 sohcahtoa82 wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. That's the saddest troll I've seen in ages. Either you and I have a different definition of what a troll is, or your ability to detect parody and recognize a joke is a bit off. The former, probably. It may have been amusing, but it was nonetheless an off-topic post seeking to get a reaction, i.e. a troll. -- https://mail.python.org/mailman/listinfo/python-list
Re: ssl error with the python mac binary
In article CACgdh2iG9+cLjj7mZ7qeALQd==pcrknnv8i_eerj6ahjvg3...@mail.gmail.com, Paul Wiseman poal...@gmail.com wrote: I've been using the latest mac ppc/i386 binaries from python.org (https://www.python.org/ftp/python/2.7.8/python-2.7.8-macosx10.5.dmg). From what I can tell this version is linked against a pretty old version of OpenSSL (OpenSSL 0.9.7l 28 Sep 2006) which doesn't seem to be able to handle new sha-256 certificates. For example I'm unable to use pip (I guess the certificate was updated recently) Yes, the current python.org certificate does seem to cause problems for that version of OpenSSL, unfortunately. Am I right in thinking this is an issue with the build of python itself? Is there a way I can upgrade the version of OpenSSL linked with python- or force the python build to look elsewhere for the library? Or will I have to build my own from source? In the Pythons from the python.org OS X installers, the Python _ssl and _hashlib extension modules are dynamically linked with the system-supplied OpenSSL libraries. If actually running on OS X 10.5, one would have to rebuild _ssl.so and _hashlib.so, linking them with a locally-supplied version of a newer OpenSSL, since different versions of OpenSSL are not ABI-compatible, e.g. 0.9.7 vs 0.9.8 vs 1.0.1. If running on OS X 10.6 or later, another option might be to install from the 64-bit/32-bit installer which is a good idea to do anyway. For pip usage, a workaround would be to manually download distributions from PyPI (or elsewhere) using a web browser and then use pip to install from the downloaded file. The next version of pip is expected to have a --no-check-certificate option that bypasses the certificate check at the cost of reduced security. For the upcoming Python 2.7.9 release (planned for early December), I intend to have the Pythons in the python.org OS X installers use their own versions of OpenSSL and thus no longer depend on the now-deprecated system OpenSSL. -- Ned Deily, n...@acm.org -- https://mail.python.org/mailman/listinfo/python-list
Re: I don't read docs and don't know how to use Google. What does the print function do?
On 2014-11-10 20:16, Ethan Furman wrote: On 11/10/2014 11:59 AM, Larry Martell wrote: On Mon, Nov 10, 2014 at 2:49 PM, Roy Smith r...@panix.com wrote: In article b509998d-c547-4638-8810-0388c0894...@googlegroups.com, sohcahto...@gmail.com wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know software engineers make lots of money so I want to be one. This post is a sine of the times. Don't go off on a tangent. Please! We don't need all this hyperbole! ... cos it's off-topic. -- https://mail.python.org/mailman/listinfo/python-list
What does (?Pname) pattern syntax do?
What does ?P and part1 match in the following piece of code? re.search('(?Ppart1\w*)/(?Ppart2\w*)', '...aaa/bbb/ccc]').groups() -- https://mail.python.org/mailman/listinfo/python-list
Re: What does (?Pname) pattern syntax do?
satishmlm...@gmail.com writes: What does ?P and part1 match in the following piece of code? Learn about Python's regular expression features from the documentation URL:https://docs.python.org/3/library/re.html. Experiment with regular expressions using online tools such as URL:https://pythex.org/. -- \ “From the moment I picked your book up until I laid it down I | `\was convulsed with laughter. Someday I intend reading it.” | _o__)—Groucho Marx | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: What does zip mean?
On 11/10/2014 3:36 PM, Cameron Simpson wrote: On 10Nov2014 17:19, Grant Edwards invalid@invalid.invalid wrote: On 2014-11-10, giacomo boffi giacomo_bo...@inwind.it wrote: To help you understanding what is the `zip` builtin, please forget about PKZip etc and think about the _zip fastener_ or _zipper_ in your bag or in your trousers In the bag you have two sequences of teeth that the zipper binds together in interlocking pairs No, you don't. That's not how a zipper works. Each tooth from side A, isn't bound with one from side B. It's bound with _two_ of them from side B. And each of those is in turn bound with an additional tooth from side A, and so on... This is true, but the analogy is still the correct one:-) Perhaps ironically in this context, zippers replaced hook-and-eye fastening, where the two sequences *are* matched in parallel. Hookless fastener was one of the original names (Wikipedia). -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Natural use of cmp= in sort
On Monday, 10 November 2014 19:44:39 UTC, Ian wrote: On Mon, Nov 10, 2014 at 12:19 PM, Peter Otten xxx@yyy wrote: I'm not sure this works. I tried: Here's a simpler failure case. ineq = f2 f3 ... f3 f1 [Previously posted code elided] greater_thans set([('f3', 'f1'), ('f2', 'f3')]) sorted(all_f, cmp=lambda t1, t2: 0 if t1==t2 else ... (1 if (t1, t2) not in greater_thans else -1)) ['f1', 'f2', 'f3'] Note that the greater_thans set is missing the implication by transitivity that f2 f1, so the given cmp function would inconsistently return -1 for both comparisons cmp('f1', 'f2') and cmp('f2', 'f1'). Thanks. I will look into this... -- https://mail.python.org/mailman/listinfo/python-list
Re: Natural use of cmp= in sort
On Monday, 10 November 2014 18:45:15 UTC, Paddy wrote: Hi, I do agree with Raymond H. about the relative merits of cmp= and key= in sort/sorted, but I decided to also not let natural uses of cmp= pass silently. In answering this question, http://stackoverflow.com/a/26850434/10562 about ordering subject to inequalities it seemed natural to use the cmp= argument of sort rather than key=. The question is about merging given inequalities to make 1 inequality such that the inequalities also stays true. Thanks Peter, Ian. I have modified my code to expand transitive relations and ask you to view it on stackoverflow via the original link (as posting code on newsgroups is an ugly hack). My main reason for the post to c.l.p remains though; it seems like a *natural* use of the cmp= comparator function to sorted rather than using key= . -- https://mail.python.org/mailman/listinfo/python-list
Re: Natural use of cmp= in sort
On Mon, Nov 10, 2014 at 8:09 PM, Paddy paddy3...@gmail.com wrote: On Monday, 10 November 2014 18:45:15 UTC, Paddy wrote: Hi, I do agree with Raymond H. about the relative merits of cmp= and key= in sort/sorted, but I decided to also not let natural uses of cmp= pass silently. In answering this question, http://stackoverflow.com/a/26850434/10562 about ordering subject to inequalities it seemed natural to use the cmp= argument of sort rather than key=. The question is about merging given inequalities to make 1 inequality such that the inequalities also stays true. Thanks Peter, Ian. I have modified my code to expand transitive relations and ask you to view it on stackoverflow via the original link (as posting code on newsgroups is an ugly hack). You still run into trouble though if the given inequalities don't provide enough information for a total ordering. E.g.: ' '.join(extract_relations(f4 f1 ... f2 f3)) 'f1 f2 f3 f4' By adding some debugging prints, we can see what cmp calls were made by the sort routine and what the results were: cmp('f2', 'f1') - 1 cmp('f3', 'f2') - 1 cmp('f4', 'f3') - 1 There is no information about the relative order of f2 and f1, so the cmp function just returns 1 there. f2 is known to be greater than f3, so that call correctly returns 1. There is again no information about the relative order of f4 and f3, so it again just returns 1. However, this is inconsistent with the first comparison that placed f1 f2, because it implies that f1 f4. As you can see, giving an inconsistent cmp function to sort produces bogus results. If you only have a partial ordering of the inputs, you need to make sure that the cmp function you provide is consistent with *some* total ordering. Another issue is that your expand_transitive_relations function is I think O(n**3 log n), which looks unattractive compared to the O(n**2) topological sort given in the other answers. Another advantage of the topological sort is that it will detect if the graph is cyclic (i.e. the input data itself is inconsistent), rather than just return a bogus output. My main reason for the post to c.l.p remains though; it seems like a *natural* use of the cmp= comparator function to sorted rather than using key= . There are cases where a cmp function is more natural than a key function, but for these we have the functools.cmp_to_key adapter. -- https://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] Dinamically set __call__ method
On Sat, Nov 8, 2014 at 3:31 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: (BTW, I'm actually surprised that this technique makes c callable. There must be more going on that just look up __call__ in the class object, because evaluating C.__call__ just returns the descriptor and doesn't invoking the descriptor mechanism.) But of course it doesn't just lookup C.__call__, because it has to bind the method to the instance before calling it, which means invoking the descriptor protocol. The actual lookup is more like: type(a).__dict__['__call__'].__get__(a, type(a)) -- https://mail.python.org/mailman/listinfo/python-list
Re: Natural use of cmp= in sort
On Tuesday, 11 November 2014 06:37:18 UTC, Ian wrote: On Mon, Nov 10, 2014 at 8:09 PM, Paddy paddyxxx-at-xmail.com wrote: On Monday, 10 November 2014 18:45:15 UTC, Paddy wrote: Hi, I do agree with Raymond H. about the relative merits of cmp= and key= in sort/sorted, but I decided to also not let natural uses of cmp= pass silently. In answering this question, http://stackoverflow.com/a/26850434/10562 about ordering subject to inequalities it seemed natural to use the cmp= argument of sort rather than key=. The question is about merging given inequalities to make 1 inequality such that the inequalities also stays true. Thanks Peter, Ian. I have modified my code to expand transitive relations and ask you to view it on stackoverflow via the original link (as posting code on newsgroups is an ugly hack). You still run into trouble though if the given inequalities don't provide enough information for a total ordering. E.g.: ' '.join(extract_relations(f4 f1 ... f2 f3)) 'f1 f2 f3 f4' By adding some debugging prints, we can see what cmp calls were made by the sort routine and what the results were: cmp('f2', 'f1') - 1 cmp('f3', 'f2') - 1 cmp('f4', 'f3') - 1 There is no information about the relative order of f2 and f1, so the cmp function just returns 1 there. f2 is known to be greater than f3, so that call correctly returns 1. There is again no information about the relative order of f4 and f3, so it again just returns 1. However, this is inconsistent with the first comparison that placed f1 f2, because it implies that f1 f4. As you can see, giving an inconsistent cmp function to sort produces bogus results. If you only have a partial ordering of the inputs, you need to make sure that the cmp function you provide is consistent with *some* total ordering. Another issue is that your expand_transitive_relations function is I think O(n**3 log n), which looks unattractive compared to the O(n**2) topological sort given in the other answers. Another advantage of the topological sort is that it will detect if the graph is cyclic (i.e. the input data itself is inconsistent), rather than just return a bogus output. My main reason for the post to c.l.p remains though; it seems like a *natural* use of the cmp= comparator function to sorted rather than using key= . There are cases where a cmp function is more natural than a key function, but for these we have the functools.cmp_to_key adapter. Thanks Ian. The original author states ...and it is sure that the given inputs will give an output, i.e., the inputs will always be valid., which could be taken as meaning that all inputs are sufficient, well formed, and contain all relations as their first example does. In that case, expand_transitive_relations is not even needed. Lets say it isn't for the sake of argument, then we are left with the direct use of cmp= versus a conversion to a key= function. It seems to me that *in this case* the cmp= function naturally flows from the solution algorithm and that cmp_to_key is less so. Yes, I knew that there are cases where a cmp function is more natural than key; the idea is to squirrel out a few. We have already made the, (well reasoned in my opinion), decision to go down the key= route in Python 3. I also like to track where my algorithms might originally map to cmp=. (It is not often). My only other case of this type is here: http://stackoverflow.com/questions/15797120/can-this-cmp-function-be-better-written-as-a-key-for-sorted. -- https://mail.python.org/mailman/listinfo/python-list
[issue22434] Use named constants internally in the re module
Roundup Robot added the comment: New changeset fc7dbba57869 by Serhiy Storchaka in branch 'default': Issue #22434: Constants in sre_constants are now named constants (enum-like). https://hg.python.org/cpython/rev/fc7dbba57869 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22434 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22824] Update reprlib to use set literals
Serhiy Storchaka added the comment: The repr of empty array() should be fixed too. -- nosy: +serhiy.storchaka Added file: http://bugs.python.org/file37165/issue22824_3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22824 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21301] pathlib missing Path.expandvars(env=os.environ)
Wolfgang Langner added the comment: expandvars(), and expanduser() is part of os.path. Boot functions are needed for path objects and very useful. And yes it is a simple string substitution but very common. -- nosy: +tds333 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21301 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19767] pathlib: iterfiles() and iterdirs()
Wolfgang Langner added the comment: Why not implement this pattern with def dirs(pattern) and def files(pattern) where both are a simple shortcut for (p for p in mypath.glob(pattern) if p is_file()) or is_dir() ? -- nosy: +tds333 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19767 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22821] Argument of wrong type is passed to fcntl()
Roundup Robot added the comment: New changeset 61e99438c237 by Serhiy Storchaka in branch '2.7': Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian https://hg.python.org/cpython/rev/61e99438c237 New changeset 45e8aed69767 by Serhiy Storchaka in branch '3.4': Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian https://hg.python.org/cpython/rev/45e8aed69767 New changeset 2d203a0b7908 by Serhiy Storchaka in branch 'default': Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian https://hg.python.org/cpython/rev/2d203a0b7908 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22821 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22821] Argument of wrong type is passed to fcntl()
Serhiy Storchaka added the comment: Fixed in 3.5 as part of 6e6532d313a1 as it was easier to integrate it as part of the Clinic patch. 6e6532d313a1 has introduced other bug (l was parsed to int). Changed to I for reasons described in the comment in fcntl_ioctl_impl(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22821 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22821] Argument of wrong type is passed to fcntl()
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka resolution: - fixed stage: commit review - resolved status: open - closed versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22821 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile
Ronald Oussoren added the comment: The environment variable itself cannot be removed from CPython, it is necessary to implement the correct behavior of pyvenv with framework builds of Python. That said, I do think that the environment variable should be unset as soon as possible in the CPython startup code to avoid accidentally affecting other interpreters. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22490 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22813] No facility for test randomisation
Michael Foord added the comment: The point is that it is easy to have unintentional dependencies between tests. Test a sets up some state that test b relies on. This means that test b passes, so long as test a has already run. This is bad, tests should be isolated - it also means you can break test b when you change test a. Randomising test run order means you discover these unintentional dependencies earlier. With test randomisation you ideally need the seed to be displayed as part of the test run, and you need to be able to run with a particular seed. This enables you to reproduce failures, or odd results, from any particular test run. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22813 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22827] Backport ensurepip to 2.7 (PEP 477)
Michael Foord added the comment: mock in the Python standard library is licensed under the PSF license. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22827 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22836] Broken Exception ignored in: message on exceptions in __repr__
New submission from Florian Bruhin: When there's an unraisable exception (e.g. in __del__), and there's an exception in __repr__ as well, PyErr_WriteUnraisable returns after writing Exception ignored in: immediately. I'd expect it to fall back to the default __repr__ instead. See the attached example script. Output with 3.4: === Obj === Exception ignored in: bound method Obj.__del__ of __main__.Obj object at 0x7fd842deb4a8 Traceback (most recent call last): File test.py, line 4, in __del__ raise Exception('in del') Exception: in del === BrokenObj === Exception ignored in: (no newline) Output with 2.7: === Obj === Exception Exception: Exception('in del',) in bound method Obj.__del__ of __main__.Obj object at 0x7fa824dbfa50 ignored === BrokenObj === Exception Exception: Exception('in del',) in ignored The output with 2.7 is a bit more useful, but still confusing. -- components: Interpreter Core files: repr_exception.py messages: 230950 nosy: The Compiler priority: normal severity: normal status: open title: Broken Exception ignored in: message on exceptions in __repr__ type: behavior versions: Python 2.7, Python 3.4 Added file: http://bugs.python.org/file37166/repr_exception.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22836 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12728] Python re lib fails case insensitive matches on Unicode data
Roundup Robot added the comment: New changeset 4caa695af94c by Serhiy Storchaka in branch '2.7': Issue #12728: Different Unicode characters having the same uppercase but https://hg.python.org/cpython/rev/4caa695af94c New changeset 47b3084dd6aa by Serhiy Storchaka in branch '3.4': Issue #12728: Different Unicode characters having the same uppercase but https://hg.python.org/cpython/rev/47b3084dd6aa New changeset 09ec09cfe539 by Serhiy Storchaka in branch 'default': Issue #12728: Different Unicode characters having the same uppercase but https://hg.python.org/cpython/rev/09ec09cfe539 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12728 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12728] Python re lib fails case insensitive matches on Unicode data
Serhiy Storchaka added the comment: This solution (with hardcoded table of equivalent lowercases) is temporary. In future re engine will be changed to support correct caseless matching of different lowercase forms internally. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12728 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22578] Add additional attributes to re.error
Ezio Melotti added the comment: LGTM. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22578 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22837] getpass returns garbage when typing tilde on Windows with deadkeys
New submission from Florian Bruhin: When using getpass.getpass() on Windows and typing a tilde (~) with a layout with dead keys (e.g. Swiss German), one would typically type ~ to get a single tilde. However, this returns '\x00\x83~' with getpass. It seems this is what msvcrt.getch() returns. Microsofts documentation at http://msdn.microsoft.com/en-us/library/aa297934(v=vs.60).aspx only says When reading a function key or an arrow key, _getch and _getche must be called twice; the first call returns 0 or 0xE0, and the second call returns the actual key code. which doesn't really apply to this. It seems to work fine with other dead keys like ` or ^. Unless someone knows more about what's happening here I'd suggest replacing '\x00\x83~' by '~' in getpass. -- components: Library (Lib) messages: 230954 nosy: The Compiler, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: getpass returns garbage when typing tilde on Windows with deadkeys type: behavior versions: Python 2.7, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22837 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22836] Broken Exception ignored in: message on exceptions in __repr__
Martin Panter added the comment: This is one that has often bugged me. When your repr() implementation is broken, it is quite confusing figuring out what is going wrong. Falling back to object.__repr__() is one option, however I would probably be happy with a simple “exception in repr()” message, and a proper newline. Another way that I have come across this is: $ python -c 'import sys; sys.stdout.detach()' Exception ignored in: [no newline] The workaround there is to set sys.stdout = None. In that case I think repr(sys.stdout) is trying to say “ValueError: underlying buffer has been detached”. -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22836 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21724] resetwarnings doesn't reset warnings registry
Changes by Robert Muil robertm...@gmail.com: -- nosy: +robertmuil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21724 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22836] Broken Exception ignored in: message on exceptions in __repr__
Changes by Florian Bruhin python@the-compiler.org: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22836 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22837] getpass returns garbage when typing tilde on Windows with deadkeys
Changes by Florian Bruhin python@the-compiler.org: -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22837 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22578] Add additional attributes to re.error
Roundup Robot added the comment: New changeset 292c4d853662 by Serhiy Storchaka in branch 'default': Issue #22578: Added attributes to the re.error class. https://hg.python.org/cpython/rev/292c4d853662 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22578 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22431] Change format of test runner output
Michael Foord added the comment: I agree with Robert that the text output of the default runner should not be considered a part of the api that we make backwards compatible guarantees about. People who want to customise that should be customising the text runner/result. (Unfortunately it requires tinkering with both at the moment.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22431 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22578] Add additional attributes to re.error
Roundup Robot added the comment: New changeset 07f082b200a7 by Serhiy Storchaka in branch 'default': Fixed IDLE tests after changing re error messages (issue #22578). https://hg.python.org/cpython/rev/07f082b200a7 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22578 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22198] Odd floor-division corner case
Petr Viktorin added the comment: ping, could someone please review the patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22198 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22578] Add additional attributes to re.error
Serhiy Storchaka added the comment: Thank you Ezio for your review. -- assignee: - serhiy.storchaka resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22578 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22837] getpass returns garbage when typing tilde on Windows with deadkeys
Florian Bruhin added the comment: Maybe this is related: U+0083 is the no break here char: http://www.fileformat.info/info/unicode/char/0083/index.htm http://en.wikipedia.org/wiki/C0_and_C1_control_codes#C1_set From wikipedia: Follows the graphic character that is not to be broken. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22837 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part
R. David Murray added the comment: This is a duplicate of issue 6302. Re-reading that issue (again), I'm not quite sure why we didn't fix it, but it may be too late to fix it now for backward compatibility reasons. Since that issue strayed off into other topics, I'm going to leave this one open to consider whether or not we can/should fix this. The new email API does avoid this problem, though. Is there a reason you are choosing not to use the new API? -- versions: -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22833 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22834] Unexpected FileNotFoundError when current directory is removed
R. David Murray added the comment: Looks like importlib doesn't handle the case of a directory on the path being deleted? If so, I'm surprised this hasn't been reported before. -- nosy: +brett.cannon, eric.snow, r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22834 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22835] urllib2/httplib is rendering 400s for every authenticated-SSL request, suddenly
R. David Murray added the comment: If you haven't updated Python, then it is hard to see how this could be a python bug. Not impossible, but you'll have to narrow down the problem before you'd be able to demonstrate it as a python bug, I'm afraid. If you want help diagnosing this, you might try the python-list mailing list, though it sounds like a nginx forum might be equally useful at this stage (determining what exactly is going on protocol wise that is different between your two test cases). -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22835 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22836] Broken Exception ignored in: message on exceptions in __repr__
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22836 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22364] Improve some re error messages using regex for hints
Serhiy Storchaka added the comment: Here is a patch which makes re error messages match regex. It doesn't look to me that all these changes are enhancements. -- keywords: +patch Added file: http://bugs.python.org/file37167/re_errors_regex.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22364 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22838] Convert re tests to unittest
New submission from Serhiy Storchaka: Current re tests consists of two parts. One part use unittest and other part import test cases from Lib/test/re_tests.py, checks conditions and prints messages to stdout if they are false. Proposed patch converts all test_re to using unittest. -- assignee: serhiy.storchaka components: Regular Expressions, Tests files: re_tests.patch keywords: patch messages: 230966 nosy: ezio.melotti, mrabarnett, pitrou, serhiy.storchaka, zach.ware priority: normal severity: normal stage: patch review status: open title: Convert re tests to unittest type: enhancement versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file37168/re_tests.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22838 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11907] SysLogHandler can't send long messages
Domen Kožar added the comment: Note: same bug is relevant to DatagramHandler since it uses UDP transport. -- nosy: +iElectric ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11907 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22839] Incorrect link to statistics in tracemalloc documentation
New submission from Jonathan Sharpe: The link to statistics in the documentation for tracemalloc.Snapshot.compare_to (https://docs.python.org/3/library/tracemalloc.html#tracemalloc.Snapshot.compare_to) should be to the statistics method (https://docs.python.org/3/library/tracemalloc.html#tracemalloc.Snapshot.statistics), per the description, not to the statistics module (https://docs.python.org/3/library/statistics.html#module-statistics), where it currently points. -- assignee: docs@python components: Documentation messages: 230968 nosy: docs@python, jonrsharpe priority: normal severity: normal status: open title: Incorrect link to statistics in tracemalloc documentation versions: Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22839 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22800] IPv6Network constructor sometimes does not recognize legitimate netmask
pmoody added the comment: # We only support CIDR for IPv6, because expanded netmasks are not # standard notation. Yes, that's correct. I can double check this, but when I wrote ipaddress, I had yet to encounter a v6 netmask in anything other than cider notation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22800 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22800] IPv6Network constructor sometimes does not recognize legitimate netmask
pmoody added the comment: Hey Chris, What's the usecase for this? the netmask notation doesn't appear to be common for v6 (at all), so I'm hesitant to add support for this if it's just something like an academic exercise. Cheers, peter -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22800 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22800] IPv6Network constructor sometimes does not recognize legitimate netmask
Chris PeBenito added the comment: I understand the resistance; I'm fine closing this as won't implement, though this is not for academic use. In a nutshell, my package currently has a set of classes to represent an SELinux policy, and the SELinux policy language represents networks with extended netmask[1]. I control the package, so I can change the internal representation from extended netmask to CIDR, so it's not the end of the world. [1] example statement: nodecon ff00:: ff00:: system_u:object_r:multicast_node_t -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22800 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22800] IPv6Network constructor sometimes does not recognize legitimate netmask
pmoody added the comment: If you have the ability to use cidr, then closing this as wontfix is my preference. I've heard that there might be some network vendors that are starting support the mask notation for v6 addresses though, so this may end up getting implemented at some point in future anyway. -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22800 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22581] Other mentions of the buffer protocol
Serhiy Storchaka added the comment: Here is a patch which fixes remnants. It also corrects descriptions of parsing arguments format units. -- keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file37169/bytes_like.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22581 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22839] Incorrect link to statistics in tracemalloc documentation
Roundup Robot added the comment: New changeset 387bbada31e8 by Berker Peksag in branch '3.4': Issue #22839: Fix Snapshot.statistics() link. https://hg.python.org/cpython/rev/387bbada31e8 New changeset 524a004e93dd by Berker Peksag in branch 'default': Issue #22839: Fix Snapshot.statistics() link. https://hg.python.org/cpython/rev/524a004e93dd -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22839 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22839] Incorrect link to statistics in tracemalloc documentation
Berker Peksag added the comment: Fixed. Thanks for the report, Jonathan. -- nosy: +berker.peksag resolution: - fixed stage: - resolved status: open - closed type: - behavior versions: -Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22839 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part
py.user added the comment: R. David Murray wrote: Is there a reason you are choosing not to use the new API? My program is for Python 3.x. I need to decode wild headers to pretty unicode strings. Now, I do it by decode_header() and try...except for AttributeError, since a unicode string has no .decode() method. I don't know what is new API, but I guess it's not compatible with Python 3.0. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22833 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22840] strpdate('20141110', '%Y%m%d%H%S') returns wrong date
New submission from Doug Gorley: strptime() is returning the wrong date if I try to parse today's date (2014-11-10) as a string with no separators, and if I ask strpdate() to look for nonexistent hour and minute fields. datetime.datetime.strptime('20141110', '%Y%m%d').isoformat() '2014-11-10T00:00:00' datetime.datetime.strptime('20141110', '%Y%m%d%H%M').isoformat() '2014-01-01T01:00:00' -- components: Library (Lib) messages: 230977 nosy: dgorley priority: normal severity: normal status: open title: strpdate('20141110', '%Y%m%d%H%S') returns wrong date type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22840 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22835] urllib2/httplib is rendering 400s for every authenticated-SSL request, suddenly
Antoine Pitrou added the comment: No upgrades on the server either? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22835 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22840] strpdate('20141110', '%Y%m%d%H%S') returns wrong date
Ethan Furman added the comment: What result did you expect? -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22840 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22840] strpdate('20141110', '%Y%m%d%H%S') returns wrong date
Doug Gorley added the comment: I expected the second call to strpdate() to throw an exception, because %Y consumed '2014', %m consumed '11', and %d consumed '10', leaving nothing for %H and %M to match. That would be consistent with the first call. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22840 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part
R. David Murray added the comment: Certainly not with 3.0, but nobody in their right mind should be using that version any more :). The new API for decoding headers is available as of Python 3.3, with additional new API features in 3.4. See https://docs.python.org/3/library/email-examples.html#examples-using-the-provisional-api for an example. Note that although the API is 'provisional', I anticipate no non-trivial changes when it becomes final in 3.5. (The only API change that has happened has been done such that you get warnings if you use it wrong in 3.4, and is in a relatively obscure method (is_attachment). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22833 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com