Problems compiling Python 3.4 on Ubuntu
Hi, I'm trying to install Python 3.4b3 on Ubuntu. Since compilation seems to be the only way, I'm trying that. I downloaded the source, I changed Setup.dist to have this: SSL=/usr _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto I installed openssl and various sqlite packages beforehand. But when I do this: ./configure --prefix=/opt/python3.4 && make && make install I get, after a huge wall of text, this: ./Modules/_ssl.c:57:25: fatal error: openssl/rsa.h: No such file or directory #include "openssl/rsa.h" ^ compilation terminated. What do I do to solve this? Thanks, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Question about `list.insert`
Hi, I'm curious. If I append an item to a list from the left using `list.insert`, will Python always move the entire list one item to the right (which can be super-slow) or will it check first to see whether it can just allocate more memory to the left of the list and put the item there, saving a lot of resources? Thanks, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Python MSI not installing, log file showing name of a Viatnemese communist revolutionary
Hi everybody, I need to install Python 3.4 final urgently, because my IDE stopped supporting Python 3.4 beta2, and I need it urgently to work. I downloaded it, but the MSI won't install. It didn't work on both of my computers (Windows 7 64bit). I managed to have the MSI dump data to log, file attached. I couldn't help but notice this line in the log: The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2726. The arguments are: HO_CHI~1|Ho_Chi_Minh A Google search shows this: http://en.wikipedia.org/wiki/Ho_Chi_Minh What the hell. Was python.org hacked by communists? Please, I need to get back to work and I can't. Thanks, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary
Sorry, couldn't attach the file, here's the log file: https://gist.github.com/anonymous/9697505 On Saturday, March 22, 2014 12:05:59 AM UTC+2, cool-RR wrote: > Hi everybody, > > > > I need to install Python 3.4 final urgently, because my IDE stopped > supporting Python 3.4 beta2, and I need it urgently to work. > > > > I downloaded it, but the MSI won't install. It didn't work on both of my > computers (Windows 7 64bit). > > > > I managed to have the MSI dump data to log, file attached. > > > > I couldn't help but notice this line in the log: > > > > The installer has encountered an unexpected error installing this > package. This may indicate a problem with this package. The error code is > 2726. The arguments are: HO_CHI~1|Ho_Chi_Minh > > > > A Google search shows this: http://en.wikipedia.org/wiki/Ho_Chi_Minh > > > > What the hell. Was python.org hacked by communists? > > > > Please, I need to get back to work and I can't. > > > > > > Thanks, > > Ram. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary
I did download from python.org. I checked the md5, it was incorrect, then I downloaded again by using a proxy in Austria. (Which hopefully the communists haven't be able to infiltrate? ;) Now it worked! Woohoo! I'm still curious about the bad installation file... And what Ho Chi Minh is doing in the Python MSI. (I'm guessing it's timezone-related, but it's still far-fetched, because why would an obscure time zone file appear in the MSI log?) On Saturday, March 22, 2014 12:25:03 AM UTC+2, Chris Angelico wrote: > On Sat, Mar 22, 2014 at 9:05 AM, cool-RR wrote: > > > I downloaded it, but the MSI won't install. It didn't work on both of my > > computers (Windows 7 64bit). > > > > > > What the hell. Was python.org hacked by communists? > > > > First question: Where did you download from? What file did you get? > > > > (First and a halfth question: When you say "won't install", exactly > > what do you mean? Error message? Hard drive exploded in a fiery > > inferno? Your boss tapped you on the shoulder and said "Kill that > > process"?) > > > > Secondly, do you have a tool for checking the MD5 hash of a file? > > Compare the file you have against the official checksum: > > > > https://www.python.org/downloads/release/python-340/ > > > > I'm slightly surprised the python.org installers have MD5s and not > > something more cryptographically secure; there are GPG signatures, but > > it takes a bit more fiddling to check those. > > > > Finally, take the simple approach: Re-download the file, straight from > > python.org, and see if it happens again. > > > > ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary
Here's the offending MSI, if anyone wants to investigate: https://dl.dropboxusercontent.com/u/1927707/python-3.4.0.amd64.msi On Saturday, March 22, 2014 12:34:06 AM UTC+2, cool-RR wrote: > I did download from python.org. I checked the md5, it was incorrect, then I > downloaded again by using a proxy in Austria. (Which hopefully the communists > haven't be able to infiltrate? ;) > > > > Now it worked! Woohoo! > > > > I'm still curious about the bad installation file... And what Ho Chi Minh is > doing in the Python MSI. (I'm guessing it's timezone-related, but it's still > far-fetched, because why would an obscure time zone file appear in the MSI > log?) > > > > On Saturday, March 22, 2014 12:25:03 AM UTC+2, Chris Angelico wrote: > > > On Sat, Mar 22, 2014 at 9:05 AM, cool-RR wrote: > > > > > > > I downloaded it, but the MSI won't install. It didn't work on both of my > > > computers (Windows 7 64bit). > > > > > > > > > > > > > > What the hell. Was python.org hacked by communists? > > > > > > > > > > > > First question: Where did you download from? What file did you get? > > > > > > > > > > > > (First and a halfth question: When you say "won't install", exactly > > > > > > what do you mean? Error message? Hard drive exploded in a fiery > > > > > > inferno? Your boss tapped you on the shoulder and said "Kill that > > > > > > process"?) > > > > > > > > > > > > Secondly, do you have a tool for checking the MD5 hash of a file? > > > > > > Compare the file you have against the official checksum: > > > > > > > > > > > > https://www.python.org/downloads/release/python-340/ > > > > > > > > > > > > I'm slightly surprised the python.org installers have MD5s and not > > > > > > something more cryptographically secure; there are GPG signatures, but > > > > > > it takes a bit more fiddling to check those. > > > > > > > > > > > > Finally, take the simple approach: Re-download the file, straight from > > > > > > python.org, and see if it happens again. > > > > > > > > > > > > ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary
On Saturday, March 22, 2014 12:42:56 AM UTC+2, Chris Angelico wrote: > I think you should follow the internet version of Hanlon's Razor here: > Damaged transmission before deliberate tampering. :) It's far more > likely something simply got misdownloaded, and your guess about > timezones is the most likely one - the Asia/Ho_Chi_Minh timezone [1], > and I believe Python Windows installers include a full zoneinfo > database. The thing is, I then tried other versions of Python 3.4, like b2, and the 32 bit version, and they didn't work either... So damaged transmission of 3 separate files? I'm not seeing any other damaged files when surfing using this connection. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary
On Saturday, March 22, 2014 12:25:03 AM UTC+2, Chris Angelico wrote: > (First and a halfth question: When you say "won't install", exactly > what do you mean? For completeness, I'll answer this question I forgot to answer, in case someone still wants to investigate: It just showed the first dialog (Something like "Preparing to install..."), after a few seconds it disappeared and then nothing. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python MSI not installing, log file showing name of a Viatnemese communist revolutionary
On Saturday, March 22, 2014 3:39:21 AM UTC+2, Terry Reedy wrote: > Does your .b2 install work? Can you delete it thru the programs list? I uninstalled it before this entire adventure. -- https://mail.python.org/mailman/listinfo/python-list
Specifying `blocking` and `timeout` when acquiring lock as a context manager
Hi all, If I want to acquire a `threading.Lock` using the context manager protocol, is it possible to specify the `blocking` and `timeout` arguments that `acquire` would usually take? Thanks, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Using asyncio workers in a `concurrent.futures` interface
Hello everybody! I have a question. I have a Django app running on Heroku. I need to run about 100 worker threads there to do uploads/downloads simultaneously. A Heroku Dyno has only 512MB of memory, so I'm reluctant to run 100 worker threads. (I've had Dynos crash from lack of memory when using 6 threads before.) I heard that the asyncio module is mature and ready for usage, and I was happy because I kept hearing about it in the last year, and I saw Guido's lecture about it. If I understand correctly it would let me run multiple uploads and downloads efficiently in one thread, which would conserve more resources than using threads. (Please correct me if I'm wrong.) Now, I am a little clueless about the whole way it's built, using coroutines and tricky usage of `yield from`. I figured that since this is eventually a library for concurrency, i.e. doing many tasks at the same time, there will be an API in a style of "Here are 100 tasks for you to do concurrently, let me know when they're done." I looked at the asyncio documentation page and saw that it does mention futures and executors, which is my favorite interface for doing concurrency. I was happy and I skimmed the docs. But, I couldn't find a simple way to use these. I don't want to learn how to define coroutines and use `yield from` to switch between them. (I use `yield from` regularly and fully understand how it works, I just don't write my programs that way.) What I'm expecting is something like this: download_file = lambda url: requests.get(url).content urls = ['http://google.com/file1.jpg', 'http://google.com/file2.jpg', 'http://google.com/file3.jpg'] # etc. with AsyncIOExecutor() as asyncio_executor: files = asyncio_executor.map(download_file, urls) And that's it, no coroutines, no `yield from`. Since, if I understand correctly, asyncio requires a mainloop, it would make sense for the AsyncIOExecutor to have a thread of its own in which it could run its mainloop. Is this possible? Did someone implement this? Thanks for your help, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
While debugging my code I found that the bug was because I assumed that something like `divmod(float('inf'), 1)` would be equal to `(float('inf'), float('nan'))`, while Python returns `(float('nan'), float('nan'))`. Why does Python make the division result be NaN in this case? `float('inf') / 1` is still `float('inf')`. Thanks, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
Terry, that doesn't really answer the question "why", it just pushes it back to the documentation. Is there a real answer why? Why return NaN when Inf would make mathematical sense? On Wednesday, September 17, 2014 4:13:38 AM UTC+3, Terry Reedy wrote: > On 9/16/2014 5:40 PM, cool-RR wrote: > > > While debugging my code I found that the bug was because I assumed > > > that something like `divmod(float('inf'), 1)` would be equal to > > > `(float('inf'), float('nan'))`, while Python returns `(float('nan'), > > > float('nan'))`. Why does Python make the division result be NaN in > > > this case? `float('inf') / 1` is still `float('inf')`. > > > > For integers, divmod(x, y) is defined as (x // y, x % y) == ((x - x%y) > > // y, x % y) == ((x - x%y) / y, x % y). > > > > For floats, Python is documented as using the third expression. > > > > "Help on built-in function divmod in module builtins: > > divmod(...) > > divmod(x, y) -> (div, mod) > > Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x." > > > > It does not really matter, however, as infinity cannot be 'floored' as > > required for // > > > > >>> math.floor(float('inf')) > > Traceback (most recent call last): > >File "", line 1, in > > math.floor(float('inf')) > > OverflowError: cannot convert float infinity to integer > > > > and hence > > > > >>> float('inf') // 1.0 > > nan > > > > -- > > Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
On Wednesday, September 17, 2014 6:10:35 PM UTC+3, Chris Angelico wrote: > On Thu, Sep 18, 2014 at 12:55 AM, cool-RR wrote: > > Terry, that doesn't really answer the question "why", it just pushes it > > back to the documentation. Is there a real answer why? Why return NaN when > > Inf would make mathematical sense? > > > To answer that, we have to first look at what it means to do > operations on Inf. The definition of "Infinity + 1" is the limit of "x > + 1" as x goes toward positive infinity - which is positive infinity. > Same with infinity-1, infinity/1, infinity*1, etc, etc, etc. So far, > so good. But as x tends toward positive infinity, the value of "x // > 1" (or simply of floor(x)) doesn't simply increase tidily. It goes up > in little jumps, every time x reaches a new integer. Despite the fact it goes up in jump, it still satisfies the mathematical condition needed for a limit. (I won't quote the epsilon-delta thing but I think you can find it.) > And while it's > conceivable to define that infinity divided by anything is infinity, > and infinity modulo anything is zero, that raises serious issues of > primality and such; > I'm not sure that that would really help anything. I didn't ask for the modulo, I agree it should remain NaN. I'm talking about the floor division. I don't see any problems this will cause with primality. "I'm not sure that that would really help anything" is a little bit too vague. Thanks, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
On Wednesday, September 17, 2014 6:30:04 PM UTC+3, Chris Angelico wrote: > On Thu, Sep 18, 2014 at 1:16 AM, cool-RR wrote: > > I didn't ask for the modulo, I agree it should remain NaN. I'm talking > > about the floor division. > > Invariant: div*y + mod == x. > If mod is NaN, there is no possible value for div that will make the > invariant true, ergo it too has to be NaN. > ChrisA Chris, why is this invariant `div*y + mod == x` so important? Maybe it's more important to return a mathematically reasonable result for the the floor-division result than to maintain this invariant? Thanks, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`
On Thursday, September 18, 2014 6:12:08 AM UTC+3, Steven D'Aprano wrote: > cool-RR wrote: > > Chris, why is this invariant `div*y + mod == x` so important? Maybe it's > > more important to return a mathematically reasonable result for the the > > floor-division result than to maintain this invariant? > > You keep talking about floor(inf) == inf being "mathematically reasonable", > but I'm not convinced that it is. Can you justify why you think it is > mathematically reasonable? http://i.imgur.com/9SoBbXG.png > [1] But *which* mathematical infinity? One of the cardinal infinities, the > alephs, or one of the ordinal infinities, the omegas and the epsilons? The alephs are about sizes of sets, they have nothing to do with limits. When talking about limits, which is what this is about, there is no need for any variety of infinities. Thanks, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Is there a canonical way to check whether an iterable is ordered?
My function gets an iterable of an unknown type. I want to check whether it's ordered. I could check whether it's a `set` or `frozenset`, which would cover many cases, but I wonder if I can do better. Is there a nicer way to check whether an iterable is ordered or not? Thanks, Ram. -- https://mail.python.org/mailman/listinfo/python-list
Announcing PythonTurtle
Hello, I wanted to announce that I have just released my little side project, PythonTurtle. Here is its website: http://pythonturtle.com Its goal is to be the lowest-threshold way to learn (or teach) Python. You can read more about it and download it on the website. Ram. -- http://mail.python.org/mailman/listinfo/python-list
Re: Announcing PythonTurtle
On Aug 3, 5:53 pm, André wrote: > On Aug 3, 10:18 am, cool-RR wrote: > > > Hello, > > > I wanted to announce that I have just released my little side project, > > PythonTurtle. > > Here is its website:http://pythonturtle.com > > > Its goal is to be the lowest-threshold way to learn (or teach) Python. > > You can read more about it and download it on the website. > > > Ram. > > Why not make the source available? At the very least, people that do > not run windows could try it too. > > André Sorry that the link is obscure like that. I'll change it so it's easier to see. -- http://mail.python.org/mailman/listinfo/python-list
Re: Announcing PythonTurtle
On Aug 3, 7:04 pm, "Colin J. Williams" wrote: > cool-RR wrote: > > Hello, > > > I wanted to announce that I have just released my little side project, > > PythonTurtle. > > Here is its website: > >http://pythonturtle.com > > > Its goal is to be the lowest-threshold way to learn (or teach) Python. > > You can read more about it and download it on the website. > > > Ram. > > It looks neat but it's not yet ready for prime time. > > Colin W. I agree there's a lot that can be improved - I wanted to put it out there so I could get feedback and fix the important things first. So I'd appreciate you telling me what you think needs improvement. Ram. -- http://mail.python.org/mailman/listinfo/python-list
Re: Announcing PythonTurtle
On Aug 3, 11:35 pm, r wrote: > Hello, > I wanted to announce that I have just released my little side > project, > PythonTurtle. > [snip] > > I think it looks great --haven't download the source yet-- but i > really like the screenshot. This will be more "inviting" to the new, > inexperianced users. I like the idea of packaging up the command > prompt and the canvas into one very friendly interface. I especially > like that you are using a "real" turtle. > > I can remember the first time i used turtle (in python stdlib) and i > kept saying to myself... > > "Were the heck is this damn turtle?!?!" (>_<) > > :-) Thanks for the compliments; The things you mentioned you liked are all things that I was specifically thinking about when I decided to make PythonTurtle. Well, maybe minus the screenshot :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Announcing PythonTurtle
On Aug 4, 7:12 am, John Posner wrote: > > ... I would also venture to say a key-map > > of sorts that is available thru the help menu where one could push an > > "Up" button, or a "rotate" button, and have the proper command > > inserted in the prompt, and then have the command execute, may also > > help make the connections here, a sort of *real* Visual Basic > > programming -- sorry Microsoft :P > > Along these lines, see my "ClixTur" application atwww.jjposner.net. > It's a point-and-click front end to the standard Python turtle module, > implementing only a very small subset of the turtle commands. As you > click, the "real turtle commands" appear in a transcript window. You can > then save (and maybe edit) and replay the transcript. > > Ram, I like a lot of what you've done. Could you talk about your > decision to embed the standard turtle module (which is implemented in > Tkinter) in a wxPython application? > > -John Certainly John- although I have not embedded the turtle module at all, I just wrote my own. This was actually quite a short process - What took the most time was developing the shell, which is a fork of PyShell. The original PyShell controls the same process it is run on, but my fork controls a different process (created by the multiprocessing package.) That took a lot of time. I actually created an independent package for it, called "shelltoprocess", which is a subfolder in PythonTurtle's source, so now anyone can use it for their own project. I am proud to say that this shell has some features that IDLE should envy. If you're asking WHY I put it in a wxPython application, the answer is pretty much what "r" said: To make it like any other "over the counter" Windows application, making people feel more comfortable with it. Also, not requiring them to install Python+packages, but just PythonTurtle. Ram. -- http://mail.python.org/mailman/listinfo/python-list
Re: Announcing PythonTurtle
> Hi Ram, > > that's indeed a nice starting point for kids to doing turtle graphics, > although currently it seems to implement only a very small subset of > Python's turtle module's capabilities, even less than those of the old > turtle module (that shipped with Python upto 2.5). > I agree - an undo feature for example would be nice and it's something I would like to do in a future version. Other than that though, I don't think having many turtle-functions is so important. I think the important thing is for the student to build complex things from simple building blocks. > Moreover I have to complain that you decided to use different commands > for the turtle's actions - go instead of forward, turn instead of left > and right etc. First I think left and right are more intuitive than turn > as they do not need negative angles as arguments, which might matter for > young children. Also I cannot see the advantage of cammands like > visible() or invisible() over showturtle() and hideturtle() > But second even kids - when learning how to program - will arrive at a > point where it's no more problem to use an editor like IDLE so they > could easily switch to Python's turtle module. That would be even easier > if they had not to learn a new command set. > Moreover a learning environment like PythonTurtle needs something like > an editor - at least a simple one - in order to create programs that can > be run repeatedly. Coding, that's creating programs - not only issuing > a sequence of cammands interactively. > A text editor would be a good feature for future versions. Regarding the naming of functions: I named them in the way that seemed best to me. You seem not to agree, you like the way your functions are named better, and there's little point in arguing over which convention is truly better. The convention I chose is the one that seemed ideal to me. I did consider naming the functions the same way you did for consistency, but I decided not to compromise the quality of PythonTurtle just to be compatible with a module that my users may not even use. > It would be certainly a good thing if one had a similar environment > using Tkinter, preferably also as part of the standard distribution of > Python accompanying the turtle module. I think it should not be that > difficult to create a GUI of this sort combining IDLE's shell window, > its editor and turtle.py. Alas, at the moment I'm too busy with some > othr work to start a project like this. Perhaps someone else might be > interested? I'd enjoy to join a team doing it. I agree that it shouldn't be difficult; The question is whether someone will step up and do it. > Finally I'd like to stress, that the aims of PythonTurtle and Python's > turtle module are quite different - as one could grasp easily by trying > out the collection of examples at python-turtle-demo.googlecode.com that > I posted in another posting. Anyway they could very well complement one > another in some more mature state of development. > > Best regards, > Gregor Thank you for your feedback Gregor. Ram Rachum. -- http://mail.python.org/mailman/listinfo/python-list
Re: Announcing PythonTurtle
On Tue, Aug 4, 2009 at 5:45 PM, John Posner wrote: > > Certainly John- although I have not embedded the turtle module at all, >> I just wrote my own. >> > > OK, then why the statements "from turtle import *" in the modules > turtleprocess.py and turtlewidget.py? > > Tx, > John > > It's from a module turtle.py in my own PythonTurtle package. -- Sincerely, Ram Rachum -- http://mail.python.org/mailman/listinfo/python-list