Re: asyncio: What is the difference between tasks, futures, and coroutines?
On Fri, May 8, 2015 at 4:36 PM, Rustom Mody rustompm...@gmail.com wrote: On Friday, May 8, 2015 at 10:39:38 AM UTC+5:30, Chris Angelico wrote: Why have the concept of a procedure? On Friday, Chris Angelico ALSO wrote: With print(), you have a conceptual procedure... So which do you want to stand by? A procedure, in Python, is simply a function which returns None. That's all. It's not any sort of special concept. It doesn't need to be taught. If your students are getting confused by it, stop teaching it! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: asyncio: What is the difference between tasks, futures, and coroutines?
On Friday, May 8, 2015 at 10:39:38 AM UTC+5:30, Chris Angelico wrote: Why have the concept of a procedure? On Friday, Chris Angelico ALSO wrote: With print(), you have a conceptual procedure... So which do you want to stand by? Just to be clear I am not saying python should be any different on this front. Gödel's (2nd) theorem guarantees that no formalism (aka programming language in our case) can ever be complete and so informal borrowing is inevitable. Its just that Pascal, Fortran, Basic, by ingesting this informal requirement into the formal language make THIS aspect easier to learn/teach... ... at the cost of eleventeen others [Regular expressions in Fortran anyone?] -- https://mail.python.org/mailman/listinfo/python-list
[issue24000] More fixes for the Clinic mapping of converters to format units
Roundup Robot added the comment: New changeset 36d5e04b6cfa by Larry Hastings in branch 'default': Issue #24000: Improved Argument Clinic's mapping of converters to legacy https://hg.python.org/cpython/rev/36d5e04b6cfa -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24000 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24000] More fixes for the Clinic mapping of converters to format units
Larry Hastings added the comment: I think this is a definite improvement, so I've checked it in so I can move on. If you guys still want to talk about it, we can still change it before we hit beta. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24000 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API
Ben Finney ben+pyt...@benfinney.id.au: Chris Angelico ros...@gmail.com writes: On Fri, May 8, 2015 at 1:24 AM, Marko Rauhamaa ma...@pacujo.net wrote: That's Python's job. Abstracting away all those differences so you don't have to look at them. That's the difference between our opinions: you want Python to work the same on different OS's. I want Python's system programming facilities to closely mirror those of C. In that case, what you should do is devise an alternative language that compiles as a thin layer over C. […] But you don't want a high level language, if your greatest goal is closely mirror C. +1. Marko, you have many times criticised Python on the basis, essentially, that it is not some other platform. It's quite unproductive, and leads only to discussions that are at best frustrating for all involved. If you want a platform that is fundamentally different from Python, there are plenty available for you. Arguing that Python should be fundamentally different will not avail us anything good. I don't. Python *does* provide OS-dependent facilities. Somebody complained about that. I said Python was the way it should be, even though there are signs Python wants to become more Java-esque. For example, Python provides the errno module. Its use and meanings can be looked up with man pages. So Python has the great advantage that it *can* be used as a Linux system programming language. And I am. Marko -- https://mail.python.org/mailman/listinfo/python-list
Crochet 1.4.0: use Twisted anywhere!
Crochet is an MIT-licensed library that makes it easier to use Twisted from regular blocking code: from __future__ import print_function from twisted.names import client from crochet import setup, wait_for setup() @wait_for(timeout=5.0) def gethostbyname(name): Use the Twisted DNS library. d = client.lookupAddress(name) d.addCallback(lambda result: result[0][0].payload.dottedQuad()) return d if __name__ == '__main__': # Application code using the public API - notice it works in a normal # blocking manner, with no event loop visible: import sys name = sys.argv[1] ip = gethostbyname(name) print(name, -, ip) New in 1.4.0 is Python 3.4 support as well as support for using Crochet with uWSGI, and additional documentation on workarounds for various limitations of Crochet. https://pypi.python.org/pypi/crochet for downloads. https://crochet.readthedocs.org/ for documentation. --Itamar Turner-Trauring -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: gcc-python-plugin 0.14
gcc-python-plugin is a plugin for GCC 4.6 onwards which embeds the CPython interpreter within GCC, allowing you to write new compiler warnings in Python, generate code visualizations, etc. It ships with gcc-with-cpychecker, which implements static analysis passes for GCC aimed at finding bugs in CPython extensions. In particular, it can automatically detect reference-counting errors: http://gcc-python-plugin.readthedocs.org/en/latest/cpychecker.html This release adds support for GCC 5. Tarball releases are available at: https://fedorahosted.org/releases/g/c/gcc-python-plugin/ Prebuilt-documentation can be seen at: http://gcc-python-plugin.readthedocs.org/en/latest/index.html The project's homepage is: https://fedorahosted.org/gcc-python-plugin/ The plugin and checker are Free Software, licensed under the GPLv3 or later. Enjoy! Dave Malcolm -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: [pydotorg-www] www.python.org - Backend is unhealthy
On Fri, May 8, 2015 at 6:32 PM, Noah Kantrowitz n...@coderanger.net wrote: Cc'ing in the www list in case someone there knows, and I'll create a github issue to ping the people there. Should be recovering now. Thanks, yep, working for me now! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Boolean Operator Confusion
In article 553a5ded$0$12978$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 25 Apr 2015 12:50 am, subhabrata.bane...@gmail.com wrote: Dear Group, I am trying to understand the use of Boolean operator in Python. I am trying to write small piece of script, as follows, def input_test(): str1=raw_input(PRINT QUERY:) if AND or OR or NOT in str1: print It is a Boolean Query elif AND or OR or NOT not in str1: print It is not a Boolean Query else: print None First problem: why do you sometimes return None? You have two possible answers: either something is a boolean query, or it is not. There is no third choice. (It's a boolean query, but only on Wednesdays.) In the context of testcode where the OP is not knowing what is going on it is absolutely useful, and legit. His problem is that it is Wednesday and weird things happen. Steven -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst -- https://mail.python.org/mailman/listinfo/python-list
Why is array.array('u') deprecated?
Why is array.array('u') deprecated? Will we get an alternative for a character array or mutable unicode string? Thanks! Jonathan -- https://mail.python.org/mailman/listinfo/python-list
[issue24098] Multiple use after frees in obj2ast_* methods
paul added the comment: ping -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24098 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Simple Interactive Python Version Management for Managing Python 2, Python 3, and Development Builds
Hey all, Wrote a ~600 line Bash script that takes the pain out of managing Python versions (from 2.x.x to 3.x.x to development builds). Below are some more details. The entire project can be found on GitHub at https://github.com/qw3rtman/p. Let me know if you find it useful. :) p: Python Version Management, Simplified. = This GIF sums up the essence of p: http://i.imgur.com/rFrAIlc.gif. p is powerful and feature-packed, yet simple; both in setup and use. There are no tricky settings, options, or crazy dependencies. p is just a helpful ~600 line Bash script that gets the job done. p let's you quickly switch between Python versions whenever you need to, removing the barrier between Python 2.x.x and 3.x.x. p was heavily inspired by n, a version manager for Node.js. p is also great for getting started using Python development versions. Use p latest to get up and running with the latest development version of Python! Getting Started After the super painless drag-and-drop installation, you can start using p right away. Usage = Usage: p [COMMAND] [args] Commands: p Output versions installed p status Output current status p versionActivate to Python version p latest Activate to the latest Python release p stable Activate to the latest stable Python release p use version [args ...] Execute Python version with [args ...] p bin versionOutput bin path for version p rm version ... Remove the given version(s) p prev Revert to the previously activated version p ls Output the versions of Python available p ls latest Output the latest Python version available p ls stable Output the latest stable Python version available Options: -V, --version Output current version of p -h, --help Display help information Installation After downloading the Bash script, simply copy it over to your $PATH and p will take care of the rest. $ wget https://github.com/qw3rtman/p/releases/download/v0.1.0/p $ chmod +x p $ mv p /usr/local/bin If you don't have wget on your system, you can download the p binary from the releases page and follow the above steps from the second one onward. Updating === Simply follow the above steps and swap out the old Bash script with the new one! TODO = greater abstraction between Python 2.x.x and 3.x.x also manage pip per-directory/project Python version also manage PyPy FAQs How does p differ from pyenv? - p is designed for the average Python user. You can get up and running with the latest development build of Python with one simple command: p latest. No configuration is necessary; p manages everything for you. - On the other hand, pyenv is for the more advanced user who is comfortable configuring their Python environment to all their needs. p provides the basics in one easy to use aesthetically-pleasing command. - Additionally, p is easier to use. To switch your Python version, simply run p and you'll be presented with a list of installed Python versions to select from that you can scroll through with your arrow keys and select with the return key. - p is great at dealing with any version of Python. If it's not installed, running p versionwill download the source, configure it for your system, and compile it, all in one simple command. How does p work? - p stores each Python version installed in /usr/local/p/versions/python. When a Python version is activated, p creates a symbolic link to the Python binary located at/usr/local/p/versions/python/python. Since p prefixes the $PATH with/usr/local/p/versions/python, this version of python is found first; hence, it is used over the default version of Python installed on your system. How do I revert back to my default Python version? - Simply run p default and p will remove the symbolic link described above; therefore reverting back to your default Python version. Does p download the source each time I activate or install a version? - Nope. p stores the source for each of the versions installed, allowing for quick activations between already-installed versions. How do I get this working on Windows? - Unfortunately, p is not supported on Windows at the time. If you know of a workaround, send in a pull request! Let me know what you think. Thanks, -- Nimit Kalra ni...@nimitkalra.com | @qw3rtman http://www.nimitkalra.com -- https://mail.python.org/mailman/listinfo/python-list
Re: www.python.org - Backend is unhealthy
On Fri, May 8, 2015 at 6:17 PM, jarau...@skynet.be wrote: I cannot access www.python.org. I always get Error 503 Backend is unhealthy Backend is unhealthy Guru Mediation: Details: cache-ams4149-AMS 1431072956 2041303800 Varnish cache server Is it only me? No, it's not only you. I get the same but with different details: Details: cache-syd1627-SYD 1431073575 864283876 It looks to me as if my result is coming from a cache node in Sydney; yours is coming from some other cache node, so it's not just one node that's down. Cc'ing in the www list in case someone there knows, and I'll create a github issue to ping the people there. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[issue1322] Deprecate platform.dist() and platform.linux_distribution() functions
Marc-Andre Lemburg added the comment: Thanks, Berker, your patch looks fine. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1322 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Karlsruhe (Germany) Python User Group, May 15th 2015, 7pm
The Karlsruhe Python User Group (KaPy) meets again. Friday, 2015-05-15 (May 15th) at 19:00 (7pm) in the rooms of Entropia eV (the local affiliate of the CCC). See http://entropia.de/wiki/Anfahrt on how to get there. For your calendars: meetings are held monthly, on the 3rd Friday. There's also a mailing list at https://lists.bl0rg.net/cgi-bin/mailman/listinfo/kapy. -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Is this unpythonic?
Hi all I have often read about the gotcha regarding 'mutable default arguments' that frequently trips people up. I use them from time to time, but I have never had a problem. I have just delved a bit deeper to see if I am skating on thin ice. AFAICT my usage is safe. If I use a list as an argument, I only use it to pass values *into* the function, but I never modify the list. So if I omit the argument, the original default empty list is used, otherwise the list that I pass in is used. However, every time I look at my own code, and I see def x(y, z=[]): . it looks wrong because I have been conditioned to think of it as a gotcha. Would it be more pythonic to change them all to use the alternative z=None, or is it ok to leave it as it is? Or to phrase it differently, how would an experienced pythonista react on seeing this when reviewing my code? Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list
www.python.org - Backend is unhealthy
I cannot access www.python.org. I always get Error 503 Backend is unhealthy Backend is unhealthy Guru Mediation: Details: cache-ams4149-AMS 1431072956 2041303800 Varnish cache server Is it only me? Thanks for a hint, Helmut -- https://mail.python.org/mailman/listinfo/python-list
Re: Is this unpythonic?
On Fri, May 8, 2015 at 6:01 PM, Frank Millman fr...@chagford.com wrote: I have often read about the gotcha regarding 'mutable default arguments' that frequently trips people up. I use them from time to time, but I have never had a problem. I have just delved a bit deeper to see if I am skating on thin ice. AFAICT my usage is safe. If I use a list as an argument, I only use it to pass values *into* the function, but I never modify the list. So if I omit the argument, the original default empty list is used, otherwise the list that I pass in is used. In that case, you may want to consider using a default of () rather than [], unless there's some reason that it has to be a list. With a tuple, you have a guarantee that it's not going to be changed, so it's as safe as a default argument of True or 42 or Hello. That may or may not help, but it's worth considering, especially if all you really need is an iterable (or a sequence). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: [pydotorg-www] www.python.org - Backend is unhealthy
On May 8, 2015, at 10:28 AM, Chris Angelico ros...@gmail.com wrote: On Fri, May 8, 2015 at 6:17 PM, jarau...@skynet.be wrote: I cannot access www.python.org. I always get Error 503 Backend is unhealthy Backend is unhealthy Guru Mediation: Details: cache-ams4149-AMS 1431072956 2041303800 Varnish cache server Is it only me? No, it's not only you. I get the same but with different details: Details: cache-syd1627-SYD 1431073575 864283876 It looks to me as if my result is coming from a cache node in Sydney; yours is coming from some other cache node, so it's not just one node that's down. Cc'ing in the www list in case someone there knows, and I'll create a github issue to ping the people there. Should be recovering now. --Noah signature.asc Description: Message signed with OpenPGP using GPGMail -- https://mail.python.org/mailman/listinfo/python-list
[issue22906] PEP 479: Change StopIteration handling inside generators
Nick Coghlan added the comment: A couple of minor comments: * self.fail with an appropriate error message is a clearer way to indicate an incorrect logic path has been hit in a test case * the details of the exception chaining don't quite look right, as I believe raise X from Y sets both the cause and the context, with the suppress_context attribute set to turn off the display of the latter. I suggest checking that in Python code to confirm ny recollection, and then adjusting the test and implementation if necessary to match the Python level equivalent -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22906 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: [pydotorg-www] www.python.org - Backend is unhealthy
On Friday, 8 May 2015 10:32:21 UTC+2, Coderanger wrote: Should be recovering now. Thanks, it's fine here, as well. Helmut -- https://mail.python.org/mailman/listinfo/python-list
Re: Matlab to Python problem
Lesego Moloko wrote: I am a Python novice and have recently converted the attached Matlab file to Python (attached). The problem is that I cannot reproduce the Matlab plots (attached) with the converted Python program. I am also trying to go line by line through my converted Python file to see where the problem could be. I attached: 1. Matlab plots (5_p3.png and 4_p3.png) 2. The Matlab file (test.m) 3. Converted Python file (test.py) 4. data files (a2_all_out_P3.dat and t4_all_out.dat) You advise and assistance would be highly appreciated. Regards Your chance of getting help is higher with a smaller piece of code inlined in the text of your post and a description of the problem that is more concrete. I am also trying to go line by line through my converted Python file to see where the problem could be. Once you have located the problem you might follow up here or on the matplotlib mailing list. -- https://mail.python.org/mailman/listinfo/python-list
about Orthogonal series
hello, I read your article on the blog: http://jpktd.blogspot.com/ about orthogonal series estimation , I would like to ask you if you allow . First, I based on Article Sam Efromovich about Orthogonal series density estimates . he worked with the Fourier series with a compact support assumed [0,1], whose aim is to estimate the probability density function. and it is said in his Article that: The choice depends Primarily we of the carrier density. In general, When the real line (-∞, ∞) or the half line [0, ∞) are the support, Hermite and Laguerre Then series are recommended; 3,17,23,24 see Refs. If f: has a compact carrier, for instance [0, 1], Then trigonometric (or Fourier) series are recommended. my question is that if I wanted to draw my probability density function on a support [-2, -2] (because my data focus on -1 or 1) .What should I do? is that these results are necessarily just to support [0,1] for fourier series ? Cordially -- https://mail.python.org/mailman/listinfo/python-list
Re: Why is array.array('u') deprecated?
Le vendredi 8 mai 2015 12:29:15 UTC+2, Steven D'Aprano a écrit : On Fri, 8 May 2015 07:14 pm, jonathan.slenders wrote: Why is array.array('u') deprecated? Will we get an alternative for a character array or mutable unicode string? Good question. Of the three main encodings for Unicode, two are variable-width: * UTF-8 uses 1-4 bytes per character * UTF-16 uses 2 or 4 bytes per character while UTF-32 is fixed-width (4 bytes per character). So you could try faking it with a 32-bit array and filling it with string.encode('utf-32'). I guess that doesn't work. I need to have something that I can pass to the re module for searching through it. Creating new strings all the time is no option. (Think about gigabyte strings.) -- https://mail.python.org/mailman/listinfo/python-list
To pickle or not to pickle
I first used marshal in my filebasedMessages module. Then I read that you should not use it, because it changes per Python version and it was better to use pickle. So I did that and now I find: https://wiki.python.org/moin/Pickle Is it really that bad and should I change again? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list
Re: Bitten by my C/Java experience
In article mailman.96.1430761253.12865.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Tue, May 5, 2015 at 3:32 AM, Irmen de Jong irmen.nos...@xs4all.nl wrote: That is a broad question, but one thing that comes to mind is the current (python 3) behavior of integer division. It gives the exact result and doesn't truncate to integers: 5/4 1.25 Using the word exact around non-integer values can be a little ambiguous, since floats are often inexact. But yes, int/int - float, and yes, it WILL bite C programmers. This should not be presented as a somewhat arbitrary decision. Formerly we had 3e0/4e0 0.75 and 3/4 0 So the / operator worked on reals giving reals and integers giving integers. Great if you're used to it, but sometimes a pitfall. Also in practice it sometimes leads to rounding in unexpected places. The greatest disadvantage is when you have i and j and want their ratio. You have to do something like (real)i/j which feels unnatural. So we need two different division operators on the integers. Solution: introduce // for integer by integer given integer, giving the quotient (with a possible remainder). Now / is free to be used for the more rational i/j gives a ratio, i.e. a real number. Bottom line 3e0/4e0 and 3/4 gives the same result. It is nice to no longer have to be very careful in floating point calculation to avoid integer constants. On the other hand integer division is still available to solve the familiar egg-farm problems: I have 103 eggs. 12 eggs go in a box. How many boxes can I fill? (Similar problems crop up in graphics all the time.) ChrisA Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst -- https://mail.python.org/mailman/listinfo/python-list
Re: Is this unpythonic?
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote in message news:554c8b0a$0$12992$c3e8da3$54964...@news.astraweb.com... On Fri, 8 May 2015 06:01 pm, Frank Millman wrote: Hi all [...] However, every time I look at my own code, and I see def x(y, z=[]): . it looks wrong because I have been conditioned to think of it as a gotcha. It is a gotcha, and a code smell. http://www.joelonsoftware.com/articles/Wrong.html Interesting read - thanks. You can use it, but with care: code smells aren't necessarily wrong, they just need to be looked at a little more carefully. Would it be more pythonic to change them all to use the alternative z=None, or is it ok to leave it as it is? Or to phrase it differently, how would an experienced pythonista react on seeing this when reviewing my code? I would change it to z=None *unless* you actually required the list to be mutated, e.g. if you were using it as a cache. Ok, you and Joel have convinced me. I will change it to z=None. Does z have to be a list? Could you use an empty tuple instead? def x(y, z=()): ... That was Chris' suggestion as well (thanks Chris). The idea appealed to me, but then I found a situation where I pass in a dictionary instead of a list, so that would not work. Replacing them all with None is cleaner and, I now agree, more pythonic. Thanks for the good advice. Frank -- https://mail.python.org/mailman/listinfo/python-list
Re: To pickle or not to pickle
On Fri, 8 May 2015 07:58 pm, Cecil Westerhof wrote: I first used marshal in my filebasedMessages module. Then I read that you should not use it, because it changes per Python version and it was better to use pickle. So I did that and now I find: https://wiki.python.org/moin/Pickle Is it really that bad and should I change again? marshal is really only for Python's internal use. I think that if Python was created today, marshal would probably be an undocumented and internal-only module. pickle is quite safe provided you trust the environment you are running in and the source of the pickle files. If you don't trust them, then you should avoid pickle and use a format which doesn't execute code. You could use JSON, plists, ini-files, or XML, all of which are text-based and handled by the standard library. There is also YAML, but you have to use a third-party library for that. You might also look at the serpent serialisation format used by Pyro: https://pypi.python.org/pypi/serpent If your code is only going to be used by yourself, I'd just use pickle. If you are creating an application for others to use, I would spend the extra effort to build in support for at least pickle, JSON and plists, and let the user decide what they prefer. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
about orthogonal series
hello, I read your article on the blog: http://jpktd.blogspot.com/ about orthogonal series estimation , I would like to ask you if you allow . First, I based on Article Sam Efromovich about Orthogonal series density estimates . he worked with the Fourier series with a compact support assumed [0,1], whose aim is to estimate the probability density function. and it is said in his Article that: The choice depends Primarily we of the carrier density. In general, When the real line (-∞, ∞) or the half line [0, ∞) are the support, Hermite and Laguerre Then series are recommended; 3,17,23,24 see Refs. If f: has a compact carrier, for instance [0, 1], Then trigonometric (or Fourier) series are recommended. my question is that if I wanted to draw my probability density function on a support [-2, -2] (because my data focus on -1 or 1) .What should I do? is that these results are necessarily just to support [0,1] for fourier series ? Cordially TAHIRI Noria -- https://mail.python.org/mailman/listinfo/python-list
[issue23042] ctypes module doesn't build on FreeBSD, RHEL (x86) - Undefined symbol ffi_call_win32
Marc-Andre Lemburg added the comment: Here's a patch which I have tested on Linux, FreeBSD and Mac OS X. It solves the problem with compiling in Windows calls on non-Windows platforms and resynchronizes the ffi_raw_call() function with the ffi_call() implementation. Both functions had the same issue and the only difference between the two is the use of ffi_prep_args_raw instead of ffi_prep_args. As with davin's patch, this would need to be tested on Windows. -- Added file: http://bugs.python.org/file39321/ffi.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23042 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Is this unpythonic?
On Fri, 8 May 2015 06:01 pm, Frank Millman wrote: Hi all I have often read about the gotcha regarding 'mutable default arguments' that frequently trips people up. I use them from time to time, but I have never had a problem. I have just delved a bit deeper to see if I am skating on thin ice. AFAICT my usage is safe. If I use a list as an argument, I only use it to pass values *into* the function, but I never modify the list. So if I omit the argument, the original default empty list is used, otherwise the list that I pass in is used. However, every time I look at my own code, and I see def x(y, z=[]): . it looks wrong because I have been conditioned to think of it as a gotcha. It is a gotcha, and a code smell. http://www.joelonsoftware.com/articles/Wrong.html You can use it, but with care: code smells aren't necessarily wrong, they just need to be looked at a little more carefully. Would it be more pythonic to change them all to use the alternative z=None, or is it ok to leave it as it is? Or to phrase it differently, how would an experienced pythonista react on seeing this when reviewing my code? I would change it to z=None *unless* you actually required the list to be mutated, e.g. if you were using it as a cache. Does z have to be a list? Could you use an empty tuple instead? def x(y, z=()): ... -- Steven -- https://mail.python.org/mailman/listinfo/python-list
[issue7267] format method: c presentation type broken in 2.7
Serhiy Storchaka added the comment: May be just emit a warning in -3 mode? -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7267 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Encrypt python files
On Wed, 06 May 2015 00:23:39 -0700, Palpandi wrote: On Wednesday, May 6, 2015 at 12:07:13 PM UTC+5:30, Palpandi wrote: Hi, What are the ways to encrypt python files? No, I just want to hide the scripts from others. You can do that by deleting the scripts. Make sure you use a secure deletion tool. I'm not aware of any mechanism for encrypted executable python scripts. You can obfuscate the code, but you can't encrypt it because the python interpreter needs the script file to execute it. The same holds true for any mechanism designed to encrypt executable code regardless of whether it's script or compiled. At the lowest level the processor only understands the instruction set, and encrypted code has to be decrypted to execute. As the decryption method is always available to anyone who has legitimate access to execute the code, it's impossible to hide the code at that point. Example - if I give you an encrypted binary to run on your system, it either has to be unencryptable using tools you already have, or using a built in unencrypter, both of which you have access to and can use to unencrypt the encrypted executable code. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Why is array.array('u') deprecated?
On Fri, 8 May 2015 07:14 pm, jonathan.slend...@gmail.com wrote: Why is array.array('u') deprecated? Will we get an alternative for a character array or mutable unicode string? Good question. Of the three main encodings for Unicode, two are variable-width: * UTF-8 uses 1-4 bytes per character * UTF-16 uses 2 or 4 bytes per character while UTF-32 is fixed-width (4 bytes per character). So you could try faking it with a 32-bit array and filling it with string.encode('utf-32'). -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: To pickle or not to pickle
Cecil Westerhof wrote: I first used marshal in my filebasedMessages module. Then I read that you should not use it, because it changes per Python version and it was better to use pickle. So I did that and now I find: https://wiki.python.org/moin/Pickle Is it really that bad and should I change again? Let's say it the other way around: pickle is fine for short term storage when the generation of the file is under your control and you only need to access it from Python. Does that description fit your requirements? -- https://mail.python.org/mailman/listinfo/python-list
Re: Encrypt python files
On Tue, 05 May 2015 23:37:02 -0700, Palpandi wrote: What are the ways to encrypt python files? Depends why you want to encrypt them, and what you want to do with the encrypted files. Do you mean executable python code files, or do you mean data files generated by python. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
[issue24146] ast.literal_eval doesn't support the Python ternary operator
New submission from Larry Hastings: ast.literal_eval() supports all Python operators, yes? No. It doesn't support if/else, Python's ternary operator. Is there a reason it does not? I think it probably should. -- messages: 242760 nosy: benjamin.peterson, georg.brandl, larry priority: normal severity: normal stage: needs patch status: open title: ast.literal_eval doesn't support the Python ternary operator type: behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24146 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: multiprocessing, queue
On Sat, May 9, 2015 at 12:31 AM, Michael Welle mwe012...@gmx.net wrote: As a general rule, queues need to have both ends operating simultaneously, otherwise you're likely to have them blocking. In theory, your code should all work with ridiculously low queue sizes; the only cost will be concurrency (since you'd forever be waiting for the queue, so your tasks will all be taking turns). I tested this by changing the Queue() calls to Queue(1), and the code took about twice as long to complete. :) ;) I know, as you might guess it's not a real world example. It's just to explore the multiprocessing module. Sure, but even in a real-world example, it shouldn't ever be necessary to create huge queues. Larger queues allow for inconsistent performance of producer and/or consumer (eg if your consumer takes 1s to do each of 500 jobs, then 500s to do one job, it's capable of coping with a producer that puts one job on the queue every 2s, but only if the queue can handle ~250 jobs), but otherwise, the only effect of shrinking the queues is to force the processes into lock-step. Bigger queues mean that an over-performing producer will run you out of memory rather than get blocked. At very least, it should be a safe way to debug your logic - cut the queues down to just 2-3 elements each, and keep on printing out what's in the queue. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
IDLE Restoration
Dear Group, In many applications there is a facility to restore its previous sessions, especially if they close accidentally. Does IDLE have any such facility? If it is there, how may I use it? If someone may kindly suggest it. Regards, Subhabrata Banerjee. -- https://mail.python.org/mailman/listinfo/python-list
[issue16392] import crashes on circular imports in ext modules
Brett Cannon added the comment: https://www.python.org/dev/peps/pep-0489/ is trying to come up with a redesign of extension module loading and no one has submitted a patch for the documentation (although Stefan has inlined proposed wording in a comment). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16392 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Benjamin Peterson added the comment: I don't mind if you fix it in 2.7, too. (Sorry, I get a lot of bug related emails...) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Is this unpythonic?
On Fri, 8 May 2015 08:53 pm, Frank Millman wrote: Does z have to be a list? Could you use an empty tuple instead? def x(y, z=()): ... That was Chris' suggestion as well (thanks Chris). The idea appealed to me, but then I found a situation where I pass in a dictionary instead of a list, so that would not work. Why wouldn't it work? If it worked with an empty list, it will probably work with an empty tuple instead. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: multiprocessing, queue
On Fri, May 8, 2015 at 8:08 PM, Michael Welle mwe012...@gmx.net wrote: Hello, what's wrong with [0]? As num_tasks gets higher proc.join() seems to block forever. First I thought the magical frontier is around 32k tasks, but then it seemed to work with 40k tasks. Now I'm stuck around 7k tasks. I think I do something fundamentally wrong, but I can't find it. Regards hmw [0] http://pastebin.com/adfBYgY9 Your code's small enough to include inline, so I'm doing that: #!/usr/bin/python3 # -*- coding: utf-8 -*- from multiprocessing import Process, Queue class Foo(Process): def __init__(self, task_queue, result_queue): Process.__init__(self) self.result_queue = result_queue self.task_queue = task_queue def run(self): while True: n = self.task_queue.get() if n is None: break self.result_queue.put(1) return def main(): results = Queue() tasks = Queue() procs = [] num_procs = 8 num_tasks = 8000 for i in range(num_procs): proc = Foo(tasks, results) procs.append(proc) for proc in procs: proc.start() for i in range(num_tasks): tasks.put(i) for i in range(num_procs): tasks.put(None) for proc in procs: print(join) proc.join() while not results.empty(): result = results.get() print('Result: {}'.format(result)) if __name__ == '__main__': main() # -- end of code -- First thing I'd look at is the default queue size. If your result queue fills up, all processes will block until something starts retrieving results. If you really want to have all your results stay in the queue like that, you may need to specify a huge queue size, which may cost you a lot of memory; much better would be to have each job post something on the result queue when it's done, and then you wait till they're all done: from multiprocessing import Process, Queue def foo(task_queue, result_queue): while True: n = task_queue.get() if n is None: break result_queue.put(1) # Make sure None is not a possible actual result # Otherwise, create an object() to use as a flag. result_queue.put(None) def feed_tasks(num_tasks, num_procs, tasks): for i in range(num_tasks): tasks.put(i) for i in range(num_procs): tasks.put(None) def main(): results = Queue() tasks = Queue() num_procs = 8 num_tasks = 8000 procs = [Process(target=foo, args=(tasks, results)) for i in range(num_procs)] for proc in procs: proc.start() Process(target=feed_tasks, args=(num_tasks, num_procs, tasks)).start() while num_procs: result = results.get() if result is None: num_procs -= 1 else: print('Result: {}'.format(result)) for proc in procs: print(join) proc.join() if __name__ == '__main__': main() I've also made a few other changes (for instance, no need to subclass Process just to pass args), but the most important parts are a result_queue.put() just before the process ends, and switching the order of the result-queue-pump and process-join loops. That still might block, though, at the point where the tasks are being put onto the queue; so I've spun that off into its own process. (It might not be necessary, depending on how your tasks work.) But I tested this on 200,000 tasks (with the printing of results replaced with a simple counter), and it worked fine, churning through the work in about ten seconds. As a general rule, queues need to have both ends operating simultaneously, otherwise you're likely to have them blocking. In theory, your code should all work with ridiculously low queue sizes; the only cost will be concurrency (since you'd forever be waiting for the queue, so your tasks will all be taking turns). I tested this by changing the Queue() calls to Queue(1), and the code took about twice as long to complete. :) Hope that helps! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[issue21520] Erroneous zipfile test failure if the string 'bad' appears in pwd
Larry Hastings added the comment: Checked in, with the filter function on a separate line, to 3.4. Also merged into 3.5. -- resolution: - fixed stage: commit review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21520 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24146] ast.literal_eval doesn't support the Python ternary operator
R. David Murray added the comment: Right, this isn't a bug, it is that literal_eval is intended only to support *literals*, not expressions. See also issue 22525. -- nosy: +r.david.murray resolution: - not a bug stage: needs patch - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24146 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: functions, optional parameters
On Fri, 8 May 2015 09:59 pm, Michael Welle wrote: Hello, assume the following function definition: def bar(foo = []): print(foo: %s % foo) foo.append(foo) It doesn't work like one would expect (or as I would expect ;-)). As I understand it the assignment of the empty list to the optional parameter foo take place when the function object is created, not when it is called. I think from the perspective of a user this is very strange. I think it is perfectly expected. Do you think that Python will re-compile the body of the function every time you call it? Setting the default is part of the process of compiling the function. If we have this function definition: def spam(eggs=long_complex_calculation()): pass do you expect the long complex calculation to be repeated every time you call the function? How about this definition: default = 23 def spam(eggs=default): pass del default print spam() Do you expect the function call to fail because `default` doesn't exist? My answers to those questions are all No. To me, it is not only expected, but desirable that function defaults are set once, not every time the function is called. This behaviour is called early binding of defaults. The opposite behaviour is called late binding. If your language uses late binding, it is very inconvenient to get early binding when you want it. But if your language uses early binding, it is very simple to get late binding when you want it: just put the code you want to run inside the body of the function: # simulate late binding def spam(eggs=None): if eggs is None: # perform the calculation every time you call the function eggs = long_complex_calculation() default = 23 def spam(eggs=None): if eggs is None: # look up the global variable every time you call the function eggs = default On the rare times that you want to allow None as an ordinary value, you can create your own private sentinel value: _SENTINEL = object() def spam(eggs=_SENTINEL): if eggs is _SENTINEL: eggs = something_else -- Steven -- https://mail.python.org/mailman/listinfo/python-list
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Changes by Larry Hastings la...@hastings.org: -- assignee: ghaering - larry resolution: - fixed stage: needs patch - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Serhiy Storchaka added the comment: Is 2.7 affected? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: To pickle or not to pickle
Op Friday 8 May 2015 14:53 CEST schreef Chris Angelico: On Fri, May 8, 2015 at 9:55 PM, Cecil Westerhof ce...@decebal.nl wrote: Op Friday 8 May 2015 12:54 CEST schreef Steven D'Aprano: If your code is only going to be used by yourself, I'd just use pickle. If you are creating an application for others to use, I would spend the extra effort to build in support for at least pickle, JSON and plists, and let the user decide what they prefer. Well, I put it on GitHub, so I hope it is going to be used by others also. ;-) There are other things that are more urgent at the moment, but in the future I will implement JSON and plists then. But will the pickle files be shared? If not, they're still nice and private, and fairly safe. The problem comes when, for instance, you have a client Python program that pickles data and sends it over a network to a server Python program to be unpickled, because then someone could craft a malicious pickle and send it to you to eat. If they're only ever saved locally and re-read, there shouldn't be any security risk (anyone who could reach in and edit the pickle file could probably reach in and change the code anyway). I would expect not. But I never know what someone else is going to do. ;-) But in my case there is a Twitter directory with: quotes.txt quotes.pickle tips.txt tips.pickle All four files are normally only accessed by the Python program. When I want to extend the messages I use a text editor to append them. The .txt files contain messages that can be used. And the .pickle files contain the ‘recently’ used messages. When I unpickle quotes.pickle I get: [25, 112, 4, 18, 41, 2, 81, 75, 28, 60, 105, 47, 84, 65, 103, 42, 13, 66, 55, 124, 6, 82, 76, 12, 61, 113, 119, 96, 3, 68, 11, 89, 98, 107, 118, 29, 57, 33, 88, 121, 110, 49, 90, 72, 87, 114, 43, 59, 8, 92] Very simple indeed. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list
[issue22906] PEP 479: Change StopIteration handling inside generators
Yury Selivanov added the comment: Nick, Berker, Please see the updated patch. -- Added file: http://bugs.python.org/file39323/pep0479.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22906 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21520] Erroneous zipfile test failure if the string 'bad' appears in pwd
Roundup Robot added the comment: New changeset bff966aed6a3 by Larry Hastings in branch '3.4': Issue #21520: test_zipfile no longer fails if the word 'bad' appears https://hg.python.org/cpython/rev/bff966aed6a3 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21520 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Larry Hastings added the comment: I'm gonna fix this now. (I'm cleaning up some old issues I filed on the bug tracker this morning.) For 3.4, I'm just removing the PyObject *kwargs for those three functions that don't actually accept keyword arguments (METH_VARARGS) and aren't passed that parameter. That's a bug plain and simple, it's relying on undefined behavior, and it's better that we fix it. For 3.5. I'm adding a call to _PyArg_NoKeywords() to pysqlite_connection_call. Previously it simply ignored any/all keyword arguments; now it will complain if it is passed any. We don't need a deprecation cycle for that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: IDLE Restoration
On Sat, May 9, 2015 at 1:26 AM, subhabrata.bane...@gmail.com wrote: In many applications there is a facility to restore its previous sessions, especially if they close accidentally. Does IDLE have any such facility? If it is there, how may I use it? If someone may kindly suggest it. Generally the notion of session restore is a fairly limited one; for instance, a text editor might keep track of which files were opened (and maybe cursor positions), but not the actual contents. Web browsers tend to do a bit more than that (a good thing, since they crash more often than text editors do), but still generally depend on being able to retrieve most of the content from the origin server(s) on restart. Are you hoping to have the IDLE editor restore the fact that you had files X, Y, and Z open, or are you hoping to have the interactive interpreter retain your entire history of commands and their results? The former is reasonably plausible (and may well be possible already - Terry?), but the latter is quite impractical. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Is this unpythonic?
Dave Angel da...@davea.name wrote in message news:554ca652.1000...@davea.name... On 05/08/2015 06:53 AM, Frank Millman wrote: It might be appropriate to define the list at top-level, as EMPTY_LIST=[] and in your default argument as def x(y, z=EMPTY_LIST): and with the all-caps, you're thereby promising that nobody will modify that list. (I'd tend to do the None trick, but I think this alternative would be acceptable) Thanks, Dave, I like that idea. However, as you can see from my other replies, I have decided to go with the flow, and use the None trick. Frank -- https://mail.python.org/mailman/listinfo/python-list
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Roundup Robot added the comment: New changeset 4c860369b6c2 by Larry Hastings in branch '3.4': Issue #20274: Remove ignored and erroneous kwargs parameters from three https://hg.python.org/cpython/rev/4c860369b6c2 New changeset 3e9f4f3c7fa7 by Larry Hastings in branch 'default': Issue #20274: When calling a _sqlite.Connection, it now complains if passed https://hg.python.org/cpython/rev/3e9f4f3c7fa7 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16392] import crashes on circular imports in ext modules
R. David Murray added the comment: Yes, the resolution of this issue will be to add documentation. Someone should turn Stefan's comment into a patch. -- assignee: - docs@python components: +Documentation nosy: +docs@python, r.david.murray stage: - needs patch versions: +Python 3.5 -Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16392 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24146] ast.literal_eval doesn't support the Python ternary operator
Serhiy Storchaka added the comment: No it doesn't support all Python operators. ast.literal_eval('2*3') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.4/ast.py, line 84, in literal_eval return _convert(node_or_string) File /usr/lib/python3.4/ast.py, line 83, in _convert raise ValueError('malformed node or string: ' + repr(node)) ValueError: malformed node or string: _ast.BinOp object at 0xb6f8446c And shouldn't. It supports + and - only because they are needed for support of complex literals. It is unintentional side effect, that ast.literal_eval() supports not only 2+3j, but 2+3 too. -- nosy: +mark.dickinson, serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24146 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Changes by Larry Hastings la...@hastings.org: -- versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Larry Hastings added the comment: Yes, all those bugs exist in 2.7. However, Benjamin hasn't responded to this bug, so I assume he doesn't care and I should leave 2.7 alone. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
CFP: Workshop on Exascale Multi/many Core Computing Systems (E-MuCoCoS)
*** Paper submission deadline: June 22, 2015 *** Workshop on Exascale Multi/many Core Computing Systems (E-MuCoCoS) In conjunction with the 18th IEEE Conference on Computational Science and Engineering Porto, Portugal, October 21 - 23, 2015 http://homepage.lnu.se/staff/saplaa/e-mucocos15/ *** Workshop proceedings are published by the IEEE *** * CONTEXT Exascale computing will revolutionize computational science and engineering by providing 1000x the capabilities of currently available computing systems, while having a similar power footprint. The HPC community is working towards the development of the first Exaflop computer (expected around 2020) after reaching the Petaflop milestone in 2008. There are concerns that computer designs based on existing multi-core and many-core solutions will not scale to Exascale considering technical challenges (such as, productivity, energy consumption or reliability) and reasonable economic constraints. Therefore, novel multi-core and many-core solutions are required to reach Exascale. E-MuCoCoS will be organized in conjunction with the 18th IEEE Conference on Computational Science and Engineering (CSE 2015), Porto, Portugal, October 21 - 23, 2015. Previous editions of MuCoCoS workshop include: MuCoCoS 2014 (Porto, PT), MuCoCoS 2013 (Edinburgh, UK), MuCoCoS 2012 (SLC, US), MuCoCoS 2011 (Seoul, KR), MuCoCoS 2010 (Krakow, PL), MuCoCoS 2009 (Fukuoka, JP), MuCoCoS 2008 (Barcelona, ES). * TOPICS OF INTEREST E-MuCoCoS focuses on multi/many core languages, system software and architectural solutions towards Exascale computing systems. The topics of the workshop include but are not limited to: :: Methods and tools for preparing applications for Exascale :: Programming models, languages, libraries and compilation techniques :: Run-time systems and hardware support :: Patterns, algorithms and data structures :: Performance analysis, modeling, optimization and tuning * SUBMISSION GUIDELINES - The papers should be prepared using the IEEE format, and no longer than 6 pages. Submitted papers will be carefully evaluated based on originality, significance to workshop topics, technical soundness, and presentation quality. - Submission of the paper implies that should the paper be accepted, at least one of the authors will register and present the paper at the workshop. - Please submit your paper (as PDF) electronically using the online submission system. * IMPORTANT DATES - Submission: June 22, 2015 - Notification: July 28, 2015 - Camera ready: September 4, 2015 - Registration: September 4, 2015 - Workshop: October 21, 2015 * WORKSHOP CHAIR - Sabri Pllana, Linnaeus University, Sweden http://homepage.lnu.se/staff/saplaa/ -- https://mail.python.org/mailman/listinfo/python-list
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Serhiy Storchaka added the comment: I think the bug should be fixed in 2.7 (but not in 3.3 unless we get a crasher). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: To pickle or not to pickle
On Sat, May 9, 2015 at 12:34 AM, Cecil Westerhof ce...@decebal.nl wrote: When I unpickle quotes.pickle I get: [25, 112, 4, 18, 41, 2, 81, 75, 28, 60, 105, 47, 84, 65, 103, 42, 13, 66, 55, 124, 6, 82, 76, 12, 61, 113, 119, 96, 3, 68, 11, 89, 98, 107, 118, 29, 57, 33, 88, 121, 110, 49, 90, 72, 87, 114, 43, 59, 8, 92] Very simple indeed. In that case, I'd probably write it out as JSON, or as a simple whitespace-separated list of numbers. That way, if anything goes wrong, you can open up the file and look at it easily. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Why is array.array('u') deprecated?
Le vendredi 8 mai 2015 15:11:56 UTC+2, Peter Otten a écrit : So, this works perfectly fine and fast. But it scares me that it's deprecated and Python 4 will not support it anymore. Hm, this doesn't even work with Python 3: My mistake. I should have tested better. data = array.array(u, ux*1000) data[100] = y re.search(y, data) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.4/re.py, line 166, in search return _compile(pattern, flags).search(string) TypeError: can't use a string pattern on a bytes-like object You can search for bytes re.search(by, data) _sre.SRE_Match object; span=(400, 401), match=b'y' data[101] = z re.search(by, data) _sre.SRE_Match object; span=(400, 401), match=b'y' re.search(byz, data) re.search(by\0\0\0z, data) _sre.SRE_Match object; span=(400, 405), match=b'y\x00\x00\x00z' but if that is good enough you can use a bytearray in the first place. Maybe I'll try that. Thanks for the suggestions! Jonathan -- https://mail.python.org/mailman/listinfo/python-list
How to properly apply OOP in the bouncing ball code
I'm trying to apply OOP in this bouncing ball code in order to have multiple balls bouncing around the screen. The objective of this code is to create a method called settings, which controls all the settings for the screen and the bouncing behaviour of multiple balls, under the class Ball. However, I keep on getting errors related to attributes (e.g., speed). I'm new to OOP in Python so your help will be much appreciated. Thanks in advance. import pygame import random import sys pygame.init() class Ball: def __init__(self, X, Y): self.velocity = [1,1] self.ball_image = pygame.image.load (ball.jpg) self.ball_boundary = self.ball_image.get_rect () self.black = [0,0,0] self.width = 800 self.height = 600 self.num = 8 self.X = random.randint(0, self.width) self.Y = random.randint(0, self.height) def settings(self): #X = random.randint(0, self.width) #Y = random.randint(0, self.height) clock = pygame.time.Clock() size = self.width, self.height screen = pygame.display.set_mode(size) ball_boundary = self.ball_image.get_rect() speed = self.velocity pic = self.ball_image pygame.display.set_caption(Balls) num_balls = self.num ball_list = [] for i in range(num_balls): ball_list.append( Ball(random.randint(10, self.width-10),random.randint(10, self.height-10)) ) while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit(0) screen.fill(self.black) for balls in ball_list: if balls.ball_boundary.left 0 or balls.ball_boundary.right self.width: balls.speed[0] = -balls.speed[0] if balls.ball_boundary.top 0 or balls.ball_boundary.bottom self.height: balls.speed[1] = -balls.speed[1] balls.ball_boundary = balls.ball_boundary.move (self.velocity) screen.blit (balls.ball_image, balls.ball_boundary) pygame.display.flip() play = Ball(random.randint(0, 800), random.randint(0, 600)) play.settings() Message File Name LinePosition Traceback moduleC:\\Multiple_balls_TC.py63 settingsC:\\Multiple_balls_TC.py56 AttributeError: Ball instance has no attribute 'speed' -- https://mail.python.org/mailman/listinfo/python-list
Re: To pickle or not to pickle
Op Friday 8 May 2015 17:11 CEST schreef Chris Angelico: On Sat, May 9, 2015 at 12:34 AM, Cecil Westerhof ce...@decebal.nl wrote: When I unpickle quotes.pickle I get: [25, 112, 4, 18, 41, 2, 81, 75, 28, 60, 105, 47, 84, 65, 103, 42, 13, 66, 55, 124, 6, 82, 76, 12, 61, 113, 119, 96, 3, 68, 11, 89, 98, 107, 118, 29, 57, 33, 88, 121, 110, 49, 90, 72, 87, 114, 43, 59, 8, 92] Very simple indeed. In that case, I'd probably write it out as JSON, or as a simple whitespace-separated list of numbers. That way, if anything goes wrong, you can open up the file and look at it easily. Done. And the files are even smaller. ;-) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Larry Hastings added the comment: Benjamin: I assume you want the extraneous (and undefined behavior) kwargs parameters removed. Do you also want pysqlite_connection_call() to start calling _PyArg_NoKeywords()? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: How to properly apply OOP in the bouncing ball code
On May 8, 2015 9:46 AM, Tommy C tommyc168...@gmail.com wrote: I'm trying to apply OOP in this bouncing ball code in order to have multiple balls bouncing around the screen. The objective of this code is to create a method called settings, which controls all the settings for the screen and the bouncing behaviour of multiple balls, under the class Ball. However, I keep on getting errors related to attributes (e.g., speed). I'm new to OOP in Python so your help will be much appreciated. Thanks in advance. As the error says, the attribute does not exist. class Ball: def __init__(self, X, Y): self.velocity = [1,1] Here where you set it, you call it velocity. speed = self.velocity Here you create a local variable called speed, which you never use. if balls.ball_boundary.left 0 or balls.ball_boundary.right self.width: balls.speed[0] = -balls.speed[0] And here you look up an attribute of Ball called speed, which doesn't match the name you used in __init__. This is a muddled design overall. Your Ball class represents the individual balls bouncing around the screen. It should not also contain details about window size and the logic for the event loop. Use a separate class for that. Similarly, if the purpose of your settings method is to manage settings, why does it also contain all the bouncing logic? These should probably be separate methods. -- https://mail.python.org/mailman/listinfo/python-list
Re: IDLE Restoration
Chris Angelico wrote: Are you hoping to have the IDLE editor restore the fact that you had files X, Y, and Z open, or are you hoping to have the interactive interpreter retain your entire history of commands and their results? The former is reasonably plausible (and may well be possible already - Terry?), but the latter is quite impractical. Various shells do the latter. I do not see why that would be impractical, on the contrary. -- PointedEars Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail. -- https://mail.python.org/mailman/listinfo/python-list
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Benjamin Peterson added the comment: On Fri, May 8, 2015, at 12:08, Larry Hastings wrote: Larry Hastings added the comment: Benjamin: I assume you want the extraneous (and undefined behavior) kwargs parameters removed. Do you also want pysqlite_connection_call() to start calling _PyArg_NoKeywords()? Yes, please. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Roundup Robot added the comment: New changeset c91d135b0776 by Larry Hastings in branch '2.7': Issue #20274: When calling a _sqlite.Connection, it now complains if passed https://hg.python.org/cpython/rev/c91d135b0776 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20274] sqlite module has bad argument parsing code, including undefined behavior in C
Changes by Larry Hastings la...@hastings.org: -- versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20274 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: functions, optional parameters
On Sat, 9 May 2015 02:02 am, Chris Angelico wrote: On Sat, May 9, 2015 at 1:48 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On May 8, 2015 9:26 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Do you think that Python will re-compile the body of the function every time you call it? Setting the default is part of the process of compiling the function. To be a bit pedantic, that's not accurate. The default is evaluated when the function object is created, i.e. when the def statement is executed at runtime, not when the underlying code object is compiled. Aside from constructing two closures in the same context and proving that their __code__ attributes point to the same object, is there any way to distinguish between code object compilation time and def execution time? I just played around with it, and as far as I can tell, code objects are completely read-only. Sure there is. Write this Python code: # test.py print(Function definition time.) def func(): pass Now from your shell, run this: echo Compile time python -m compileall test.py rm test.py sleep 5 python test.pyc (The sleep is just to make it clear that the compilation and definition time can be very far apart. They could literally be years apart.) Actually, we don't need external tools, we can do it all in Python! py source = \ ... print Function definition time. ... def func(): ... pass ... py print Compile time.; code = compile(source, '', 'exec') Compile time. py exec(code) Function definition time. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: functions, optional parameters
On May 8, 2015 9:26 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Do you think that Python will re-compile the body of the function every time you call it? Setting the default is part of the process of compiling the function. To be a bit pedantic, that's not accurate. The default is evaluated when the function object is created, i.e. when the def statement is executed at runtime, not when the underlying code object is compiled. -- https://mail.python.org/mailman/listinfo/python-list
[issue23888] Fixing fractional expiry time bug in cookiejar
Demian Brecht added the comment: LGTM, thanks for the patch! -- nosy: +r.david.murray stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23888 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: IDLE Restoration
On Sat, May 9, 2015 at 2:06 AM, Thomas 'PointedEars' Lahn pointede...@web.de wrote: Chris Angelico wrote: Are you hoping to have the IDLE editor restore the fact that you had files X, Y, and Z open, or are you hoping to have the interactive interpreter retain your entire history of commands and their results? The former is reasonably plausible (and may well be possible already - Terry?), but the latter is quite impractical. Various shells do the latter. I do not see why that would be impractical, on the contrary. Exactly what do they recall? A textual form of the scrollback? That wouldn't be too hard. But what about all your working state - assigned globals, changed state of imported modules (eg random number seed), etc, etc, etc? An active Python session is a *lot* more than a shell session scrollback, because their results could literally be any Python objects. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: To pickle or not to pickle
On 8-5-2015 12:32, Peter Otten wrote: Cecil Westerhof wrote: I first used marshal in my filebasedMessages module. Then I read that you should not use it, because it changes per Python version and it was better to use pickle. So I did that and now I find: https://wiki.python.org/moin/Pickle Is it really that bad and should I change again? Let's say it the other way around: pickle is fine for short term storage when the generation of the file is under your control and you only need to access it from Python. The latter is not really a restriction, if you want to use it from Java or .NET. https://github.com/irmen/Pyrolite provides an (un)pickler for these platforms. -irmen -- https://mail.python.org/mailman/listinfo/python-list
Re: functions, optional parameters
On Sat, May 9, 2015 at 1:48 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On May 8, 2015 9:26 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Do you think that Python will re-compile the body of the function every time you call it? Setting the default is part of the process of compiling the function. To be a bit pedantic, that's not accurate. The default is evaluated when the function object is created, i.e. when the def statement is executed at runtime, not when the underlying code object is compiled. Aside from constructing two closures in the same context and proving that their __code__ attributes point to the same object, is there any way to distinguish between code object compilation time and def execution time? I just played around with it, and as far as I can tell, code objects are completely read-only. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: functions, optional parameters
On Sat, 9 May 2015 01:48 am, Ian Kelly wrote: On May 8, 2015 9:26 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Do you think that Python will re-compile the body of the function every time you call it? Setting the default is part of the process of compiling the function. To be a bit pedantic, that's not accurate. The default is evaluated when the function object is created, i.e. when the def statement is executed at runtime, not when the underlying code object is compiled. Yes, that is the pedantically correct version. Technically correct -- the best kind of correct. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
The script is very simple (abc.txt exists in ROOTDIR directory): import os import shutil ROOTDIR = 'C:\Users\zoran' file1 = os.path.join(ROOTDIR, 'abc.txt') file2 = os.path.join(ROOTDIR, 'def.txt') shutil.move(file1, file2) But it returns the following error: C:\Python34\python.exe C:/Users/bckslash_test.py File C:/Users/bckslash_test.py, line 4 ROOTDIR = 'C:\Users' ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \U escape Process finished with exit code 1 As I saw, I could solve the problem by changing line 4 to (small letter r before string: ROOTDIR = r'C:\Users\zoran' but that is not an option for me because I am using configparser in order to read the ROOTDIR from underlying cfg file. I need a mechanism to read the path string with single backslashes into a variable, but afterwards to escape every backslash in it. How to do that? -- https://mail.python.org/mailman/listinfo/python-list
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
On 2015-05-08 20:00, zljubisic...@gmail.com wrote: The script is very simple (abc.txt exists in ROOTDIR directory): import os import shutil ROOTDIR = 'C:\Users\zoran' file1 = os.path.join(ROOTDIR, 'abc.txt') file2 = os.path.join(ROOTDIR, 'def.txt') shutil.move(file1, file2) But it returns the following error: C:\Python34\python.exe C:/Users/bckslash_test.py File C:/Users/bckslash_test.py, line 4 ROOTDIR = 'C:\Users' ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \U escape Process finished with exit code 1 As I saw, I could solve the problem by changing line 4 to (small letter r before string: ROOTDIR = r'C:\Users\zoran' but that is not an option for me because I am using configparser in order to read the ROOTDIR from underlying cfg file. I need a mechanism to read the path string with single backslashes into a variable, but afterwards to escape every backslash in it. How to do that? If you're reading the path from a file, it's not a problem. Try it! -- https://mail.python.org/mailman/listinfo/python-list
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
On Fri, May 8, 2015, at 15:00, zljubisic...@gmail.com wrote: As I saw, I could solve the problem by changing line 4 to (small letter r before string: ROOTDIR = r'C:\Users\zoran' but that is not an option for me because I am using configparser in order to read the ROOTDIR from underlying cfg file. configparser won't have that problem, since escaping is only an issue for python source code. No escaping for backslashes is necessary in files read by configparser. import sys import configparser config = configparser.ConfigParser() config['DEFAULT'] = {'ROOTDIR': r'C:\Users\zoran'} config.write(sys.stdout) [DEFAULT] rootdir = C:\Users\zoran -- https://mail.python.org/mailman/listinfo/python-list
Re: How to properly apply OOP in the bouncing ball code
On Fri, 08 May 2015 08:40:34 -0700, Tommy C wrote: I'm trying to apply OOP in this bouncing ball code in order to have multiple balls bouncing around the screen. The objective of this code is to create a method called settings, which controls all the settings for the screen and the bouncing behaviour of multiple balls, under the class Ball. However, I keep on getting errors related to attributes (e.g., speed). I'm new to OOP in Python so your help will be much appreciated. Thanks in advance. I did something similar, with little characters running around the screen under joystick control. What I think: 1. Each instance of the Ball class should control the behaviour of one ball. 2. The screen settings and global environment generally should be global, not stuffed inside the behaviour of a Ball. 3. Keeping the list of Ball instances should be something the main section of your program does, not stuffed inside the behaviour of a Ball. Each of my little GamePlayer objects is subclassed from pygame.sprite.Sprite . I forget what I got by doing this (it's old code) but looking up the docs for that class might give you some insights. Each GamePlayer object has an update method which accepts info from the joystick and updates the player's movements, and a draw method which the main loop calls on displaying every frame, to show the player's new position and attitude. You might be able to do something along these lines. Mel. -- https://mail.python.org/mailman/listinfo/python-list
Re: IDLE Restoration
Chris Angelico wrote: […] Thomas 'PointedEars' Lahn […] wrote: Chris Angelico wrote: Are you hoping to have the IDLE editor restore the fact that you had files X, Y, and Z open, or are you hoping to have the interactive interpreter retain your entire history of commands and their results? The former is reasonably plausible (and may well be possible already - Terry?), but the latter is quite impractical. Various shells do the latter. I do not see why that would be impractical, on the contrary. Exactly what do they recall? “your entire history of commands” and A textual form of the scrollback? -- PointedEars Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail. -- https://mail.python.org/mailman/listinfo/python-list
Re: functions, optional parameters
On Sat, May 9, 2015 at 3:36 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 9 May 2015 02:02 am, Chris Angelico wrote: Aside from constructing two closures in the same context and proving that their __code__ attributes point to the same object, is there any way to distinguish between code object compilation time and def execution time? I just played around with it, and as far as I can tell, code objects are completely read-only. Sure there is. Write this Python code: py source = \ ... print Function definition time. ... def func(): ... pass ... py print Compile time.; code = compile(source, '', 'exec') Compile time. py exec(code) Function definition time. Yes, but can you *distinguish* them in terms of default argument versus code object creation? How do you know that the function's code object was created when compile() happened, rather than being created when the function was defined? Is there anything that lets you in any way show different behaviour based on that timing difference? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: functions, optional parameters
On Sat, 09 May 2015 03:49:36 +1000, Chris Angelico wrote: Yes, but can you *distinguish* them in terms of default argument versus code object creation? How do you know that the function's code object was created when compile() happened, rather than being created when the function was defined? Is there anything that lets you in any way show different behaviour based on that timing difference? This might show that default objects are fixed at run time: Python 2.7.3 (default, Mar 14 2014, 11:57:14) [GCC 4.7.2] on linux2 Type help, copyright, credits or license for more information. a = [] def b (arr=a): ... arr.append ('c') ... print repr(a) [] b() print repr(a) ['c'] b() print repr(a) ['c', 'c'] -- https://mail.python.org/mailman/listinfo/python-list
Direct client Requirement - Immediate Hire: ETL Developer
Hi, Hope your are doing great, Please find the requirement below and let me know you interest on this position on nagar...@intsystech.com or feel free to call me on my D:908-333-3534. Requirement: Role: ETL Developer Location: Boise Idaho Must be 10+ Years Experience . Should have strong knowledge in SQL Server database including SQL Queries, joins, functions, trigger, store procedure. . Should have strong knowledge of ETL concept. . Should have knowledge of SSIS Including Data flow component, control flow component, SSIS Logging, SSIS Configuration, SSIS Security. SSIS Error handling. . Should have knowledge of SSIS package deployment. . Experience in Product Life Cycle Management development projects. . Experience in agile, sprint development projects. . Should have knowledge in data warehouse concept. . Should have basic knowledge in scripting language like C# or VB. Thanks Best Regards? Raju International Systems Technologies Inc. 10 Corporate place south.| Suite 203 | Piscataway, NJ 08854 | D:908-333-3534 |Fax:732-348-9533| E-mail: nagar...@intsystech.com | G-talk: nagarajuusstaff...@gmail.com URL: www.intsystech.com -- https://mail.python.org/mailman/listinfo/python-list
[issue24078] inspect.getsourcelines ignores context and returns wrong line #
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23857] Make default HTTPS certificate verification setting configurable
Marc-Andre Lemburg added the comment: Changing the title to reflect that the solution to how to configure Python is still up in the air. I also started a thread on python-dev to get some more feedback. -- title: Make default HTTPS certificate verification setting configurable via global ini file - Make default HTTPS certificate verification setting configurable ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24129] Incorrect (misleading) statement in the execution model documentation
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24129 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21800] Implement RFC 6855 (IMAP Support for UTF-8) in imaplib.
Maciej Szulik added the comment: David, I've changed according to your suggestion, appreciate review. -- Added file: http://bugs.python.org/file39324/issue21800.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21800 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Thanks for clarifying. Looks like the error message was wrong. On windows ntfs I had a file name more than 259 characters which is widows limit. After cutting file name to 259 characters everything works as it should. If I cut file name to 260 characters I get the error from subject which is wrong. Anyway case closed, thank you very much because I was suspecting that something is wrong with configparser. Best regards. -- https://mail.python.org/mailman/listinfo/python-list
[issue24017] Implemenation of the PEP 492 - Coroutines with async and await syntax
Yury Selivanov added the comment: Another iteration: - support of new syntax in lib2to3 - collections.abc.Awaitable -- Added file: http://bugs.python.org/file39325/await_04.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24017 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23857] Make default HTTPS certificate verification setting configurable
Changes by Christian Heimes li...@cheimes.de: -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: A __call__ method which is itself another callable class instance?
On Fri, May 8, 2015 at 10:24 PM, Skip Montanaro skip.montan...@gmail.com wrote: The question for the esteemed gathering here: have you ever encountered the need for this class-instance-as-a-dunder-call-method before? Perhaps in some sort of code generation situation? Or cleaner functions-with-attributes? I've never actually done it, but there've been times when I've considered setting __call__ to be a class, rather than an actual function. (Though the time I wanted it, I was wanting to set __call__ on a module, and I ended up not bothering with the hassle that that entails.) Python classes are automatically factories of themselves [1], so there should be no difference between calling a class and calling a function that passes through to the class: foo = Bar @functools.wraps(Bar) def foo(*args, **kw): return Bar(*args, **kw) In fact, I would fully expect things like functools.wraps to work just fine on classes, types, and instances of classes with __call__ methods, just as they would with functions - in the same way that you'd expect a def function to work just as well as a lambda function. If your code _does_ get into an infinite loop, so would calling the function. I wouldn't see a problem with that being rewritten as while True, just to ensure the equivalencies. ChrisA [1] https://xkcd.com/387/ -- https://mail.python.org/mailman/listinfo/python-list
Re: To pickle or not to pickle
On Fri, May 8, 2015 at 9:55 PM, Cecil Westerhof ce...@decebal.nl wrote: Op Friday 8 May 2015 12:54 CEST schreef Steven D'Aprano: If your code is only going to be used by yourself, I'd just use pickle. If you are creating an application for others to use, I would spend the extra effort to build in support for at least pickle, JSON and plists, and let the user decide what they prefer. Well, I put it on GitHub, so I hope it is going to be used by others also. ;-) There are other things that are more urgent at the moment, but in the future I will implement JSON and plists then. But will the pickle files be shared? If not, they're still nice and private, and fairly safe. The problem comes when, for instance, you have a client Python program that pickles data and sends it over a network to a server Python program to be unpickled, because then someone could craft a malicious pickle and send it to you to eat. If they're only ever saved locally and re-read, there shouldn't be any security risk (anyone who could reach in and edit the pickle file could probably reach in and change the code anyway). That said, if your needs are sufficiently simple, it may be worth using something plain text just for the debuggability. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[issue24145] Support |= for parameters in converters
Raymond Hettinger added the comment: To my eyes, the current set notation form more clearly expresses its intentions than the |= notation. Readability counts. I agree the |= is a startling syntax that looks weird enough to cause a mental hiccup when reading it. So, put me down for a -1. The mild benefit isn't worth it. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24145 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24145] Support |= for parameters in converters
Serhiy Storchaka added the comment: For now str(accept={str, NoneType}) is used only 14 times in 6 files in 5 modules. The z format unit is used also in still not converted modules _codecs (a lot of sites), _locale, mmap, _multiprocessing, and _socket. Current syntax doesn't look so ugly for me. I would wait until we converted more modules and implemented more converters that don't match existing format units. Alternative syntax can be str | NoneType (without the accept parameter at all). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24145 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: asyncio: What is the difference between tasks, futures, and coroutines?
On Fri, May 8, 2015 at 9:53 PM, Dave Angel da...@davea.name wrote: One thing newbies get tripped up by is having some path through their code that doesn't explicitly return. And in Python that path therefore returns None. It's most commonly confusing when there are nested ifs, and one of the inner ifs doesn't have an else clause. Anyway, it's marginally more useful to that newbie if the compiler would produce an error instead of later seeing a runtime error due to an unexpected None result. I don't think Python would be improved by detecting such a condition and reporting on it. That's a job for a linter, or a style guide program. They're not hard for linters to notice. After all, there's a clear difference of intent between return (or just falling off the end of the function) and return None, even though they compile to the same byte code. Though if you start enforcing that in your checkin policy, you might have to deal with this kind of thing: def raise_with_code(code): raise SpamError(Error %d in spamination: %s % (code, errortext.get(code, unknown))) def spaminate_text(f): rc = low_level_spamination_function(f) if not rc: return low_level_get_spamination_result() raise_with_code(rc) Clearly one branch returns a value... but figuring out that the other one always raises isn't easy. (Though I suppose in this case it could be dealt with by having a function that constructs the error, and then you raise make_spam_error(rc) instead.) You're definitely right that Python shouldn't check for it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Is this unpythonic?
Ben Finney ben+pyt...@benfinney.id.au wrote in message news:85y4kzb90f@benfinney.id.au... Frank Millman fr...@chagford.com writes: If I use a list as an argument, I only use it to pass values *into* the function, but I never modify the list. You've had good reasons why a mutable default argument is a good idea. I'll address another aspect of the question: passing a structured collection of values via a single parameter. If those values *always* go together, it sounds like you have a class which should be defined to make it explicit that they go together. [...] Too much overhead? If you want to collect a meaningful collection of values together in the same way each time, but don't need any special behaviour, then a class might be overkill. Python has the 'namedtuple' type:: [...] URL:https://docs.python.org/3/library/collections.html#collections.namedtuple documents the surprisingly useful 'namedtuple' factory. Useful thoughts - thanks, Ben. Here is a typical use case. I have a function which constructs a sql SELECT statement from various input parameters. One of the parameters is used to build up an ORDER BY clause. If ordering is required, the caller passes a list of tuples, each tuple consisting of a column name and a boolean indicating ascending/descending. If no ordering is required, it is convenient for the caller to omit the argument altogether, but then the callee needs a default argument. Previously I had 'order=[]' as a keyword argument, but that gave rise to my query. I have now changed it to 'order=None'. Frank -- https://mail.python.org/mailman/listinfo/python-list
Re: Why is array.array('u') deprecated?
jonathan.slend...@gmail.com wrote: Can you expand a bit on how array(u) helps here? Are the matches in the gigabyte range? I have a string of unicode characters, e.g.: data = array.array('u', u'x' * 10) Then I need to change some data in the middle of this string, for instance: data[50] = 'y' Then I want to use re to search in this text: re.search('y', data) This has to be fast. I really don't want to split and concatenate strings. Re should be able to process it and the expressions can be much more complex than this. (I think it should be anything that implements the buffer protocol). So, this works perfectly fine and fast. But it scares me that it's deprecated and Python 4 will not support it anymore. Hm, this doesn't even work with Python 3: data = array.array(u, ux*1000) data[100] = y re.search(y, data) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.4/re.py, line 166, in search return _compile(pattern, flags).search(string) TypeError: can't use a string pattern on a bytes-like object You can search for bytes re.search(by, data) _sre.SRE_Match object; span=(400, 401), match=b'y' data[101] = z re.search(by, data) _sre.SRE_Match object; span=(400, 401), match=b'y' re.search(byz, data) re.search(by\0\0\0z, data) _sre.SRE_Match object; span=(400, 405), match=b'y\x00\x00\x00z' but if that is good enough you can use a bytearray in the first place. -- https://mail.python.org/mailman/listinfo/python-list