[ANN] PyWeek 18 will run in May (11th to 18th)
Hi all, The Python Game Programming Challenge http://pyweek.org/ will run its 18th challenge from the 11th to the 18th of May. The PyWeek challenge: 1. Invites entrants to write a game in one week from scratch either as an individual or in a team, 2. Is intended to be challenging and fun, 3. Will increase the public body of game tools, code and expertise, 4. Will let a lot of people actually finish a game, and 5. May inspire new projects (with ready made teams!) Check out the help page for how to compete (and prepare) and the growing resources message board post: http://pyweek.org/s/help/ http://pyweek.org/d/4008/ Richard -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Crochet 1.1.0 - Use Twisted anywhere!
Crochet is an MIT-licensed library that makes it easier for blocking or threaded applications like Flask or Django to use the Twisted networking framework. Crochet provides the following features: * Runs Twisted's reactor in a thread it manages. * The reactor shuts down automatically when the process' main thread finishes. * Hooks up Twisted's log system to the Python standard library logging framework. Unlike Twisted's built-in logging bridge, this includes support for blocking Handler instances. * A blocking API to eventual results (i.e. Deferred instances). This last feature can be used separately, so Crochet is also useful for normal Twisted applications that use threads. Downloads: https://pypi.python.org/pypi/crochet Documentation: https://crochet.readthedocs.org/en/latest/ *Trivial Example * Download a web page in a blocking manner. from __future__ import print_function import sys from twisted.web.client import getPage from crochet import setup, wait_for_reactor setup() @wait_for_reactor def download_page(url): return getPage(url) # download_page() now behaves like a normal blocking function: print(download_page(sys.argv[1])) *What's New in 1.1.0* Bug fixes: * EventualResult.wait() can now be used safely from multiple threads, thanks to Gavin Panella for reporting the bug. * Fixed reentrancy deadlock in the logging code caused by http://bugs.python.org/issue14976, thanks to Rod Morehead for reporting the bug. * Crochet now installs on Python 3.3 again, thanks to Ben Cordero. * Crochet should now work on Windows, thanks to Konstantinos Koukopoulos. * Crochet tests can now run without adding its absolute path to PYTHONPATH or installing it first. Documentation: * EventualResult.original_failure is now documented. ** -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Karlsruhe (Germany) Python User Group, March 21st 2014, 7pm
The Karlsruhe Python User Group (KaPy) meets again. Friday, 2014-03-21 (March 21st) 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/
Re: pkg_resources.DistributionNotFound: hiredis
jobmatt...@gmail.com writes: first time run command to start r3, it has already got error r3-app --redis-port=6379 --redis-pass=r3 -c config.py First: please don't top-post; Instead, use the normal interleaved posting style to make it easier to follow the conversation URL:https://en.wikipedia.org/wiki/Posting_style#Interleaved_style. Second: I don't have any idea what you're referring to, and your messages give no explanation. Is this a question about Python, or some specific tool, or some library, or what? What are you trying to do (and please say it in terms that means we can try to reproduce the problem), and what are you seeing instead, and how does that differ from what you expect? -- \ “The best is the enemy of the good.” —Voltaire, _Dictionnaire | `\Philosophique_ | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: pkg_resources.DistributionNotFound: hiredis
this is a specific tool related with python http://heynemann.github.io/r3/ i am trying to do a simple example like the diagram in the web page describe and then use with sympy to massive generate functions and plot and print into a directory On Monday, March 17, 2014 2:04:06 PM UTC+8, Ben Finney wrote: writes: first time run command to start r3, it has already got error r3-app --redis-port=6379 --redis-pass=r3 -c config.py First: please don't top-post; Instead, use the normal interleaved posting style to make it easier to follow the conversation URL:https://en.wikipedia.org/wiki/Posting_style#Interleaved_style. Second: I don't have any idea what you're referring to, and your messages give no explanation. Is this a question about Python, or some specific tool, or some library, or what? What are you trying to do (and please say it in terms that means we can try to reproduce the problem), and what are you seeing instead, and how does that differ from what you expect? -- \ The best is the enemy of the good. --Voltaire, _Dictionnaire | `\Philosophique_ | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
[RELEASED] Python 3.4.0
On behalf of the Python development team, I'm thrilled to announce the official release of Python 3.4. Python 3.4 includes a range of improvements of the 3.x series, including hundreds of small improvements and bug fixes. Major new features and changes in the 3.4 release series include: * PEP 428, a pathlib module providing object-oriented filesystem paths * PEP 435, a standardized enum module * PEP 436, a build enhancement that will help generate introspection information for builtins * PEP 442, improved semantics for object finalization * PEP 443, adding single-dispatch generic functions to the standard library * PEP 445, a new C API for implementing custom memory allocators * PEP 446, changing file descriptors to not be inherited by default in subprocesses * PEP 450, a new statistics module * PEP 451, standardizing module metadata for Python's module import system * PEP 453, a bundled installer for the *pip* package manager * PEP 454, a new tracemalloc module for tracing Python memory allocations * PEP 456, a new hash algorithm for Python strings and binary data * PEP 3154, a new and improved protocol for pickled objects * PEP 3156, a new asyncio module, a new framework for asynchronous I/O To download Python 3.4.0 visit: http://www.python.org/download/releases/3.4.0/ This is a production release. Please report any issues you notice to: http://bugs.python.org/ Enjoy! -- Larry Hastings, Release Manager larry at hastings.org (on behalf of the entire python-dev team and 3.4's contributors) -- https://mail.python.org/mailman/listinfo/python-list
Re: pkg_resources.DistributionNotFound: hiredis
On Mon, Mar 17, 2014 at 5:10 PM, jobmatt...@gmail.com wrote: this is a specific tool related with python http://heynemann.github.io/r3/ i am trying to do a simple example like the diagram in the web page describe and then use with sympy to massive generate functions and plot and print into a directory 1) You've already been asked not to top-post. Please, read the Wikipedia page Ben linked you to. 2) If you put no effort into your question, why should we put effort into the answer? 3) You're asking about a particular program. Unless you can show that the problem you're having is specific to Python, you'll probably do better to ask the author of that program. Look around and see if s/he has a recommended means of getting assistance - maybe a mailing list. 4) You still haven't explained your problem at all. While we might be flattered at the implication that our skills are so great that we're psychic, we're more likely to be frustrated by the utter lack of information. Please read this: http://www.catb.org/~esr/faqs/smart-questions.html ChrisA -- https://mail.python.org/mailman/listinfo/python-list
asyncio libraries?
I'm a little late to the party, but now that Python 3.4 is out and asyncio is ready for use I started reading things like: https://glyph.twistedmatrix.com/2014/02/unyielding.html Which explains why the asyncio approach is the future and all the bullet points in that article make a lot of sense. But my question now is if Python core developers are going to be releasing libraries to help working with things like databases, http requests, etc and all the reasons you may want asyncio? Currently gevent is what I use most often because most libraries I use these days are already greened and I think asyncio needs something similar. Either extensions to popular things like psycopg2, pylibmc (or any memcached library), and urllib3 for example. I've seen libraries like this: https://github.com/fafhrd91/psycotulip popping up but I would love to see some blessed libraries or even more documentation for common use cases and how someone could move to asyncio. What about webservers? Are there any decent webservers being built on top of asyncio instead of gevent, twisted, or tornado? Thanks, John -- https://mail.python.org/mailman/listinfo/python-list
Re: pkg_resources.DistributionNotFound: hiredis
On Sun, 16 Mar 2014 23:10:29 -0700, jobmattcon wrote: this is a specific tool related with python http://heynemann.github.io/r3/ i am trying to do a simple example like the diagram in the web page describe and then use with sympy to massive generate functions and plot and print into a directory I'm afraid that unless you can identify where the problem lies, we probably won't be able to help you. I've used sympy, but I haven't used r3 or redis. Can you confirm: - is redis is working outside of Python? - can you get sympy working without r3? - have you installed r3 successfully? how do you know? - can you demonstrate the SIMPLEST possible piece of code that shows the failure? Reading this website may help. Although it is written for Java, the same principles apply to Python: http://www.sscce.org/ Good luck! And by the way, although most of us will try to be tolerant towards minor breaches of etiquette, we do prefer interleaved posting like this: Question blah blah? Answer. Another question? Further answers. rather than top posting: Answer. Further answers. Question blah blah blah? Another question? See here for more details: http://en.wikipedia.org/wiki/Posting_style Thanks in advance, -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Correct idiom for determining path when frozen in 3.4
Hi, What is the correct idiom for getting the path to a top-level module in 3.3 and 3.4 when the module might be frozen? At the moment I'm using this: if getattr(sys, frozen, False): path = os.path.dirname(sys.executable) else: path = os.path.dirname(__file__) Thanks! -- https://mail.python.org/mailman/listinfo/python-list
HOLY SH*T! HUMANS ORIGINATED IN THE DEVONIAN
=== BREAKING NEWS === RICHARD LEAKEY JUST DIED DUE TO HEART FAILURE! THE REASONS DESCRIBED BY THE MEDICAL TEAM IS THAT HIS WORK WAS DISPROVEN, BY NONE OTHER THAN YOUR OWN BASTARD, THRINAXODON. THIS CAUSED LEAKEY'S HEART TO EXPLODE! THRINAXODON DANCED WITH JOY AS HE WAS GRANTED $600,000,000,000.000! TO WASTE YOUR TIME EVEN FURTHER, CHECK OUT THESE LINKS BELOW. === EVIDENCE THAT HUMANS LIVED IN THE DEVONIAN: https://groups.google.com/group/sci.bio.paleontology/browse_thread/threa d/6f501c469c7af24f# https://groups.google.com/group/sci.bio.paleontology/browse_thread/threa d/3aad75c16afb0b82# http://thrinaxodon.wordpress.com/ === THRINAXODON ONLY HAD THIS TO SAY: I..I...I...Can't believe it. This completely disproved Darwinian orthodoxy. === THE BASTARDS AT THE SMITHSONIAN, AND THE LEAKEY FOUNDATION ARE ERODING WITH FEAR. === THESE ASSHOLES ARE GOING TO DIE: THOMAS AQUINAS; ALDOUS HUXLEY; BOB CASANVOVA; SkyEyes; DAVID IAIN GRIEG; MARK ISAAK; JOHN HARSHAM; RICHARD NORMAN; DR. DOOLITTLE; CHARLES DARWIN; MARK HORTON; ERIK SIMPSON; HYPATIAB7; PAUL J. GANS; JILLERY; WIKI TRIK; THRINAXODON; PETER NYIKOS; RON OKIMOTO; JOHN S. WILKINS === THRINAXODON WAS SCOURING ANOTHER DEVONIAN FOSSIL BED, AND FOUND A HUMAN SKULL, AND A HUMAN FEMUR. HE ANALYSED THE FINDS, AND SAW THAT THEY WERE NOT NORMAL ROCKS. THESE WERE FOSSILIZED BONES. THEY EVEN HAD TOOTH MARKS ON THEM. SO, THRINAXODON BROUGHT THEM TO THE LEAKEY FOUNDATION, THEY UTTERLY DISMISSED IT, AND SAID, We want to keep people thinking that humans evolved 2 Ma. THRINAXODON BROUGHT HIS SWORD, AND SAID, SCIENCE CORRECTS ITSELF. RICHARD LEAKEY SAID, That is a myth, for people to believe in science. THRINAXODON PLANS TO BRING DOOM TO SCIENCE, ITSELF. THRINAXODON IS NOW ON REDDIT -- https://mail.python.org/mailman/listinfo/python-list
Re: Correct idiom for determining path when frozen in 3.4
Mark Summerfield l...@qtrac.plus.com writes: What is the correct idiom for getting the path to a top-level module I'm not sure I understand what this concept is. What do you mean by “top-level module”? in 3.3 and 3.4 when the module might be frozen? At the moment I'm using this: if getattr(sys, frozen, False): path = os.path.dirname(sys.executable) else: path = os.path.dirname(__file__) That looks okay. Does it work? The code is readable and Pythonic as is. But I would suggest several improvements:: if getattr(sys, frozen):# ‘getattr’ will return None by default Also, why test for “sys.frozen” when you're about to use “sys.executable”? if getattr(sys, executable): Lastly, it's slightly more Pythonic to execute the normal path unconditionally, and let it raise an exception if there's a problem:: try: executable = sys.executable except AttributeError: executable = __file__ path = os.path.dirname(executable) -- \ “It is far better to grasp the universe as it really is than to | `\persist in delusion, however satisfying and reassuring.” —Carl | _o__)Sagan | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Correct idiom for determining path when frozen in 3.4
On Mon, Mar 17, 2014 at 2:02 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Mark Summerfield l...@qtrac.plus.com writes: if getattr(sys, frozen):# ‘getattr’ will return None by default No it won't. Lastly, it's slightly more Pythonic to execute the normal path unconditionally, and let it raise an exception if there's a problem:: try: executable = sys.executable except AttributeError: executable = __file__ path = os.path.dirname(executable) Sure, but sys.executable always exists. sys.frozen doesn't, and the existence or nonexistence is apparently meaningful; so your code does something different than the original problem statement. Also, if that weren't the case, I'd really replace that try-except with getattr(sys, 'executable', __file__) -- Devin -- https://mail.python.org/mailman/listinfo/python-list
Re: Correct idiom for determining path when frozen in 3.4
Devin Jeanpierre jeanpierr...@gmail.com writes: On Mon, Mar 17, 2014 at 2:02 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Mark Summerfield l...@qtrac.plus.com writes: if getattr(sys, frozen):# ‘getattr’ will return None by default No it won't. […] Sure, but sys.executable always exists. My apologies for posting untested code without making that clear. Thanks to Devin for picking up my mistakes. Lastly, it's slightly more Pythonic to execute the normal path unconditionally, and let it raise an exception if there's a problem:: try: executable = sys.executable except AttributeError: executable = __file__ path = os.path.dirname(executable) sys.frozen doesn't [necessarily exist], and the existence or nonexistence is apparently meaningful; so your code does something different than the original problem statement. Right. I didn't understand why ‘__file__’ is a suitable substitute for ‘sys.executable’; they're always (?) different values. So that probably is what led to the confusion in the code behaviour. I hope the Pythonic idioms are helpful to the original poster nevertheless. -- \ “Anyone who believes exponential growth can go on forever in a | `\finite world is either a madman or an economist.” —Kenneth | _o__) Boulding | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Correct idiom for determining path when frozen in 3.4
On 17 March 2014 08:44, Mark Summerfield l...@qtrac.plus.com wrote: Hi, What is the correct idiom for getting the path to a top-level module in 3.3 and 3.4 when the module might be frozen? At the moment I'm using this: if getattr(sys, frozen, False): path = os.path.dirname(sys.executable) else: path = os.path.dirname(__file__) Why do you want to know this? Does pkgutil.get_data do what you want? http://docs.python.org/3.3/library/pkgutil.html#pkgutil.get_data Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: Error when installing matplotlib-1.3. on Windows
Note that I have Portable Python, installed on USB flash drive. When I tried run matplotlib installer, I got error:'Cannot install': Python version 2.7 required, which was not found in the registry - Original Message - From: MRAB Sent: 03/17/14 03:55 AM To: python-list@python.org Subject: Re: Error when installing matplotlib-1.3. on Windows On 2014-03-17 01:20, laguna...@mail.com wrote: I'm trying to install matplotlib from locally stored source archive file (Portable Python 2.7 on Windows): pip install E:\matplotlib-1.3.1.win32-py2.7.exe Got error, below is log:E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 03:10:16 Exception: Traceback (most recent call last): File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py, line 122, in main status = self.run(options, args) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\commands\install.py, line 257, in run InstallRequirement.from_line(name, None)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 172, in from_line return cls(req, comes_from, url=url, prereleases=prereleases) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 70, in __init__ req = pkg_resources.Requirement.parse(req) File E:\Portable Python 2.7.5.1\App\lib\site-packages\ pip\_vendor\pkg_resources.py, line 2606, in parse reqs = list(parse_requirements(s)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2544, in parse_requirements line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),version spec) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2512, in scan_list raise ValueError(Expected +item_name+ in,line,at,line[p:]) ValueError: ('Expected version spec in', 'E:\\matplotlib-1.3.1.win32-py2.7.exe', 'at', ':\\matplotlib-1.3.1.win32-py2.7.exe')What is the problem and how to solve it? Judging by the name, I'd say that matplotlib-1.3.1.win32-py2.7.exe is an installer, so you just need to run it. -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Question about Source Control
Hi all I know I *should* be using a Source Control Management system, but at present I am not. I tried to set up Mercurial a couple of years ago, but I think I set it up wrongly, as I got myself confused and found it more of a hindrance than a help. Now I am ready to try again, but I want to avoid my earlier mistakes. I understand the concept, and I understand the importance, so I do not need reminding of those. What I would like help with is the basic setup. I could subscribe to the Mercurial mailing list and ask there, but I am hoping for a kick-start here. Here is my setup. All my source code resides on an old Linux server, which I switch on in the morning and switch off at night, but otherwise hardly ever look at. It uses 'samba' to allow sharing with Windows, and 'nfs' to allow sharing with other Linux machines. I need to test my program on Windows and on Linux, so I run it from both at various times. On Windows I have a 'mapped drive' pointing to the source code. On Linux I use a third machine, running a recent Fedora, using nfs to mount a directory pointing to the source code. Obviously each machine has its own version of Python installed. I do my development on the Windows machine. I use TextPad, a simple text editor, which works fine for my purposes. It uses the mapped drive to point to the source code. So where should I install the SCM, and how should I set it up so that I can access the latest version from any machine? Any hints will be appreciated. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list
Re: Question about Source Control
Frank, I would suggest start with an account on https://bitbucket.org. It supports private repositories so you should be good there. From other hand you can setup own infrastructure for SCM, read more here: http://mindref.blogspot.com/2013/10/how-to-manage-git-or-mercurial.html Thanks. Andriy Kornatskyy On Mar 17, 2014, at 3:06 PM, Frank Millman fr...@chagford.com wrote: Hi all I know I *should* be using a Source Control Management system, but at present I am not. I tried to set up Mercurial a couple of years ago, but I think I set it up wrongly, as I got myself confused and found it more of a hindrance than a help. Now I am ready to try again, but I want to avoid my earlier mistakes. I understand the concept, and I understand the importance, so I do not need reminding of those. What I would like help with is the basic setup. I could subscribe to the Mercurial mailing list and ask there, but I am hoping for a kick-start here. Here is my setup. All my source code resides on an old Linux server, which I switch on in the morning and switch off at night, but otherwise hardly ever look at. It uses 'samba' to allow sharing with Windows, and 'nfs' to allow sharing with other Linux machines. I need to test my program on Windows and on Linux, so I run it from both at various times. On Windows I have a 'mapped drive' pointing to the source code. On Linux I use a third machine, running a recent Fedora, using nfs to mount a directory pointing to the source code. Obviously each machine has its own version of Python installed. I do my development on the Windows machine. I use TextPad, a simple text editor, which works fine for my purposes. It uses the mapped drive to point to the source code. So where should I install the SCM, and how should I set it up so that I can access the latest version from any machine? Any hints will be appreciated. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
[no subject]
i am doing my masters currently and im stuck up with my final project. As i was interested in learning a new language i opted to do my final project in python. im currently working on building an unit tester for multithreaded code. Due to various reasons i got stuck with my project. basically my lack of knowledge in python and i have none to help me with it. i have no idea what to do with my project . and my deadline is in another 1 week . I have completed working on the atomicity violation finder . Finding Atomicity-Violation Bugs through Unserializable Interleaving Testing by Shan Lu, Soyeon Park, and Yuanyuan Zhou, Member, IEEE. This is my base paper . can anyone please help me with it. if anyone has a working code please mail me. -- https://mail.python.org/mailman/listinfo/python-list
Re: Looking for someone who can build a 64-bit version of SpamBayes installer for Windows
As more and more Windows users have moved to 64-bit versions of Windows and Outlook, we've had more and more reports of failures. I think all that's necessary (speaking as someone who knows nothing about Windows) is for someone to build a 64-bit version of the SpamBayes installer for Windows Anybody available to help? Still looking for someone to help building a 64-bit installer for SpamBayes on Windows. Anyone? Any idea where else to plead for help? Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Looking for someone who can build a 64-bit version of SpamBayes installer for Windows
On 17/03/2014 14:08, Skip Montanaro wrote: As more and more Windows users have moved to 64-bit versions of Windows and Outlook, we've had more and more reports of failures. I think all that's necessary (speaking as someone who knows nothing about Windows) is for someone to build a 64-bit version of the SpamBayes installer for Windows Anybody available to help? Still looking for someone to help building a 64-bit installer for SpamBayes on Windows. Anyone? Any idea where else to plead for help? Skip https://mail.python.org/mailman/listinfo/python-win32 which is gated to gmane.comp.python.windows -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Question about Source Control
On Tue, Mar 18, 2014 at 12:06 AM, Frank Millman fr...@chagford.com wrote: All my source code resides on an old Linux server, which I switch on in the morning and switch off at night, but otherwise hardly ever look at. It uses 'samba' to allow sharing with Windows, and 'nfs' to allow sharing with other Linux machines. I need to test my program on Windows and on Linux, so I run it from both at various times. On Windows I have a 'mapped drive' pointing to the source code. On Linux I use a third machine, running a recent Fedora, using nfs to mount a directory pointing to the source code. Obviously each machine has its own version of Python installed. I do my development on the Windows machine. I use TextPad, a simple text editor, which works fine for my purposes. It uses the mapped drive to point to the source code. So where should I install the SCM, and how should I set it up so that I can access the latest version from any machine? First off: You can save yourself a huge amount of trouble now! Modern source control systems are distributed (DVCS - Distributed Version Control System), which means that you have a much simpler setup: every machine that uses it has a full clone of the repository. By the sound of it, you don't have any history at the moment, so I'll assume you just start using either git or hg from where you are. The first thing to do is to get a local copy of the current source tree. I'd start with a Linux system, because everything seems to be easier there... $ cp -r /mnt/samba/whatever/some_project_name . Then you just 'cd' into the project directory (which can be anywhere local - I tend to have a whole pile of them directly in my home directory, or the root directory on Windows, but you can put them anywhere; on my Hackintosh, I use the Documents directory so I can find it more easily), and type either: $ git init $ git add . $ git commit -m'Initial commit' or $ hg init $ hg add . $ hg commit -m'Initial commit' Voila! You now have a repository tracking all your current source code for that project. Then you just set yourself up to pull and push somewhere. The easiest way to do that is to designate somewhere as the central repository and always push changes to there and pull changes from there; that's not strictly necessary, but I do recommend it. Andriy recommends bitbucket; I like github, but that (as the name implies) requires that you use git rather than Mercurial. (I also find that git is rather faster than hg at most tasks. On the flip side, hg is said to be a lot easier to set up on Windows than git is. I've never used hg on Windows, so I can't say, but git on Windows isn't quite as easy as could be desired.) You can also set up your own local server very easily - a good plan if you're moving big binaries around (not usually what you'd call source code, but perfectly acceptable; I recently ripped out our shared folder document repository and replaced it with git-managed files) or working with something highly sensitive. But for an open-source project, it's easiest to host it out there somewhere, and let someone else do the work. After that, it's simply a matter of going through the quick start tutorial for your preferred SCM and host, which will help you get started with authentication, push/pull commands, etc etc etc. Source control is something to get your head around, but once you've done that (which you might already have done for the sake of some open source project), everything else becomes easy. Shared folders are easy to explain to someone (you can access this from everywhere!), but git or hg gives you ever so much more for no extra effort (not only can you keep track of your files, you can go back in time to see what's happened, keep track of different branches of development, share it all with the world, get suggestions from the world...). Start thinking in terms of my files are in this repository rather than my files are on this server, and have lots of clones of that repository, all acting as peers. Life's way better that way :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re:
On Mon, Mar 17, 2014 at 6:06 PM, J Prashanthan jprashant...@gmail.com wrote: i am doing my masters currently and im stuck up with my final project. As i was interested in learning a new language i opted to do my final project in python. im currently working on building an unit tester for multithreaded code. Due to various reasons i got stuck with my project. basically my lack of knowledge in python and i have none to help me with it. i have no idea what to do with my project . and my deadline is in another 1 week . I have completed working on the atomicity violation finder . Finding Atomicity-Violation Bugs through Unserializable Interleaving Testing by Shan Lu, Soyeon Park, and Yuanyuan Zhou, Member, IEEE. This is my base paper . can anyone please help me with it. if anyone has a working code please mail me. Almost certainly nobody here has working code that they're willing to simply give you. Is your final project expected to be more than a week's work? If so, I think you're a bit stuck - at least as regards the deadline. But if you have a good idea of how to write code (in some other language than Python), and if you have a thorough set of notes of what you're trying to accomplish (in pseudo-code, or at least your native language - for me that would be English), then you might be able to translate it all into working Python code fairly efficiently. A week is, I'm afraid, not very long for a large project. But with a good language, you can do an amazing amount of work in a short time; and Python is a very good language. I recently knocked together most of a game engine inside 24 hours (not in Python but in a similar language); you might well be able to go from nil to running before your time is up. But it's going to take a lot of work, and you're going to need to start by getting broad familiarity with Python. So start here: http://docs.python.org/3/tutorial/ ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Looking for someone who can build a 64-bit version of SpamBayes installer for Windows
On 17/03/2014 14:39, Mark Lawrence wrote: On 17/03/2014 14:08, Skip Montanaro wrote: As more and more Windows users have moved to 64-bit versions of Windows and Outlook, we've had more and more reports of failures. I think all that's necessary (speaking as someone who knows nothing about Windows) is for someone to build a 64-bit version of the SpamBayes installer for Windows Anybody available to help? Still looking for someone to help building a 64-bit installer for SpamBayes on Windows. Anyone? Any idea where else to plead for help? Skip https://mail.python.org/mailman/listinfo/python-win32 which is gated to gmane.comp.python.windows Or cgohlke at uci.edu as he maintains this Unofficial Windows Binaries for Python Extension Packages here http://www.lfd.uci.edu/~gohlke/pythonlibs/ -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Correct idiom for determining path when frozen in 3.4
On Monday, 17 March 2014 08:44:23 UTC, Mark Summerfield wrote: Hi, What is the correct idiom for getting the path to a top-level module in 3.3 and 3.4 when the module might be frozen? At the moment I'm using this: if getattr(sys, frozen, False): path = os.path.dirname(sys.executable) else: path = os.path.dirname(__file__) Thanks! My code was adapted from this: http://cx-freeze.readthedocs.org/en/latest/faq.html#using-data-files When you freeze a Python program with cx_Freeze, sys.freeze exists; but otherwise it doesn't. I develop some programs which I freeze for distribution but during development I test them as-is so I need to be able to distinguish. Also, from 3.4, __file__ won't exist in frozen modules: http://docs.python.org/3.4/whatsnew/3.4.html#changes-in-the-python-api Thanks for your thoughtful replies. -- https://mail.python.org/mailman/listinfo/python-list
Re: Looking for someone who can build a 64-bit version of SpamBayes installer for Windows
On Mon, Mar 17, 2014 at 10:11 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: https://mail.python.org/mailman/listinfo/python-win32 which is gated to gmane.comp.python.windows Or cgohlke at uci.edu as he maintains this Unofficial Windows Binaries for Python Extension Packages here http://www.lfd.uci.edu/~gohlke/pythonlibs/ Thanks for the pointers, Mark. I'll get in touch with Chris Gohlke. I'm pretty sure I've asked on the python-win32 list before, but I'll check there again. Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Correct idiom for determining path when frozen in 3.4
On Mon, Mar 17, 2014 at 10:31 AM, Mark Summerfield l...@qtrac.plus.com wrote: My code was adapted from this: http://cx-freeze.readthedocs.org/en/latest/faq.html#using-data-files When you freeze a Python program with cx_Freeze, sys.freeze exists; but otherwise it doesn't. I develop some programs which I freeze for distribution but during development I test them as-is so I need to be able to distinguish. Also, from 3.4, __file__ won't exist in frozen modules: http://docs.python.org/3.4/whatsnew/3.4.html#changes-in-the-python-api Have a look at __spec__, specifically __spec__.origin: import sys _fi = sys.modules['_frozen_importlib'] _fi module '_frozen_importlib' (frozen) _fi.__spec__ ModuleSpec(name='_frozen_importlib', loader=class '_frozen_importlib.FrozenImporter', origin='frozen') _fi.__spec__.origin 'frozen' I've not looked up in the importlib docs to confirm, but that should mean that frozen modules should have a __spec__.origin that contains frozen. HTH, -- Zach -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On 3/15/14 11:26 AM, Jayanth Koushik wrote: This is a very interesting philosophical question, one which I am surprised no one has answered; although, I think the reason for that might be entirely obvious. You actually answered your own question, as you were asking it. If the doc says whatever you do, don't push the purple button, well, leave the purple button alone. :) (I don't know, push it if you want) If you monitor the PEP process, or have ever taken part in python-ideas, or python-dev (either directly, or just lurking) you will notice that python is developed through a very interesting active committee process (that is really something phenomenal; cool community). How should one spell a complex number? Should we use i or j ? Should the imaginary part be set off somehow? Should literals be parsed differently (or consistently) with correctly formed strings? Who knows, beats me. consider: complex( 3 + 2 j) SyntaxError: invalid syntax complex( 3 +2j ) (3+2j) I don't know... you tell me. complex('3+2j') (3+2j) complex('3 +2j') Traceback (most recent call last): File pyshell#17, line 1, in module complex('3 +2j') ValueError: complex() arg is a malformed string Again, beats me. I just don't know. But I do know that the spelling book says, Do it this way: complex('3+2j'). Seems simple enough. Philosophically, I tend to think about it this way. A complex number is like any other number. I would not form a PI string like this ' 3 .14 1 5 9265 3 . . .' I would rather see it formed like so, '3.1415926535' This '3 + 2j' is not a number, its an algebraic sum. This '3+2j' is a complex number. Ok, maybe not, but its closer to what we expect (I'm sorry, but I like i instead of j ) Also, philosophically, C ignores white space; python does not. I agree with this now; before I did not. White space is just as much a part of how interpretation occurs, within symbol processing/parsing. Some choices are arbitrary, some are community concurrence (PEPs), some are philosophical, and most are just convenient intuition. My Greek professor used to say, there is no 'why' in Greek. Python is similar. Cheers -- https://mail.python.org/mailman/listinfo/python-list
Re: test
On 3/16/14 5:07 AM, Chris “Kwpolska” Warrick wrote: Why not use the mailing list instead? It’s a much easier way to access this place. I prefer to 'pull' rather than receive the 'push'. The newsreader idea is better because threading works better, and because the interface is simpler. I don't know, just preference I guess. I am active on several mailing lists also; they only have list servers (not news Usenet server). The Usenet news reader concept must be fading away, and many isp(s) are not providing the nntp post service these days (Charter stopped it in late 2011). There are still several free post servers out there that do not require registration (some are free but do require registration). What are most active pythoniacs doing with this these days? (beats me) -- https://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] [RELEASED] Python 3.4.0
YES!!! +1 to the authors of the statistics and pathlib modules. On Mon, Mar 17, 2014 at 1:29 AM, Larry Hastings la...@hastings.org wrote: On behalf of the Python development team, I'm thrilled to announce the official release of Python 3.4. Python 3.4 includes a range of improvements of the 3.x series, including hundreds of small improvements and bug fixes. Major new features and changes in the 3.4 release series include: * PEP 428, a pathlib module providing object-oriented filesystem paths * PEP 435, a standardized enum module * PEP 436, a build enhancement that will help generate introspection information for builtins * PEP 442, improved semantics for object finalization * PEP 443, adding single-dispatch generic functions to the standard library * PEP 445, a new C API for implementing custom memory allocators * PEP 446, changing file descriptors to not be inherited by default in subprocesses * PEP 450, a new statistics module * PEP 451, standardizing module metadata for Python's module import system * PEP 453, a bundled installer for the *pip* package manager * PEP 454, a new tracemalloc module for tracing Python memory allocations * PEP 456, a new hash algorithm for Python strings and binary data * PEP 3154, a new and improved protocol for pickled objects * PEP 3156, a new asyncio module, a new framework for asynchronous I/O To download Python 3.4.0 visit: http://www.python.org/download/releases/3.4.0/ This is a production release. Please report any issues you notice to: http://bugs.python.org/ Enjoy! -- Larry Hastings, Release Manager larry at hastings.org (on behalf of the entire python-dev team and 3.4's contributors) ___ Python-Dev mailing list python-...@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ rymg19%40gmail.com -- Ryan If anybody ever asks me why I prefer C++ to C, my answer will be simple: It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated. -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On Tue, Mar 18, 2014 at 3:18 AM, Mark H Harris harrismh...@gmail.com wrote: You actually answered your own question, as you were asking it. If the doc says whatever you do, don't push the purple button, well, leave the purple button alone. :) (I don't know, push it if you want) https://www.wizards.com/magic/magazine/article.aspx?x=mtg/daily/mm/69 If you monitor the PEP process, or have ever taken part in python-ideas, or python-dev (either directly, or just lurking) you will notice that python is developed through a very interesting active committee process (that is really something phenomenal; cool community). Not really a committee, more of a champion-and-bikeshedders approach - often with more than one level of champion, as when a PEP has an author (the first champion) and either the BDFL or his delegate (the second champion, whose role is usually just to say yay or nay). It's a curious process, but one that works fairly well. How should one spell a complex number? Should we use i or j ? Should the imaginary part be set off somehow? Should literals be parsed differently (or consistently) with correctly formed strings? Who knows, beats me. consider: complex( 3 + 2 j) SyntaxError: invalid syntax complex( 3 +2j ) (3+2j) I don't know... you tell me. That's for the sake of parsing clarity. (Incidentally, the call to complex() is redundant in each case.) Everything in Python consists of tokens - those tokens, in your examples, are: complex, (, whitespace, 3, whitespace, +, whitespace, 2, whitespace, j, ), end of line and complex, (, whitespace, 3, whitespace, +, 2j, whitespace, ), end of line In the first case, the parser then has two symbol-type tokens (2 and j) separated by whitespace, with no operator. That's a problem. Did you mean 2+j, or 2==j, etc? Since j is perfectly natural as a name, it's going to be interpreted that way. In the second case, that translates into a perfectly valid parse tree, because 2j is an imaginary literal. ast.dump(ast.parse(complex( 3 +2j ))) Module(body=[Expr(value=Call(func=Name(id='complex', ctx=Load()), args=[BinOp(left=Num(n=3), op=Add(), right=Num(n=2j))], keywords=[], starargs=None, kwargs=None))]) The sole argument to complex() is an expression which sums the integer 3 and the imaginary 2j, which results in the complex (3+2j), which complex() looks at and returns unchanged. And that's what you see. complex('3+2j') (3+2j) complex('3 +2j') Traceback (most recent call last): File pyshell#17, line 1, in module complex('3 +2j') ValueError: complex() arg is a malformed string Again, beats me. I just don't know. And now what you're looking at is the construction of a complex from a string. Now, instead of going by the rules of the Python lexer, it goes by the rules of the complex constructor. You can't use extra spaces there. You could, of course, write your own function that parses whatever format you like (including the use of i instead of j), or you can use ast.literal_eval to parse a string based on Python's lexing, but with complex(str) you follow the rules of complex(str). Philosophically, I tend to think about it this way. A complex number is like any other number. I would not form a PI string like this ' 3 .14 1 5 9265 3 . . .' I would rather see it formed like so, '3.1415926535' Right. This '3 + 2j' is not a number, its an algebraic sum. This '3+2j' is a complex number. Ok, maybe not, but its closer to what we expect (I'm sorry, but I like i instead of j ) Hmm. That's a pretty tricky distinction. In Python source code, those two are identical, and they're both rendered as a sum. (Lexically. The CPython optimizer, and presumably other Pythons' optimizers, will notice at compile time that you're adding two literals, and store the sum. But as you see from the AST above, it's the sum of two values.) It's actually not possible, as far as I know, to truly represent a complex number; all you can do is represent the sum of a real part and an imaginary part. Also, philosophically, C ignores white space; python does not. That's not really anything to do with it. The two languages' approaches to whitespace inside expressions are identical, save that Python will only allow newlines if the expression is clearly unfinished, eg if it has unbalanced open parens. Horizontal whitespace is fine in both languages. (Of course, C doesn't even _have_ a complex literal notation, so the distinction is slightly moot.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: test
On 17/03/2014 16:42, Mark H Harris wrote: On 3/16/14 5:07 AM, Chris “Kwpolska” Warrick wrote: Why not use the mailing list instead? It’s a much easier way to access this place. I prefer to 'pull' rather than receive the 'push'. The newsreader idea is better because threading works better, and because the interface is simpler. I don't know, just preference I guess. I am active on several mailing lists also; they only have list servers (not news Usenet server). The Usenet news reader concept must be fading away, and many isp(s) are not providing the nntp post service these days (Charter stopped it in late 2011). There are still several free post servers out there that do not require registration (some are free but do require registration). What are most active pythoniacs doing with this these days? (beats me) Thunderbird and gmane, FWIW on Windows 7. Several hundred Python mailing lists and blogs all available from one place, plus presumably tens of thousands of other such beasties for just about everything under the sun. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] [RELEASED] Python 3.4.0
The what's new looks truly amazing, with pathlib and asyncio being my favourite additions. Thanks for all the hard work. On Mon, Mar 17, 2014 at 5:57 PM, Ryan Gonzalez rym...@gmail.com wrote: YES!!! +1 to the authors of the statistics and pathlib modules. On Mon, Mar 17, 2014 at 1:29 AM, Larry Hastings la...@hastings.orgwrote: On behalf of the Python development team, I'm thrilled to announce the official release of Python 3.4. Python 3.4 includes a range of improvements of the 3.x series, including hundreds of small improvements and bug fixes. Major new features and changes in the 3.4 release series include: * PEP 428, a pathlib module providing object-oriented filesystem paths * PEP 435, a standardized enum module * PEP 436, a build enhancement that will help generate introspection information for builtins * PEP 442, improved semantics for object finalization * PEP 443, adding single-dispatch generic functions to the standard library * PEP 445, a new C API for implementing custom memory allocators * PEP 446, changing file descriptors to not be inherited by default in subprocesses * PEP 450, a new statistics module * PEP 451, standardizing module metadata for Python's module import system * PEP 453, a bundled installer for the *pip* package manager * PEP 454, a new tracemalloc module for tracing Python memory allocations * PEP 456, a new hash algorithm for Python strings and binary data * PEP 3154, a new and improved protocol for pickled objects * PEP 3156, a new asyncio module, a new framework for asynchronous I/O To download Python 3.4.0 visit: http://www.python.org/download/releases/3.4.0/ This is a production release. Please report any issues you notice to: http://bugs.python.org/ Enjoy! -- Larry Hastings, Release Manager larry at hastings.org (on behalf of the entire python-dev team and 3.4's contributors) ___ Python-Dev mailing list python-...@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ rymg19%40gmail.com -- Ryan If anybody ever asks me why I prefer C++ to C, my answer will be simple: It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated. -- https://mail.python.org/mailman/listinfo/python-list -- Giampaolo - http://grodola.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list
Thread._stop() behavior changed in Python 3.4
Hi list, I noticed a behavior change on Thread._stop() with Python 3.4. I know the method is an undocumented feature itself, but some projects are using it, and now they fail. A minimized snippet to reproduce: #!/usr/bin/python import threading def stale(): import time time.sleep(1000) t = threading.Thread(target=stale) t.start() t._stop() This works correctly with Python 3.3, the program exits immediately after t._stop() called, and no exception was raised. But with Python 3.4, an AssertionError was raised: Traceback (most recent call last): File test.py, line 8, in module t._stop() File /usr/lib/python3.4/threading.py, line 990, in _stop assert not lock.locked() AssertionError And the program still waits on the sleep(). I know trying to forcefully stop a thread is not really a good practice, but I still wonder if there's an easy way to get broken programs to work again, just in the way they currently are? Downstream bug reports, for reference: http://youtrack.jetbrains.com/issue/PY-12317 https://github.com/paramiko/paramiko/issues/286 Regards, Felix Yan signature.asc Description: This is a digitally signed message part. -- https://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] [RELEASED] Python 3.4.0
yeah , asyncio is a great module, congrat for all jobs you are doing --Ad | Dakar 2014-03-17 18:11 GMT+01:00 Giampaolo Rodola' g.rod...@gmail.com: The what's new looks truly amazing, with pathlib and asyncio being my favourite additions. Thanks for all the hard work. On Mon, Mar 17, 2014 at 5:57 PM, Ryan Gonzalez rym...@gmail.com wrote: YES!!! +1 to the authors of the statistics and pathlib modules. On Mon, Mar 17, 2014 at 1:29 AM, Larry Hastings la...@hastings.orgwrote: On behalf of the Python development team, I'm thrilled to announce the official release of Python 3.4. Python 3.4 includes a range of improvements of the 3.x series, including hundreds of small improvements and bug fixes. Major new features and changes in the 3.4 release series include: * PEP 428, a pathlib module providing object-oriented filesystem paths * PEP 435, a standardized enum module * PEP 436, a build enhancement that will help generate introspection information for builtins * PEP 442, improved semantics for object finalization * PEP 443, adding single-dispatch generic functions to the standard library * PEP 445, a new C API for implementing custom memory allocators * PEP 446, changing file descriptors to not be inherited by default in subprocesses * PEP 450, a new statistics module * PEP 451, standardizing module metadata for Python's module import system * PEP 453, a bundled installer for the *pip* package manager * PEP 454, a new tracemalloc module for tracing Python memory allocations * PEP 456, a new hash algorithm for Python strings and binary data * PEP 3154, a new and improved protocol for pickled objects * PEP 3156, a new asyncio module, a new framework for asynchronous I/O To download Python 3.4.0 visit: http://www.python.org/download/releases/3.4.0/ This is a production release. Please report any issues you notice to: http://bugs.python.org/ Enjoy! -- Larry Hastings, Release Manager larry at hastings.org (on behalf of the entire python-dev team and 3.4's contributors) ___ Python-Dev mailing list python-...@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ rymg19%40gmail.com -- Ryan If anybody ever asks me why I prefer C++ to C, my answer will be simple: It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated. -- https://mail.python.org/mailman/listinfo/python-list -- Giampaolo - http://grodola.blogspot.com ___ Python-Dev mailing list python-...@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/dia.aliounes%40gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: What does gc.get_objects() return?
Chris Angelico rosuav at gmail.com writes: It's not strictly an implementation detail, beyond that there are certain optimizations. For instance... For CPython 3.4 I guess strings and other atomic types such as ints are not, as well as raw object() instances. Custom class instances on the other hand seem to be under GC control. ... strings and ints should never be listed, and custom objects should always be listed, but I'd say the non-tracking of object() would be an implementation-specific optimization. These are all implementation details, tied to the fact that the primary object reclaim mechanism in CPython is reference counting. Other implementations may use a full GC and gc.get_objects() may then also return strings and other atomic objects (but the implementation may also elicit to hack get_objects() in order to closely mimick CPython). All in all, though, gc.get_objects() is an expensive function call (it will walk the entire graph of objects tracked by the GC, which can be very large in non-trivial applications), so it's really only useful for debugging (and, I'd add, for low-level debugging). In most situations, gc.get_objects() is certainly the wrong tool to use. Regards Antoine. -- https://mail.python.org/mailman/listinfo/python-list
Re: Thread._stop() behavior changed in Python 3.4
Hi, Felix Yan felixonmars at gmail.com writes: A minimized snippet to reproduce: #!/usr/bin/python import threading def stale(): import time time.sleep(1000) t = threading.Thread(target=stale) t.start() t._stop() This works correctly with Python 3.3, the program exits immediately after t._stop() called, and no exception was raised. Basically what you are doing is abusing a private method because you want to make the thread daemonic after it was started (a daemonic thread is not waited for at interpreter exit). Please do note one thing: the _stop() method does *not* actually stop the thread; it just marks it stopped, but the underlying OS thread continues to run (and may indeed continue to execute Python code until the interpreter exits). So the obvious solution here is to mark the thread daemonic before starting it. A possible related improvement would be to relax the contraints on Thread.daemon to allow setting the flag on a running thread? That said, daemon threads (or abuse of the _stop() method as you did) can lead to instabilities and oddities as some code will continue executing while the interpreter starts shutting down. This has been improved but perhaps not totally solved in recent interpreter versions. A fully correct solution would involve gracefully telling the thread to shut down, via a boolean flag, an Event, a file descriptor or any other means. (if you are interested in this, please open a new issue at http://bugs.python.org) Regards Antoine. -- https://mail.python.org/mailman/listinfo/python-list
Re: Thread._stop() behavior changed in Python 3.4
On Tue, Mar 18, 2014 at 4:18 AM, Felix Yan felixonm...@gmail.com wrote: I noticed a behavior change on Thread._stop() with Python 3.4. I know the method is an undocumented feature itself, but some projects are using it, and now they fail. I know trying to forcefully stop a thread is not really a good practice, but I still wonder if there's an easy way to get broken programs to work again, just in the way they currently are? You're using something that has a leading underscore on the name. Frankly, you shouldn't be doing that. Your code was already broken, before 3.4 came along, and it's just that 3.4 highlighted that brokenness. The PyCharm report that this is a Python 3.4 bug is simply incorrect. This code should be a strong indication that something's reaching into places it shouldn't be: https://github.com/JetBrains/intellij-community/blob/master/python/helpers/pydev/pydevd_comm.py#L109 The solution is to have the thread acknowledge, in some way, that it needs to shut down. Forcefully stopping a thread is actually a really bad practice, at least in Python (with OS/2 and VX-REXX, it's a different matter). Antoine says that this doesn't even stop the thread (I can't say; I've never used _stop(), for obvious reasons), so this code was doubly broken. The change in 3.4 should be an excuse to fix the code so it actually works, and works according to the spec, which will mean it works on all versions. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: What does gc.get_objects() return?
Hi. On 17.3.2014. 18:18, Antoine Pitrou wrote: All in all, though, gc.get_objects() is an expensive function call (it will walk the entire graph of objects tracked by the GC, which can be very large in non-trivial applications), so it's really only useful for debugging (and, I'd add, for low-level debugging). In most situations, gc.get_objects() is certainly the wrong tool to use. I agree, and for the record, we were using it for debugging when I started this thread - trying to track down a memory leak. :-) gc.get_objects() turned out to be of great help with in resolving the issue - in the end we tracked it down to a typical reference counting problem in a Python extension DLL. *doh* Best regards, Jurko Gospodnetić -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
Jayanth Koushik jnkoushik at gmail.com writes: Note: When converting from a string, the string must not contain whitespace around the central + or - operator. For example, complex('1+2j') is fine, but complex('1 + 2j') raises ValueError. Why is this so? See http://bugs.python.org/issue9574 for a bit more context. To begin with, it's not at all clear what *should* be allowed. If 1 + 2j is valid, what about + 2j? How about + 2? What about things like +1.0 + -2.3j? Ultimately, I closed that issue because the proposed change seemed like unnecessary code churn, and there wasn't a clear consensus that the change was desirable (or even what that change should be). If it ain't broke, etc. -- Mark -- https://mail.python.org/mailman/listinfo/python-list
Re: Thread._stop() behavior changed in Python 3.4
On Monday, March 17, 2014 17:33:09 Antoine Pitrou wrote: Hi, Felix Yan felixonmars at gmail.com writes: A minimized snippet to reproduce: #!/usr/bin/python import threading def stale(): import time time.sleep(1000) t = threading.Thread(target=stale) t.start() t._stop() This works correctly with Python 3.3, the program exits immediately after t._stop() called, and no exception was raised. Basically what you are doing is abusing a private method because you want to make the thread daemonic after it was started (a daemonic thread is not waited for at interpreter exit). Please do note one thing: the _stop() method does *not* actually stop the thread; it just marks it stopped, but the underlying OS thread continues to run (and may indeed continue to execute Python code until the interpreter exits). So the obvious solution here is to mark the thread daemonic before starting it. A possible related improvement would be to relax the contraints on Thread.daemon to allow setting the flag on a running thread? That said, daemon threads (or abuse of the _stop() method as you did) can lead to instabilities and oddities as some code will continue executing while the interpreter starts shutting down. This has been improved but perhaps not totally solved in recent interpreter versions. A fully correct solution would involve gracefully telling the thread to shut down, via a boolean flag, an Event, a file descriptor or any other means. (if you are interested in this, please open a new issue at http://bugs.python.org) Regards Antoine. Thanks for the detailed explanation! Actually I didn't used _stop() myself either, but noticed the problem when trying to build paramiko against python 3.4. Thanks especially for the tip that the threads may be still running - actually I didn't even think about this part! For now I just skipped the test suites for paramiko to get the packaging done (since the test suites themselves are passed without a problem, just the test script made something wrong). I'll try to follow up the issue for paramiko :) Regards, Felix Yan signature.asc Description: This is a digitally signed message part. -- https://mail.python.org/mailman/listinfo/python-list
Re: Thread._stop() behavior changed in Python 3.4
On Mon, Mar 17, 2014 at 11:40 AM, Chris Angelico ros...@gmail.com wrote: Antoine says that this doesn't even stop the thread (I can't say; I've never used _stop(), for obvious reasons), so this code was doubly broken. I was curious about that -- after all, Python's threads aren't truly concurrent, so perhaps they could just test the flag each time they resume -- so I tested it using 3.3. First I tried simply adding a print call on to the end of the OP's function: def stale(): ... import time ... time.sleep(1000) ... print('hello') ... t = threading.Thread(target=stale) t.start(); t._stop() No output was printed, so at least a sleeping thread can apparently be stopped. Then I tried removing the sleep call: def stale(): ... for i in range(10): print('hello') ... t = threading.Thread(target=stale) t.start(); print('Starting'); t._stop(); print('Stopping') hello Starting Stopping hello hello hello hello hello hello hello hello hello So yes, despite the lack of true concurrency, a thread can continue to run after its _stop has been called. -- https://mail.python.org/mailman/listinfo/python-list
Re: Thread._stop() behavior changed in Python 3.4
On Tue, Mar 18, 2014 at 4:59 AM, Felix Yan felixonm...@gmail.com wrote: For now I just skipped the test suites for paramiko to get the packaging done (since the test suites themselves are passed without a problem, just the test script made something wrong). I'll try to follow up the issue for paramiko :) I've posted comments on both the issues you linked to. My guess based on a cursory look at paramiko is that it's a test suite watchdog, which would be much better implemented with a subprocess; I may be wrong, though. In any case, if it's just a tests problem, you should theoretically be able to ignore it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Thread._stop() behavior changed in Python 3.4
On Tuesday, March 18, 2014 05:08:20 Chris Angelico wrote: I've posted comments on both the issues you linked to. My guess based on a cursory look at paramiko is that it's a test suite watchdog, which would be much better implemented with a subprocess; I may be wrong, though. In any case, if it's just a tests problem, you should theoretically be able to ignore it. ChrisA I was just trying to comment and see yours... Thanks a lot! :D Regards, Felix Yan signature.asc Description: This is a digitally signed message part. -- https://mail.python.org/mailman/listinfo/python-list
Re: Thread._stop() behavior changed in Python 3.4
On Tue, Mar 18, 2014 at 5:13 AM, Felix Yan felixonm...@gmail.com wrote: On Tuesday, March 18, 2014 05:08:20 Chris Angelico wrote: I've posted comments on both the issues you linked to. My guess based on a cursory look at paramiko is that it's a test suite watchdog, which would be much better implemented with a subprocess; I may be wrong, though. In any case, if it's just a tests problem, you should theoretically be able to ignore it. ChrisA I was just trying to comment and see yours... Thanks a lot! :D Your comment will mean more, since you actually use the thing :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
Chris Angelico ros...@gmail.com: On Tue, Mar 18, 2014 at 3:18 AM, Mark H Harris harrismh...@gmail.com wrote: Philosophically, I tend to think about it this way. A complex number is like any other number. I would not form a PI string like this ' 3 .14 1 5 9265 3 . . .' I would rather see it formed like so, '3.1415926535' Right. Well, Java 7 allows you to embed underscores freely in numeric literals. Would be a nice addition to Python as well: if unit == 'G': count *= 1_000_000_000 vs: if unit == 'G': count *= 10 This '3 + 2j' is not a number, its an algebraic sum. This '3+2j' is a complex number. Ok, maybe not, but its closer to what we expect (I'm sorry, but I like i instead of j ) Hmm. That's a pretty tricky distinction. Is -2.0 a literal? What's the outcome of -2.0.__str__() Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On 3/17/14 12:03 PM, Chris Angelico wrote: ast.dump(ast.parse(complex( 3 +2j ))) Module(body=[Expr(value=Call(func=Name(id='complex', ctx=Load()), args=[BinOp(left=Num(n=3), op=Add(), right=Num(n=2j))], keywords=[], starargs=None, kwargs=None))]) The sole argument to complex() is an expression which sums the integer 3 and the imaginary 2j, which results in the complex (3+2j), which complex() looks at and returns unchanged. And that's what you see. ~very nice. Ok, going along with Mark's comment about this bug report: See http://bugs.python.org/issue9574 This string '3 +2j' should probably be ok from the complex() string constructor standpoint, right? I mean, there might be more than one constructor for string, mighten-it? marcus -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On Mon, Mar 17, 2014 at 12:15 PM, Marko Rauhamaa ma...@pacujo.net wrote: Is -2.0 a literal? What's the outcome of -2.0.__str__() No. The compiler will try to optimize it into a single constant if it can, but it has to be done in accordance with the order of operations. In that example, the __str__ method is called before the unary - is applied, resulting in an error. -- https://mail.python.org/mailman/listinfo/python-list
Re: Thread._stop() behavior changed in Python 3.4
Hi. On 17.3.2014. 19:03, Ian Kelly wrote: So yes, despite the lack of true concurrency, a thread can continue to run after its _stop has been called. Actually 'true' or 'false' concurrency does not matter here. CPython supports multiple threads and implements them using underlying native OS threads. The fact that it has an internal mutex (GIL) preventing it from executing/interpreting Python code at the same time in multiple threads (most of the time) does not come into play.. When one thread exits its GIL protected section (e.g. finishes processing one bytecode instruction and is about to go on to processing the next one), another thread may pick up the GIL and do some of its work, e.g. print out some output. Best regards, Jurko Gospodnetić -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa ma...@pacujo.net wrote: This '3 + 2j' is not a number, its an algebraic sum. This '3+2j' is a complex number. Ok, maybe not, but its closer to what we expect (I'm sorry, but I like i instead of j ) Hmm. That's a pretty tricky distinction. Is -2.0 a literal? What's the outcome of -2.0.__str__() If you mean (-2.0).__str__(), then it returns '-2.0', but that proves nothing. Lots of objects have a str() which isn't a literal. Closer to what you're talking about would be repr(), but even then, it doesn't prove that something's a literal. The easiest way to tell is probably ast.parse(): ast.dump(ast.parse(-2.0)) 'Module(body=[Expr(value=UnaryOp(op=USub(), operand=Num(n=2.0)))])' It's an expression consisting of unary minus and the float literal 2.0. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: test
On 3/17/14 12:03 PM, Mark Lawrence wrote: Thunderbird and gmane, FWIW on Windows 7. I moved my news reader stuff like comp.lang.python over to my Thunderbird mail client yesterday; works well and is as functional as sea-monkey ever was. The client is nice and has none of the short-comings of gg. The server Thunderbird complain about the line lengths when in excess of 79 characters (says it can't post) but posts anyway. I've seen that at least one|twice. Gmane looks interesting... gonna try it. marcus -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
Chris Angelico ros...@gmail.com: On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa ma...@pacujo.net wrote: Is -2.0 a literal? What's the outcome of -2.0.__str__() If you mean (-2.0).__str__(), then it returns '-2.0', but that proves nothing. The point is, you don't need to philosophize about complex literals when even negative numbers don't have literals in Python. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On Tue, Mar 18, 2014 at 6:22 AM, Marko Rauhamaa ma...@pacujo.net wrote: Chris Angelico ros...@gmail.com: On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa ma...@pacujo.net wrote: Is -2.0 a literal? What's the outcome of -2.0.__str__() If you mean (-2.0).__str__(), then it returns '-2.0', but that proves nothing. The point is, you don't need to philosophize about complex literals when even negative numbers don't have literals in Python. Ah! I get you. The difference between literals and constants is one that almost never matters, though. Python may not have a syntax for negative or complex literals, but it does have notations for various sorts of constants, which function the same way. (Literals are by definition constants.) So Python may not have a convenient notation for number of seconds in a week (unless you work with DNS and find the bare integer 604800 convenient), but you can write 7*24*60*60 and it's just as good in a function: ast.dump(ast.parse(7*24*60*60)) 'Module(body=[Expr(value=BinOp(left=BinOp(left=BinOp(left=Num(n=7), op=Mult(), right=Num(n=24)), op=Mult(), right=Num(n=60)), op=Mult(), right=Num(n=60)))])' def f(x): return x + 7*24*60*60 dis.dis(f) 2 0 LOAD_FAST0 (x) 3 LOAD_CONST 6 (604800) 6 BINARY_ADD 7 RETURN_VALUE There's absolutely no run-time cost to writing it out, and you get to be flexible with whitespace and such, which you can't do with literals. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Installing binwalk on Portable Python
Portable Python 2.7 for Win32 and installed on USB flash drive. I want install Binwalk tool, it have a few depencencies, I installed it first (numpy, matplotlib, libmagic, python-magic) Then I tried to install binwalk from locally stored source archive file, I tried two ways: pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0.tar pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0\src\setup.py I both cases I got error, below is log: E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 21:25:47 Exception: Traceback (most recent call last): File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py, line 122, in main status = self.run(options, args) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\commands\install.py, line 257, in run InstallRequirement.from_line(name, None)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 172, in from_line return cls(req, comes_from, url=url, prereleases=prereleases) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 70, in __init__ req = pkg_resources.Requirement.parse(req) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2606, in parse reqs = list(parse_requirements(s)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2544, in parse_requirements line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),version spec) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2512, in scan_list raise ValueError(Expected +item_name+ in,line,at,line[p:]) ValueError: ('Expected version spec in', 'E:\\Portable', 'at', ':\\Portable') --- What is wrong with this? -- https://mail.python.org/mailman/listinfo/python-list
Re: Thread._stop() behavior changed in Python 3.4
On Mar 17, 2014 12:53 PM, Jurko Gospodnetić jurko.gospodne...@pke.hr wrote: Hi. On 17.3.2014. 19:03, Ian Kelly wrote: So yes, despite the lack of true concurrency, a thread can continue to run after its _stop has been called. Actually 'true' or 'false' concurrency does not matter here. CPython supports multiple threads and implements them using underlying native OS threads. The fact that it has an internal mutex (GIL) preventing it from executing/interpreting Python code at the same time in multiple threads (most of the time) does not come into play.. When one thread exits its GIL protected section (e.g. finishes processing one bytecode instruction and is about to go on to processing the next one), another thread may pick up the GIL and do some of its work, e.g. print out some output. Yes, and whenever a thread acquires the GIL it *could* check whether its _stop flag has been set before it starts executing any Python code. Apparently though it does not, perhaps for performance reasons. -- https://mail.python.org/mailman/listinfo/python-list
Re: Installing binwalk on Portable Python
On Mon, Mar 17, 2014 at 12:56 PM, laguna...@mail.com wrote: Portable Python 2.7 for Win32 and installed on USB flash drive. I want install Binwalk tool, it have a few depencencies, I installed it first (numpy, matplotlib, libmagic, python-magic) Then I tried to install binwalk from locally stored source archive file, I tried two ways: pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0.tar pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0\src\setup.py I both cases I got error, below is log: E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 21:25:47 Exception: Traceback (most recent call last): File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py, line 122, in main status = self.run(options, args) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\commands\install.py, line 257, in run InstallRequirement.from_line(name, None)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 172, in from_line return cls(req, comes_from, url=url, prereleases=prereleases) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 70, in __init__ req = pkg_resources.Requirement.parse(req) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2606, in parse reqs = list(parse_requirements(s)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2544, in parse_requirements line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),version spec) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2512, in scan_list raise ValueError(Expected +item_name+ in,line,at,line[p:]) ValueError: ('Expected version spec in', 'E:\\Portable', 'at', ':\\Portable') --- What is wrong with this? -- https://mail.python.org/mailman/listinfo/python-list From your error it looks like you just need quotes around the path because it has a space in it. -Peter Mawhorter -- https://mail.python.org/mailman/listinfo/python-list
Re: Installing binwalk on Portable Python
I tried: pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0\src\setup.py Error: E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 22:53:51 Exception: Traceback (most recent call last): File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py, line 122, in main status = self.run(options, args) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\commands\install.py, line 257, in run InstallRequirement.from_line(name, None)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 172, in from_line return cls(req, comes_from, url=url, prereleases=prereleases) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 70, in __init__ req = pkg_resources.Requirement.parse(req) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2606, in parse reqs = list(parse_requirements(s)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2544, in parse_requirements line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),version spec) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2512, in scan_list raise ValueError(Expected +item_name+ in,line,at,line[p:]) ValueError: ('Expected version spec in', 'E:\\Portable Python 2.7.5.1\\binwalk-1.3.0\\src\\setup.py', 'at', ':\\Portable Python 2.7.5.1\\binwalk-1.3.0\\src\\setup.py') -- - Original Message - From: Peter Mawhorter Sent: 03/17/14 10:13 PM To: laguna...@mail.com Subject: Re: Installing binwalk on Portable Python On Mon, Mar 17, 2014 at 12:56 PM, laguna...@mail.com wrote: Portable Python 2.7 for Win32 and installed on USB flash drive. I want install Binwalk tool, it have a few depencencies, I installed it first (numpy, matplotlib, libmagic, python-magic) Then I tried to install binwalk from locally stored source archive file, I tried two ways: pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0.tar pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0\src\setup.py I both cases I got error, below is log: E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 21:25:47 Exception: Traceback (most recent call last): File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py, line 122, in main status = self.run(options, args) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\commands\install.py, line 257, in run InstallRequirement.from_line(name, None)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, lin e 172, in from_line return cls(req, comes_from, url=url, prereleases=prereleases) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 70, in __init__ req = pkg_resources.Requirement.parse(req) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2606, in parse reqs = list(parse_requirements(s)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2544, in parse_requirements line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),version spec) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2512, in scan_list raise ValueError(Expected +item_name+ in,line,at,line[p:]) ValueError: ('Expected version spec in', 'E:\\Portable', 'at', ':\\Portable') --- What is wrong with this? -- https://mail.python.org/mailman/listinfo/python-list From your error it looks like you just need quotes around the path because it has a space in it. -Peter Mawhorter -- https://mail.python.org/mailman/listinfo/python-list
Re: Installing binwalk on Portable Python
On Mon, Mar 17, 2014 at 1:58 PM, laguna...@mail.com wrote: I tried: pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0\src\setup.py Error: E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 22:53:51 Exception: Traceback (most recent call last): File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py, line 122, in main status = self.run(options, args) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\commands\install.py, line 257, in run InstallRequirement.from_line(name, None)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 172, in from_line return cls(req, comes_from, url=url, prereleases=prereleases) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 70, in __init__ req = pkg_resources.Requirement.parse(req) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2606, in parse reqs = list(parse_requirements(s)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2544, in parse_requirements line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),version spec) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2512, in scan_list raise ValueError(Expected +item_name+ in,line,at,line[p:]) ValueError: ('Expected version spec in', 'E:\\Portable Python 2.7.5.1\\binwalk-1.3.0\\src\\setup.py', 'at', ':\\Portable Python 2.7.5.1\\binwalk-1.3.0\\src\\setup.py') -- I'm no expert, but when I try to run pip install ... it seems to want a directory that contains a setup.py file rather than the path of the setup.py file itself. Try: pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0\src perhaps? -Peter Mawhorter -- https://mail.python.org/mailman/listinfo/python-list
Re: Installing binwalk on Portable Python
Yes, that help. Installation start, but then failed due to Pre-requisite failure: failed to find libmagic. Check your installation. Please install the python-magic module, or download and install it from source: ftp://ftp.astron.com/pub/file/' Although libmagic was installed using pip. - Original Message - From: Peter Mawhorter Sent: 03/17/14 11:07 PM To: laguna-mc Subject: Re: Installing binwalk on Portable Python On Mon, Mar 17, 2014 at 1:58 PM, laguna...@mail.com wrote: I tried: pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0\src\setup.py Error: E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 22:53:51 Exception: Traceback (most recent call last): File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\basecommand.py, line 122, in main status = self.run(options, args) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\commands\install.py, line 257, in run InstallRequirement.from_line(name, None)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 172, in from_line return cls(req, comes_from, url=url, prereleases=prereleases) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\req.py, line 70, in __init__ req = pkg_resources.Requirement.parse(req) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2606, in parse reqs = list(parse_requirements( s)) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2544, in parse_requirements line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),version spec) File E:\Portable Python 2.7.5.1\App\lib\site-packages\pip\_vendor\pkg_resources.py, line 2512, in scan_list raise ValueError(Expected +item_name+ in,line,at,line[p:]) ValueError: ('Expected version spec in', 'E:\\Portable Python 2.7.5.1\\binwalk-1.3.0\\src\\setup.py', 'at', ':\\Portable Python 2.7.5.1\\binwalk-1.3.0\\src\\setup.py') -- I'm no expert, but when I try to run pip install ... it seems to want a directory that contains a setup.py file rather than the path of the setup.py file itself. Try: pip install E:\Portable Python 2.7.5.1\binwalk-1.3.0\src perhaps? -Peter Mawhorter -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On 3/17/2014 1:55 PM, Mark Dickinson wrote: Jayanth Koushik jnkoushik at gmail.com writes: Note: When converting from a string, the string must not contain whitespace around the central + or - operator. For example, complex('1+2j') is fine, but complex('1 + 2j') raises ValueError. Why is this so? See http://bugs.python.org/issue9574 for a bit more context. To begin with, it's not at all clear what *should* be allowed. If 1 + 2j is valid, what about + 2j? How about + 2? What about things like +1.0 + -2.3j? Ultimately, I closed that issue because the proposed change seemed like unnecessary code churn, and there wasn't a clear consensus that the change was desirable (or even what that change should be). If it ain't broke, etc. I was not nosy on that issue, but I agree with 'as is', along with no space in Franction(1/2). Mathematicians genearally write both without spaces. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Balanced trees
Joshua Landau jos...@landau.ws: The thing we really need is for the blist containers to become stdlib (but not to replace the current list implementation). Very interesting. Downloaded blist but didn't compile it yet. It *could* be the missing link. I would *love* to see some comparative performance results between blist.sorteddict and an AVL tree. A B+ tree could be nicer to the CPU cache, but then again, the cache line is only a few pointers wide and there appears to be a lot of shoving stuff left and right -- based on a 10-second analysis of the code: while (src = stop) *dst-- = *src--; Personally, I find it a bit odd to place lists at the center of the proposal and have trees come out as a side effect. I would rather see it the other way round: sorteddict - sortedset et al. * It reduces demand for trees: I would hope it would satisfy the demand for trees. nobody jumps at blists because they're rarely the obvious solution. I haven't jumped at them because they were nowhere to be found on URL: http://docs.python.org/3/genindex-B.html. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Venus / GuthVenus for iPhone, Nexus, Droid and Android Jelly Bean
In article 71ab5220-6d5d-46bf-b33a-16aae6c87...@googlegroups.com, bradg...@gmail.com says... On Wednesday, February 5, 2014 2:59:23 PM UTC-8, Brad Guth wrote: On Saturday, January 11, 2014 3:52:10 PM UTC-8, Brad Guth wrote: NOVA and Discovery Channel each missed this one as of 13+ years ago; GuthVenus 1:1, plus 10x resample/enlargement of the area in question http://bradguth.blogspot.com/2009/07/brad-guth-index.html http://nssdc.gsfc.nasa.gov/imgcat/hires/mgn_c115s095_1.gif Our NASA and all of their contracted universities plus numerous others associated somehow missed this one, even after they'd been explicitly informed. Go figure. Be my guest and apply your very own photographic enlargement software, as to viewing this one small but rather interesting topography area of Venus, using your independent deductive expertise as to further enlarge or magnify and simply interpret this extensively mountainous and canyon populated terrain area of Venus that I've focused upon (roughly one third up from the bottom and roughly center), honestly shouldn't be asking too much. Most of modern PhotoZoom and numerous other photographic software variations tend to accomplish this digital enlargement process automatically on the fly, (including iPhone, Safari, Android, Mozilla FireFox, Google Chrome and most other internet browsing forms of image viewing and zooming), although some extra applied filtering and thereby image enhancing for dynamic range compensations (aka contrast boosting) can further improve upon the end result (no direct pixel modifications should ever be necessary, because it's all a derivative from the original Magellan radar imaging that's offering a composite of 36 confirming radar scans per pixel, that can always be 100% verified from scratch). Using Ctrl+,+,+ gets most older PCs and even the basic Apple notebooks to quickly zoom in, whereas iPhone, Android and MS-W8 as well as Google Chrome accepts touch-pad or screen touch zooming with even somewhat better results of automatic image resampling, so as to keeping the image context reasonably clear or in focus. However, a regular photographic editing app or software solution like PhotoShop is still going to provide some of the best results plus offering dynamic range compensation for a version of added contrast without actually modifying a damn thing as to the raw context of the original, because everything always remains as a direct image derivative. http://photo-editing-software-review.toptenreviews.com/ HERE'S THE ANSWER: === BREAKING NEWS === RICHARD LEAKEY JUST DIED DUE TO HEART FAILURE! THE REASONS DESCRIBED BY THE MEDICAL TEAM IS THAT HIS WORK WAS DISPROVEN, BY NONE OTHER THAN YOUR OWN BASTARD, THRINAXODON. THIS CAUSED LEAKEY'S HEART TO EXPLODE! THRINAXODON DANCED WITH JOY AS HE WAS GRANTED $600,000,000,000.000! TO WASTE YOUR TIME EVEN FURTHER, CHECK OUT THESE LINKS BELOW. === EVIDENCE THAT HUMANS LIVED IN THE DEVONIAN: https://groups.google.com/group/sci.bio.paleontology/browse_thread/threa d/6f501c469c7af24f# https://groups.google.com/group/sci.bio.paleontology/browse_thread/threa d/3aad75c16afb0b82# http://thrinaxodon.wordpress.com/ === THRINAXODON ONLY HAD THIS TO SAY: I..I...I...Can't believe it. This completely disproved Darwinian orthodoxy. === THE BASTARDS AT THE SMITHSONIAN, AND THE LEAKEY FOUNDATION ARE ERODING WITH FEAR. === THESE ASSHOLES ARE GOING TO DIE: THOMAS AQUINAS; ALDOUS HUXLEY; BOB CASANVOVA; SkyEyes; DAVID IAIN GRIEG; MARK ISAAK; JOHN HARSHAM; RICHARD NORMAN; DR. DOOLITTLE; CHARLES DARWIN; MARK HORTON; ERIK SIMPSON; HYPATIAB7; PAUL J. GANS; JILLERY; WIKI TRIK; THRINAXODON; PETER NYIKOS; RON OKIMOTO; JOHN S. WILKINS === THRINAXODON WAS SCOURING ANOTHER DEVONIAN FOSSIL BED, AND FOUND A HUMAN SKULL, AND A HUMAN FEMUR. HE ANALYSED THE FINDS, AND SAW THAT THEY WERE NOT NORMAL ROCKS. THESE WERE FOSSILIZED BONES. THEY EVEN HAD TOOTH MARKS ON THEM. SO, THRINAXODON BROUGHT THEM TO THE LEAKEY FOUNDATION, THEY UTTERLY DISMISSED IT, AND SAID, We want to keep people thinking that humans evolved 2 Ma. THRINAXODON BROUGHT HIS SWORD, AND SAID, SCIENCE CORRECTS ITSELF. RICHARD LEAKEY SAID, That is a myth, for people to believe in science. THRINAXODON PLANS TO BRING DOOM TO SCIENCE, ITSELF. THRINAXODON IS NOW ON REDDIT -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On Mon, Mar 17, 2014 at 5:06 PM, Terry Reedy tjre...@udel.edu wrote: Mathematicians genearally write both without spaces. Mathematicians also have a tendency to use single letter variables and often escape into non-ASCII character sets as well. wink Perhaps it's worth pointing out that pylint complains about most/many infix operations if you don't surround the operator with white space. And, complex expressions work just fine with white space around the operator: 1 + 2j (1+2j) Personally, I'm agnostic to the proposed change. I don't use complex numbers in my work, and I suspect that creating complex numbers from strings is an extremely small corner case. Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Balanced trees
On 17 March 2014 21:16, Daniel Stutzbach stutzb...@google.com wrote: On Fri, Mar 14, 2014 at 6:13 PM, Joshua Landau jos...@landau.ws wrote: Now, I understand there are downsides to blist. Particularly, I've looked through the benchmarks and they seem untruthful. I worked hard to make those benchmarks as fair as possible. I recognize that evaluating your own work always runs the risk of introducing hidden biases, and I welcome input on how they could be improved. Thanks. First, I want to state that there are two aspects to my claim. The first is that these benchmarks to not represent typical use-cases. I will not go too far into this, though, because it's mostly obvious. The second is that of the the flaws in the benchmarks themselves. I'll go through in turn some that are apparent to me: Create from an iterator gives me relatively different results when I run it (Python 3). Delete a slice is fudged from its inclusion of multiplication, which is far faster on blists. I admit that it's not obvious how to fix this. First in, first out (FIFO) should be x.append(0); x.pop(0). Last in, first out (LIFO) should use pop() over pop(-1), although I admit it shouldn't make a meaningful difference. Sort * are really unfair because they put initialisation in the timed part and all have keys. The benchmarks on Github are less bad, but the website really should include all of them and fix the remaining problems. I do understand that TimSort isn't the most suited algorithm, though, so I won't read too far into these results. Further, some of these tests don't show growth where they should, such as in getitem. The growth is readily apparent when measured as such: python -m timeit -s from random import choice; import blist; lst = blist.blist(range(10**0)) choice(lst) 100 loops, best of 3: 1.18 usec per loop python -m timeit -s from random import choice; import blist; lst = blist.blist(range(10**8)) choice(lst) 100 loops, best of 3: 1.56 usec per loop Lower size ranges are hidden by the function-call overhead. Perhaps this effect is to do with caching, in which case the limits of the cache should be explained more readily. Nevertheless, my enthusiasm for blist as an alternative stdlib implementation remains. There are obvious and large advantages to be had, sometimes when you wouldn't even expect. The slower aspects of blist are also rarely part of the bottlenecks of programs. So yeah, go for it. -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On Tue, Mar 18, 2014 at 10:59 AM, Skip Montanaro s...@pobox.com wrote: Perhaps it's worth pointing out that pylint complains about most/many infix operations if you don't surround the operator with white space. IMO that's excessive. Not every infix operator needs whitespace. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Ordering in the printout of a dictionary
Could someone kindly explain a phenomenon in the following where: (1) I first typed in a dictionary but got a printout in a reordered form. (2) I then typed in the reordered form but got a printout in the order that I typed in originally in (1). That is, there is no stable standard ordering. Why is that so? Is there a way to force a certain ordering of the printout or else somehow manage to get at least a certain stable ordering of the printout (i.e. input and output are identical)? Thanks in advance. M. K. Shen -- {'label': 3, 'parent': 0, 'left child': 1, 'right child': 2} {'right child': 2, 'parent': 0, 'left child': 1, 'label': 3} {'right child': 2, 'parent': 0, 'left child': 1, 'label': 3} {'label': 3, 'parent': 0, 'left child': 1, 'right child': 2} -- https://mail.python.org/mailman/listinfo/python-list
Python Docs Download servers not accessable from Egypt
Hello, I just want to report a python web sites specific problem I don't know if this is the right place to report it I can't seem to access docs.python.org, mail.python.org, or even legacy.python.org from my ISP in Egypt LinkDotNet the dynamic IP range I noticed while facing this problem is 41.130.xx.xx please tell me if you need any further info Thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: Ordering in the printout of a dictionary
On Tue, Mar 18, 2014 at 11:32 AM, Mok-Kong Shen mok-kong.s...@t-online.de wrote: Could someone kindly explain a phenomenon in the following where: (1) I first typed in a dictionary but got a printout in a reordered form. (2) I then typed in the reordered form but got a printout in the order that I typed in originally in (1). That is, there is no stable standard ordering. Why is that so? A dictionary is simply a mapping from keys to values. It has no ordering. Is there a way to force a certain ordering of the printout or else somehow manage to get at least a certain stable ordering of the printout (i.e. input and output are identical)? Yes; instead of simply printing it out (which calls repr()), explicitly iterate over it, like this: def display(d): return '{'+','.join('%r: %r'%(key,d[key]) for key in sorted(d))+'}' print(display({'label': 3, 'parent': 0, 'left child': 1, 'right child': 2})) {'label': 3, 'left child': 1, 'parent': 0, 'right child': 2} That will be consistent, and will also always be sorted, which will probably be what you want for human-readable display. At least, it's consistent as long as the keys all sort consistently, which they will if you use simple strings. Other types of keys may not work, and in fact mixing types may cause an exception: print(display({True:1,Hello:2})) Traceback (most recent call last): File stdin, line 1, in module File stdin, line 2, in display TypeError: unorderable types: str() bool() But for strings, this is the easiest way to get what you're looking for. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Docs Download servers not accessable from Egypt
On Tue, Mar 18, 2014 at 11:42 AM, leobutch...@gmail.com wrote: Hello, I just want to report a python web sites specific problem I don't know if this is the right place to report it I can't seem to access docs.python.org, mail.python.org, or even legacy.python.org from my ISP in Egypt LinkDotNet the dynamic IP range I noticed while facing this problem is 41.130.xx.xx please tell me if you need any further info What IP address is docs.python.org for you? Try using 'dig' or 'ping' on it. For me, it's: docs.python.org. 60625 IN CNAME dinsdale.python.org. dinsdale.python.org. 60625 IN A 82.94.164.162 ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On Mon, Mar 17, 2014 at 7:16 PM, Chris Angelico ros...@gmail.com wrote: On Tue, Mar 18, 2014 at 10:59 AM, Skip Montanaro s...@pobox.com wrote: Perhaps it's worth pointing out that pylint complains about most/many infix operations if you don't surround the operator with white space. IMO that's excessive. Not every infix operator needs whitespace. I wasn't suggesting it was the only way things could be done. Just pointing out that there is enough common practice out there to suggest that white space around infix operators is often the preferred way of doing things. Quoting from PEP 8: If operators with different priorities are used, consider adding whitespace around the operators with the lowest priority(ies). Use your own judgment; however, never use more than one space, and always have the same amount of whitespace on both sides of a binary operator. Yes: i = i + 1 submitted += 1 x = x*2 - 1 hypot2 = x*x + y*y c = (a+b) * (a-b) ... My point is that accommodating white space around the + or - sign isn't altogether unreasonable. Maybe PEP 8 needs to be tweaked with an example of good complex literal practice? Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Ordering in the printout of a dictionary
In mailman.8231.1395103693.18130.python-l...@python.org Chris Angelico ros...@gmail.com writes: Is there a way to force a certain ordering of the printout or else somehow manage to get at least a certain stable ordering of the printout (i.e. input and output are identical)? Yes; instead of simply printing it out (which calls repr()), explicitly iterate over it, like this: def display(d): return '{'+','.join('%r: %r'%(key,d[key]) for key in sorted(d))+'}' You could also use the OrderedDict type, which is subclass of dict that preserves insertion order. -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list
Re: Venus / GuthVenus for iPhone, Nexus, Droid and Android Jelly Bean
On 3/17/2014 3:33 PM, Thrinaxodon wrote: In article 71ab5220-6d5d-46bf-b33a-16aae6c87...@googlegroups.com, bradg...@gmail.com says... On Wednesday, February 5, 2014 2:59:23 PM UTC-8, Brad Guth wrote: On Saturday, January 11, 2014 3:52:10 PM UTC-8, Brad Guth wrote: NOVA and Discovery Channel each missed this one as of 13+ years ago; GuthVenus 1:1, plus 10x resample/enlargement of the area in question http://bradguth.blogspot.com/2009/07/brad-guth-index.html http://nssdc.gsfc.nasa.gov/imgcat/hires/mgn_c115s095_1.gif Our NASA and all of their contracted universities plus numerous others associated somehow missed this one, even after they'd been explicitly informed. Go figure. Be my guest and apply your very own photographic enlargement software, as to viewing this one small but rather interesting topography area of Venus, using your independent deductive expertise as to further enlarge or magnify and simply interpret this extensively mountainous and canyon populated terrain area of Venus that I've focused upon (roughly one third up from the bottom and roughly center), honestly shouldn't be asking too much. Most of modern PhotoZoom and numerous other photographic software variations tend to accomplish this digital enlargement process automatically on the fly, (including iPhone, Safari, Android, Mozilla FireFox, Google Chrome and most other internet browsing forms of image viewing and zooming), although some extra applied filtering and thereby image enhancing for dynamic range compensations (aka contrast boosting) can further improve upon the end result (no direct pixel modifications should ever be necessary, because it's all a derivative from the original Magellan radar imaging that's offering a composite of 36 confirming radar scans per pixel, that can always be 100% verified from scratch). Using Ctrl+,+,+ gets most older PCs and even the basic Apple notebooks to quickly zoom in, whereas iPhone, Android and MS-W8 as well as Google Chrome accepts touch-pad or screen touch zooming with even somewhat better results of automatic image resampling, so as to keeping the image context reasonably clear or in focus. However, a regular photographic editing app or software solution like PhotoShop is still going to provide some of the best results plus offering dynamic range compensation for a version of added contrast without actually modifying a damn thing as to the raw context of the original, because everything always remains as a direct image derivative. http://photo-editing-software-review.toptenreviews.com/ HERE'S THE ANSWER: === BREAKING NEWS === RICHARD LEAKEY JUST DIED DUE TO HEART FAILURE! THE REASONS DESCRIBED BY THE MEDICAL TEAM IS THAT HIS WORK WAS DISPROVEN, BY NONE OTHER THAN YOUR OWN BASTARD, THRINAXODON. THIS CAUSED LEAKEY'S HEART TO EXPLODE! THRINAXODON DANCED WITH JOY AS HE WAS GRANTED $600,000,000,000.000! TO WASTE YOUR TIME EVEN FURTHER, CHECK OUT THESE LINKS BELOW. === EVIDENCE THAT HUMANS LIVED IN THE DEVONIAN: https://groups.google.com/group/sci.bio.paleontology/browse_thread/threa d/6f501c469c7af24f# https://groups.google.com/group/sci.bio.paleontology/browse_thread/threa d/3aad75c16afb0b82# http://thrinaxodon.wordpress.com/ === THRINAXODON ONLY HAD THIS TO SAY: I..I...I...Can't believe it. This completely disproved Darwinian orthodoxy. === THE BASTARDS AT THE SMITHSONIAN, AND THE LEAKEY FOUNDATION ARE ERODING WITH FEAR. === THESE ASSHOLES ARE GOING TO DIE: THOMAS AQUINAS; ALDOUS HUXLEY; BOB CASANVOVA; SkyEyes; DAVID IAIN GRIEG; MARK ISAAK; JOHN HARSHAM; RICHARD NORMAN; DR. DOOLITTLE; CHARLES DARWIN; MARK HORTON; ERIK SIMPSON; HYPATIAB7; PAUL J. GANS; JILLERY; WIKI TRIK; THRINAXODON; PETER NYIKOS; RON OKIMOTO; JOHN S. WILKINS === THRINAXODON WAS SCOURING ANOTHER DEVONIAN FOSSIL BED, AND FOUND A HUMAN SKULL, AND A HUMAN FEMUR. HE ANALYSED THE FINDS, AND SAW THAT THEY WERE NOT NORMAL ROCKS. THESE WERE FOSSILIZED BONES. THEY EVEN HAD TOOTH MARKS ON THEM. SO, THRINAXODON BROUGHT THEM TO THE LEAKEY FOUNDATION, THEY UTTERLY DISMISSED IT, AND SAID, We want to keep people thinking that humans evolved 2 Ma. THRINAXODON BROUGHT HIS SWORD, AND SAID, SCIENCE CORRECTS ITSELF. RICHARD LEAKEY SAID, That is a myth, for people to believe in science. THRINAXODON PLANS TO BRING DOOM TO SCIENCE, ITSELF. THRINAXODON IS NOW ON REDDIT Direct death threats should be kept to a minimum. === THESE ASSHOLES ARE GOING TO DIE: THOMAS AQUINAS; ALDOUS HUXLEY; BOB CASANVOVA; SkyEyes; DAVID IAIN GRIEG; MARK ISAAK; JOHN HARSHAM; RICHARD NORMAN; DR. DOOLITTLE; CHARLES DARWIN; MARK HORTON;
Re: 'complex' function with string argument.
On Mon, 17 Mar 2014 21:22:18 +0200, Marko Rauhamaa wrote: Chris Angelico ros...@gmail.com: On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa ma...@pacujo.net wrote: Is -2.0 a literal? What's the outcome of -2.0.__str__() If you mean (-2.0).__str__(), then it returns '-2.0', but that proves nothing. The point is, you don't need to philosophize about complex literals when even negative numbers don't have literals in Python. But Python *does* have complex (well, imaginary to be precise) literals. The j suffix to a number makes it complex: py type(2j) class 'complex' Complex numbers with both a real and imaginary component are not treated as literals: py import ast py ast.dump(ast.parse(2j)) 'Module(body=[Expr(value=Num(n=2j))])' py ast.dump(ast.parse(1+2j)) 'Module(body=[Expr(value=BinOp(left=Num(n=1), op=Add(), right=Num(n=2j)))])' and in recent versions, the peephole optimizer optimizes them: py from dis import dis py dis(1+2j) 1 0 LOAD_CONST 2 ((1+2j)) 3 RETURN_VALUE -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On Mon, 17 Mar 2014 11:18:56 -0500, Mark H Harris wrote: How should one spell a complex number? Should we use i or j ? Should the imaginary part be set off somehow? Should literals be parsed differently (or consistently) with correctly formed strings? Who knows, beats me. With respect, that's just because you would make a lousy language designer :-) The answer to most of those questions should be pretty obvious, with perhaps just one that isn't clear. How should one spell a complex number? There is perfectly good syntax for complex numbers used by mathematicians and engineers for over a century. There is no need to invent something different just for the sake of being different: Yes: 2+3i or 2+3j No:@2|3? Should we use i or j ? There are good reasons for both i and j. This one comes down to personal preference. Should the imaginary part be set off somehow? What do you mean set off? Why do you want to? Since the imaginary part can appear on its own: z = 3j we cannot make setting off compulsory. Once you have syntax for complex numbers with an imaginary component, everything else Just Works with no additional effort: z = 2 + 3j # an expression adding 2 to 3j z = 5*3j # an expression multiplying 5 by 3j There's no need for dedicated syntax for complex numbers beyond the simple no-real-part case. You get everything else for free from basic arithmetic expressions, so there actually isn't need to parse complex literals beyond the j suffix. Should literals be parsed differently (or consistently) with correctly formed strings? Once you decide that complex literals should be formed from only the imaginary part, 3j, parsing literals is simple. So is passing strings: you have something that looks like a float, with a j suffix. Obviously they should parse the same. assert 1.234j == complex('1.234j') Problem solved. Well, not quite -- it would be rather limiting if the complex constructor only accepted complex numbers with an implicitly zero real part. We'd like to accept anything that repr(z) can print. Since repr(z) prints complex numbers with a + or - infix operator, the complex constructor should accept the same inside strings. How flexible should the complex constructor be? Should it bend over backwards to accept any mathematical expression that includes a complex j suffix, e.g. complex(2**3i)? I think not, since complex numbers don't display like that. Our only obligation is to parse the strings that complex.__repr__ can produce, not to parse any imaginable numeric expression. So at a minimum, complex should accept strings that look like floatj float+floatj float-floatj For the same reason that float(2) works, we should also allow strings that look like: float with no j suffix. Anything else, including spaces around the + and - symbols, would be a bonus. consider: complex( 3 + 2 j) SyntaxError: invalid syntax That's a syntax error for the same reason that: x = 1 2 is a syntax error. Nothing to do with the + sign. It's the spaces between the 2 and the j. complex( 3 +2j ) (3+2j) I don't know... you tell me. In both cases, the call to complex is redundant. You've already created a complex number, using syntax, then you pass it to the complex function which just returns the same number. complex('3+2j') (3+2j) complex('3 +2j') Traceback (most recent call last): File pyshell#17, line 1, in module complex('3 +2j') ValueError: complex() arg is a malformed string Personally, I would like complex to accept spaces around the + or -, as it already accepts leading and trailing spaces. But it's not a big deal. [...] Also, philosophically, C ignores white space; python does not. C does not ignore whitespace. forwhile is not the same as for while The first is a valid identifier, the second is a syntax error. Oh somebody please tell me it's not a valid C expression! *wink* -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: 'complex' function with string argument.
On Tue, Mar 18, 2014 at 3:52 PM, Steven D'Aprano st...@pearwood.info wrote: The first is a valid identifier, the second is a syntax error. Oh somebody please tell me it's not a valid C expression! *wink* It's not a valid C expression. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Question about Source Control
Chris Angelico ros...@gmail.com wrote in message news:CAPTjJmqPca5cnNWu8T5BZhpH665X0=mrf7bjalqvrqvmjzw...@mail.gmail.com... On Tue, Mar 18, 2014 at 12:06 AM, Frank Millman fr...@chagford.com wrote: [...] So where should I install the SCM, and how should I set it up so that I can access the latest version from any machine? First off: You can save yourself a huge amount of trouble now! Modern source control systems are distributed (DVCS - Distributed Version Control System), which means that you have a much simpler setup: every machine that uses it has a full clone of the repository. By the sound of it, you don't have any history at the moment, so I'll assume you just start using either git or hg from where you are. The first thing to do is to get a local copy of the current source tree. I'd start with a Linux system, because everything seems to be easier there... [...] Thanks, Chris. I appreciate the detailed explanation. Two quick questions - 1. At present the source code is kept on one machine (A), but only accessed from the two other machines (B and C). Does it make sense to create the central repository on A, but *not* install the SCM on A? Install separate copies of the SCM on B and C, and allow them both to set up their own clones. I only develop on B, so only B would 'push', but both B and C would 'pull' to get the latest version. 2. Being a typical lazy programmer, I frequently go through the following cycle. I work on a section of code by editing it on B. Then I test it by running it on C. Instead of meticulously checking my code I let python find the errors, so I run it on C, it crashes with a traceback, I fix the error on B and rerun it on C until it is working to my satisfaction. It seems that I will have to change my approach. Edit on B, 'push' on B, 'pull' on C, run from C. It sounds more cumbersome, but maybe that is the price I have to pay. Have I got those two right? Thanks Frank -- https://mail.python.org/mailman/listinfo/python-list
[issue20616] Add tracemalloc.Traceback.format() method
Roundup Robot added the comment: New changeset 132821b65e22 by Victor Stinner in branch '3.4': Issue #20616: Add a format() method to tracemalloc.Traceback. http://hg.python.org/cpython/rev/132821b65e22 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20616 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20199] status of module_for_loader and utils._module_to_load
Roundup Robot added the comment: New changeset 1640e3b7def6 by R David Murray in branch '3.4': whatsnew: importlib deprecations. http://hg.python.org/cpython/rev/1640e3b7def6 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20199 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20526] python: Modules/gcmodule.c:379: visit_decref: Assertion `((gc)-gc.gc_refs (1)) != 0' failed.
Roundup Robot added the comment: New changeset 9ce58a73b6b5 by Victor Stinner in branch '3.4': Issue #20526, #19466: Revert changes of issue #19466 which introduces a http://hg.python.org/cpython/rev/9ce58a73b6b5 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20526 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20711] inspect.getfullargspec does not correctly work with builtin module-level functions
Roundup Robot added the comment: New changeset ed1059f5507b by Yury Selivanov in branch '3.4': inspect: Fix getfullargspec to support builtin module-level functions. Issue #20711 http://hg.python.org/cpython/rev/ed1059f5507b -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20711 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20619] lineno and col_offset attributes of _ast.arg objects are not set
Roundup Robot added the comment: New changeset 3c01209ab697 by Benjamin Peterson in branch '3.4': set line and column numbers for keyword-only arg nodes (closes #20619) http://hg.python.org/cpython/rev/3c01209ab697 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20619 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20568] Pass --default-install to ensurepip in the Windows installers
Roundup Robot added the comment: New changeset 5d190cca2f47 by Nick Coghlan in branch '3.4': Close #20568: install unversioned pip command on Windows http://hg.python.org/cpython/rev/5d190cca2f47 New changeset 3f8ca67bde4d by Martin v. Löwis in branch '3.4': Issue #20568: Fix typo in pip option. http://hg.python.org/cpython/rev/3f8ca67bde4d -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20568 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20652] Example in asyncio task gives resource warning
Roundup Robot added the comment: New changeset 36005fe2ab9b by Victor Stinner in branch '3.4': Close #20652: asyncio doc: close the event loop in run_forever() example. Fix http://hg.python.org/cpython/rev/36005fe2ab9b -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20652 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20710] Make pydoc consistent about bound methods
Roundup Robot added the comment: New changeset b2ee3fe195e2 by Larry Hastings in branch '3.4': Issue #20710: The pydoc summary line no longer displays the self parameter http://hg.python.org/cpython/rev/b2ee3fe195e2 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20710 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20939] test_geturl of test_urllibnet fails with 'https://www.python.org/' != 'http://www.python.org/'
Roundup Robot added the comment: New changeset 7f4fba171a40 by Ned Deily in branch '3.4': Issue #20939: merge from 3.3 http://hg.python.org/cpython/rev/7f4fba171a40 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20939 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16251] pickle special methods are looked up on the instance rather than the type
Roundup Robot added the comment: New changeset 2514a577c7cb by Benjamin Peterson in branch '3.4': look up __getnewargs__ and __getnewargs_ex__ on the object type (#16251) http://hg.python.org/cpython/rev/2514a577c7cb -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16251 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20655] test_subprocess is not executed in python -m test.test_asyncio
Roundup Robot added the comment: New changeset b22b83ea719d by Victor Stinner in branch '3.4': Issue #20655: Fix test_asyncio, run also subprocess tests. Patch written by http://hg.python.org/cpython/rev/b22b83ea719d -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20655 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14512] Pydocs module docs server not working on Windows.
Roundup Robot added the comment: New changeset fa34ea4e9e47 by Martin v. Löwis in branch '3.4': Issue #14512: Launch pydoc -b instead of pydocgui.pyw on Windows. http://hg.python.org/cpython/rev/fa34ea4e9e47 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20653] Pickle enums by name
Roundup Robot added the comment: New changeset 010723a7bd25 by Ethan Furman in branch '3.4': Close issue20653: allow Enum subclasses to override __reduce_ex__ http://hg.python.org/cpython/rev/010723a7bd25 New changeset 737f2be5e80c by Ethan Furman in branch '3.4': Close issue20653: improve functional API docs; minor code changes http://hg.python.org/cpython/rev/737f2be5e80c New changeset 2c5a5fa0692c by Ethan Furman in branch '3.4': Issue20653: fix ReST for Enum http://hg.python.org/cpython/rev/2c5a5fa0692c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20653 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20505] Remove resolution from selectors and granularity from asyncio
Roundup Robot added the comment: New changeset 4f1df287392c by Victor Stinner in branch '3.4': Issue #20505: Use even shorter sleep in test_timeout_rounding() to make the http://hg.python.org/cpython/rev/4f1df287392c New changeset 6733d9dfffbb by Victor Stinner in branch '3.4': Issue #20505: BaseEventLoop uses again the resolution of the clock to decide if http://hg.python.org/cpython/rev/6733d9dfffbb New changeset 375e4f9c9732 by Victor Stinner in branch '3.4': Issue #20505: Fix TestLoop, set the clock resolution http://hg.python.org/cpython/rev/375e4f9c9732 New changeset e44ff3b7a497 by Victor Stinner in branch '3.4': Issue #20505: Improve debug info in asyncio event loop http://hg.python.org/cpython/rev/e44ff3b7a497 New changeset af840e781700 by Victor Stinner in branch '3.4': Issue #20505: Oops, only print debug info if selector.select(timeout) took less http://hg.python.org/cpython/rev/af840e781700 New changeset 2faf4b7c52ed by Victor Stinner in branch '3.4': Issue #20505: use also the monotonic time to decide if asyncio debug traces http://hg.python.org/cpython/rev/2faf4b7c52ed New changeset 702b20fa7af2 by Victor Stinner in branch '3.4': Issue #20505: Remove debug code http://hg.python.org/cpython/rev/702b20fa7af2 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20505 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20566] asyncio as_completed() thrashes adding and removing callbacks
Roundup Robot added the comment: New changeset b52113fb58a5 by Guido van Rossum in branch '3.4': asyncio: Change as_completed() to use a Queue, to avoid O(N**2) behavior. Fixes issue #20566. http://hg.python.org/cpython/rev/b52113fb58a5 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20566 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20839] pkgutil.get_loader throws deprecation warning due to internal deprecation
Roundup Robot added the comment: New changeset a8b30fd6ee4f by Nick Coghlan in branch '3.4': Close #20839: pkgutil.find_loader now uses importlib.util.find_spec http://hg.python.org/cpython/rev/a8b30fd6ee4f -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20839 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20694] asyncio.docs: Document subprocess_exec and subprocess_shell
Roundup Robot added the comment: New changeset 2dfc383b4907 by Yury Selivanov in branch '3.4': asyncio.docs: Document subprocess_exec and subprocess_shell. Issue #20694. http://hg.python.org/cpython/rev/2dfc383b4907 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20694 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20757] 3.4rc2 Traceback on Windows pip uninstall
Roundup Robot added the comment: New changeset 6d0994805e18 by Nick Coghlan in branch '3.4': Close #20757: return success for skipped pip uninstall http://hg.python.org/cpython/rev/6d0994805e18 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20757 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20599] test_cleanup() of test_builtin failed
Roundup Robot added the comment: New changeset 3d5154fa8413 by Serhiy Storchaka in branch '3.4': Try to fix test_cleanup (issue #20599). http://hg.python.org/cpython/rev/3d5154fa8413 New changeset c978dffb95ac by Victor Stinner in branch '3.4': Issue #20599: Force ASCII encoding for stdout in test_cleanup() of test_builtin http://hg.python.org/cpython/rev/c978dffb95ac New changeset 1fb37d2d7d9d by Victor Stinner in branch '3.4': Issue #20599: Don't clear environment in test_cleanup() of test_builtin http://hg.python.org/cpython/rev/1fb37d2d7d9d -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20599 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19744] test_venv and installation fail if SSL/TLS is not available
Roundup Robot added the comment: New changeset cd39d4cab680 by Nick Coghlan in branch '3.4': Issue #19744: Handle missing SSL/TLS in ensurepip http://hg.python.org/cpython/rev/cd39d4cab680 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19744 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20641] Python installer needs elevated rights to install pip
Roundup Robot added the comment: New changeset 31c7dc7ccbaa by Martin v. Löwis in branch '3.4': Issue #20641: Run custom actions with the NoImpersonate flag to support UAC. http://hg.python.org/cpython/rev/31c7dc7ccbaa -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20641 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20594] [PATCH] fail to compile posixmodule due to name clash with posix_close
Roundup Robot added the comment: New changeset fd49c1d2fd6c by Benjamin Peterson in branch '3.4': merge 3.3 (#20594) http://hg.python.org/cpython/rev/fd49c1d2fd6c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20594 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20695] test_urllibnet.urlretrieveNetworkTests fails due to new python.org website
Roundup Robot added the comment: New changeset a5247ea950d5 by Benjamin Peterson in branch '3.4': merge 3.3 (#20695) http://hg.python.org/cpython/rev/a5247ea950d5 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20695 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20495] test_read_pty_output() hangs on FreeBSD 7.2 buildbot
Roundup Robot added the comment: New changeset 2cf25865fc66 by Victor Stinner in branch '3.4': Issue #20495: Skip test_read_pty_output() of test_asyncio on FreeBSD older than http://hg.python.org/cpython/rev/2cf25865fc66 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20495 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com