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 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 wrote: > Mark Summerfield 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 writes: > On Mon, Mar 17, 2014 at 2:02 AM, Ben Finney > wrote: > > Mark Summerfield 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 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: [email protected] Subject: Re: Error when installing matplotlib-1.3. on Windows On 2014-03-17 01:20, [email protected] 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 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 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 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 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 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 >>> _fi.__spec__ ModuleSpec(name='_frozen_importlib', loader=, origin='') >>> _fi.__spec__.origin '' 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 "", line 1, in
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 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 > [email protected] > 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 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 "", line 1, in
> 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 wrote: > YES!!! +1 to the authors of the statistics and pathlib modules. > > > On Mon, Mar 17, 2014 at 1:29 AM, Larry Hastings 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 >> [email protected] >> 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 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' : > 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 wrote: > >> YES!!! +1 to the authors of the statistics and pathlib modules. >> >> >> On Mon, Mar 17, 2014 at 1:29 AM, Larry Hastings 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 >>> [email protected] >>> 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 > [email protected] > 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 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 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 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 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 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 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 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 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 : > On Tue, Mar 18, 2014 at 3:18 AM, Mark H Harris 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 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 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 : > On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa 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 wrote:
> Chris Angelico :
>
>> On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa 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ć" 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, 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: [email protected]
Subject: Re: Installing binwalk on Portable Python
On Mon, Mar 17, 2014 at 12:56 PM, 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, 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, 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 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 : > 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 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 <[email protected]>, [email protected] 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/pyt
Re: 'complex' function with string argument.
On Mon, Mar 17, 2014 at 5:06 PM, Terry Reedy 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. 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 wrote: > On Fri, Mar 14, 2014 at 6:13 PM, Joshua Landau 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 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
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 "", line 1, in
File "", 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, 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 wrote: > On Tue, Mar 18, 2014 at 10:59 AM, Skip Montanaro 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 Chris Angelico
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
[email protected] '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 <[email protected]>, [email protected] 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 D
Re: 'complex' function with string argument.
On Mon, 17 Mar 2014 21:22:18 +0200, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa
>> 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)
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
j
+j
-j
For the same reason that float("2") works, we should also allow strings
that look like:
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 "", line 1, in
> 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 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" wrote in message news:CAPTjJmqPca5cnNWu8T5BZhpH665X0=mrf7bjalqvrqvmjzw...@mail.gmail.com... > On Tue, Mar 18, 2014 at 12:06 AM, Frank Millman > 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
Re: Question about Source Control
On Tue, Mar 18, 2014 at 4:39 PM, Frank Millman wrote:
> 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.
I don't know about Mercurial, but with git, installing the software on
A lets it work more efficiently (otherwise it has to do all the work
remotely, ergo unnecessary traffic). Advantage of free software is
that you don't have to check license agreements - just go ahead,
install it everywhere. But if for some reason that would be a problem,
you can look into running it over basic SSH or something.
> 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?
That would be the simplest to set up. But here are two alternatives:
1) My current setup for developing Gypsum involves development on
Sikorsky, on Linux, and everything gets tested there. Then every once
in a while, I pull changes to Traal, and test on Windows. If there's a
problem, that's a separate commit fixing a separate issue ("Implement
pause key handling" / "Fix pause key handling on Windows"). That works
fairly well when you can do >90% of your testing on your development
box.
2) At work, we had a system for rapid development across two machines,
pretty much how you're describing. To make that work, I wrote a
three-part rapid send/receive system: a daemon that runs on the dev
system, a client that runs on the test system and connects to the
daemon, and a triggering notification that runs on the dev and tells
the daemon to do its work. (That could be done with a process signal,
but I wanted to send it some parameters.) When the daemon gets
notified to send its stuff across, it writes out the full content of
all changed files (mangled somewhat because my boss was paranoid -
well, as far as I know he's still utterly paranoid, but he's not my
boss any more) to the socket connection, and the receiver plops them
onto the disk and SIGHUPs the appropriate processes to tell them to
reload code.
The second option takes some setting up, though I'd be happy to help
out with the code. But it's really easy to use. You shoot stuff across
to it and off it all goes. The way I described above, it's quite happy
to have multiple simultaneous clients, and it's happy for those
clients to be behind NAT - so you can run half a dozen VMs with
different configurations, and have them all get the code together. And
you can put the trigger into a makefile to be run at the end of some
other tasks, or have it do some sanity checking, or whatever you like.
Very flexible and powerful.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
Re: Question about Source Control
"Chris Angelico" wrote in message news:captjjmqhxh2m3-qgbelv_akgajzmeymbudly8_dkpnhrpsu...@mail.gmail.com... > On Tue, Mar 18, 2014 at 4:39 PM, Frank Millman wrote: >> 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. > > I don't know about Mercurial, but with git, installing the software on > A lets it work more efficiently (otherwise it has to do all the work > remotely, ergo unnecessary traffic). Advantage of free software is > that you don't have to check license agreements - just go ahead, > install it everywhere. But if for some reason that would be a problem, > you can look into running it over basic SSH or something. > Excuse my ignorance, but how does it actually work? Do you set up some kind of client/server relationship, and if so, how do the clients (machines B and C) access the software on machine A? I know that Mercurial can run its own web server, and clients can access it through http. It that what you are suggesting? That would be quite a change for me, as on my linux box I do all my work from the command line on a console. These are the kind of stumbling blocks that prevented me from succeeding in my previous attempt. I have a vague recollection that I set it up on machine A, but then hit a problem because machines B and C both accessed the same directory, but with different names - on Windows, a mapped drive and on linux a mounted nfs directory. I had to provide a 'path' name to set up Mercurial in the first place, but I could not find one that suited both clients. I feel that I have just not grasped the basics yet, so any assistance that puts me on the right path is appreciated. Frank -- https://mail.python.org/mailman/listinfo/python-list
Re: Question about Source Control
"Frank Millman" writes: > I feel that I have just not grasped the basics yet, so any assistance that > puts me on the right path is appreciated. Here is “Hg Init”, a tutorial for Mercurial http://hginit.com/>. (“source control” is not the most common term for this; what we're talking about is a “version control system”, or VCS. But some Git users may disagree.) -- \ “If nature has made any one thing less susceptible than all | `\others of exclusive property, it is the action of the thinking | _o__) power called an idea” —Thomas Jefferson | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Question about Source Control
"Andriy Kornatskyy" wrote in message news:[email protected]... > 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. I followed your link, which took me to another link which took me to RhodeCode - https://rhodecode.com/ It looks interesting. I wll investigate that and bitbucket further. Frank -- https://mail.python.org/mailman/listinfo/python-list
