Re: Google Cloud Platform and GlassSolver Project
eliasbylar...@gmail.com wrote: > I am fully ready to invest in the Google Cloud Platform, and bring > with me my very own idea: Glass Solver (Sometimes called GlaSolver). One thing you will have to do is find another name for your project. https://developers.google.com/glass/design/branding-guidelines says: > Glass is never part of the name of your business, Glassware, other > products. Instead, use "for Glass." If you use "for Glass" in > conjunction with a logo, "for Glass" must be a smaller size than the > rest of the logo. > > Correct: "Cat Facts for Glass" > > Incorrect: "Glass Cat Facts", "Glassy Cat Photos" -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
Asaf Las writes: > btw, Python could be language of choice for embedded systems if small > footprint > vm could be developed. had seen similar for java having 10-20 KB byte sized > interpreter with very limited set of functions. Well, there's the newish Micro python project. Its footprint is apparently about 60 kB at a minimum (Thumb2 code on ARM). Their kickstarter is at https://www.kickstarter.com/projects/214379695/micro-python-python-for-microcontrollers and source at https://github.com/micropython/micropython The kickstarter was for funding development and a small board with ST's Cortex-M4 on it. The source code includes Windows and Unix targets so it's easy to experiment with without a board too. -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
Wesley wrote: > [Wesley] This is not homework:-) > And actually I am new to algorithm, so you guys can feel free to say anything > you want In general, we cannot sort a sequence in O(n) time. O(n log n) is the lower bound on the complexity. -- https://mail.python.org/mailman/listinfo/python-list
Re: Using virtualenv to bypass sudoer issues
Thank you all for you insights. I'll probably go with virtualenv, I'll be able to distribute it among the team. There's still one point worrying me though: We're doing a lot a remote execution. We're using "execnet" http://codespeak.net/execnet/, and I'm not sure it can be compatible with virtualenv. execnet working at the "python level" I don't see how I can execute shell stuff before. I had a look at fabric http://docs.fabfile.org/en/1.8/, and it looks like it can handle virtual env (anyone confirm?). Has someone already successfully remotely activated a venv then execute a python scripts within that env, getting back the stdout/stderr ? I'm afraid right now that switching to venv would mean switching from execnet to fabric as well (I hate redoing stuff that works :-/ ). JM -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
On Mon, Feb 10, 2014 at 9:20 PM, Sturla Molden wrote: > Wesley wrote: >> [Wesley] This is not homework:-) >> And actually I am new to algorithm, so you guys can feel free to say >> anything you want > > In general, we cannot sort a sequence in O(n) time. O(n log n) is the lower > bound on the complexity. That's assuming it really is a sort operation. The problem description isn't entirely clear on this point, but if it's actually a zip, then it can definitely be done in O(n). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Vedr: What does """ means in python?
Gisle Vanem wrote: > Regrading handy uses of ''', you learned me one trick when using Pythonÿ > code in a Windows .bat file: > > rem = ''' > @echo off > echo This is batch > \python32\python %0 > echo All done > exit /b > rem ''' > import sys > print("This is Python") > for i,p in enumerate(sys.path): > print('sys.path[%2d]: %s' % (i, p)) > print("Python done") > You'll have a variable in Python called 'rem' which contains all > your > batch code :) It exploits the fact that 'rem' makes a > one-line > comment, but the triple quotes go across multiple lines. > A better trick would be to use a Powershell script instead of a batch file: --- filter python() { $_ | c:\Python33\python.exe ($args -replace'(\\*)"','$1$1\"') } Write-Host "This is the powershell script" dir cert: | convertto-json | python -c @" import json, sys stores = json.loads(sys.stdin.read()) print("This is Python") for store in stores: print("{}: {}".format(store['PSChildName'], ', '.join(store['StoreNames']))) print("Python done") "@ Write-Host "All done" --- C:\scripts> . .\Pythoncerts.ps1 This is the powershell script This is Python CurrentUser: Root, UserDS, Disallowed, Trust, My, TrustedPublisher, SmartCardRoot, TrustedPeople, ADDRESSBOOK, AuthRoot, McAfee Trust, CA, REQUEST, ACRS LocalMachine: Disallowed, Trust, CA, TrustedPublisher, SmartCardRoot, My, TrustedPeople, AuthRoot, TrustedDevices, Root Python done All done C:\scripts> Notes on the above: Powershell messes up arguments when running legacy programs. The filter ensures that all arguments pass through Windows command line processing unscathed (except they can't contain null characters). You don't actually have to use the filter if you are careful about how you write quotes in the code, but it makes life simpler. Python scripts up to just over 32,000 characters can be written on the command line this way. You can also assign the script to a variable and keep the Python command a bit cleaner: $script = @" print("Python here!") "@ python -c $script Or without the filter it is best to avoid the double quotes: $script = @" print('Python here!') "@ c:\python33\python.exe -c $script To run from a traditional cmd.exe prompt you have to explicitly use Powershell. The default file associations for .ps1 files will run notepad instead. If your system execution policy is Restricted (the default) use: powershell -executionpolicy RemoteSigned .\Pythoncerts.ps1 Otherwise set the execution policy to something more lenient (at a Powershell prompt running as administrator enter "Set-ExecutionPolicy RemoteSigned") and you can just do: powershell .\Pythoncerts.ps1 I also use Powershell interactively so I have the filters defined in my startup ($Home\Documents\WindowsPowerShell\profile.ps1): filter py() { $_ | py.exe ($args -replace'(\\*)"','$1$1\"') } filter python() { $_ | c:\Python33\python.exe ($args -replace'(\\*)"','$1$1\"') } -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list
Re: Google Cloud Platform and GlassSolver Project
On Monday, February 10, 2014 4:12:40 AM UTC-5, Duncan Booth wrote: > EliasL wrote: > > > > > I am fully ready to invest in the Google Cloud Platform, and bring > > > with me my very own idea: Glass Solver (Sometimes called GlaSolver). > > > > One thing you will have to do is find another name for your project. > > https://developers.google.com/glass/design/branding-guidelines says: > > > > > Glass is never part of the name of your business, Glassware, other > > > products. Instead, use "for Glass." If you use "for Glass" in > > > conjunction with a logo, "for Glass" must be a smaller size than the > > > rest of the logo. > > > > > > Correct: "Cat Facts for Glass" > > > > > > Incorrect: "Glass Cat Facts", "Glassy Cat Photos" > > > > > > > > -- > > Duncan Booth http://kupuguy.blogspot.com Thanks! This name is rather temporary to begin with. I won't necessarily keep that name in the future. As for now, that is my first name and for now I will be keeping it (until it is released) -- https://mail.python.org/mailman/listinfo/python-list
Re: Google Cloud Platform and GlassSolver Project
On Sunday, February 9, 2014 9:57:42 PM UTC-5, Dave Angel wrote: > EliasL Wrote in message: > > > Also I should mention that I will credit whomever writes the scripts. I > > have contacted Google on their Compute Engine which would execute these > > scripts. I am await a reply! > > > > > > > It might help if you mention that you're talking about the Rubic > > cube, and supply an example of what you want in such a script. > > > > > > -- > > DaveA I came here because I don't know what the script needs to be. I will edit my post anyway to add some details. I didn't once say Rubik's Cube? :O -- https://mail.python.org/mailman/listinfo/python-list
Re: Google Cloud Platform and GlassSolver Project
Boy am I glad that this is still alive! What do I mean? Click: http://www.speedsolving.com/forum/showthread.php?46268-Introducing-GlassSolver-back-and-better-than-ever!&p=951473 -- https://mail.python.org/mailman/listinfo/python-list
Pylint across Python versions
Hi, somebody who can tell me about pylint experiences across different Python version. Example: I'm using a construct like this: if sys.version.startswith("3."): unicode = str The reason is that Python 3 does not have this function anymore but pylint yells for Python < 3 about redefinition also it does not happen. How to get forward with this? Regards, Thomas -- https://mail.python.org/mailman/listinfo/python-list
Re: Google Cloud Platform and GlassSolver Project
On 10/02/2014 11:09, EliasL wrote: [all double line spaced stuff snipped] Would you please read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the double line spacing that you are sending, thanks. -- 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: Pylint across Python versions
On 10/02/2014 11:39, thomas.lehm...@adtech.com wrote: Hi, somebody who can tell me about pylint experiences across different Python version. Example: I'm using a construct like this: if sys.version.startswith("3."): unicode = str The reason is that Python 3 does not have this function anymore but pylint yells for Python < 3 about redefinition also it does not happen. I've no idea what the above is saying but see below anyway. How to get forward with this? Regards, Thomas >>> import sys >>> sys.version '3.4.0b2 (v3.4.0b2:ba32913eb13e, Jan 5 2014, 16:23:43) [MSC v.1600 32 bit (Intel)]' >>> sys.version.startswith('3.') True >>> -- 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: Pylint across Python versions
On Mon, Feb 10, 2014 at 10:39 PM, wrote: > Example: > I'm using a construct like this: > > if sys.version.startswith("3."): > unicode = str > > The reason is that Python 3 does not have this > function anymore but pylint yells for Python < 3 > about redefinition also it does not happen. > > How to get forward with this? It's more common to spell that with a try/except. Does pylint complain if you use this instead? try: unicode except NameError: unicode = str Although it would be better to write your code for Python 3, and have compatibility code at the top for Python 2. That would mean using 'str' everywhere, and then having this at the top: try: str = unicode except NameError: pass That way, when you're ready to drop support for Python 2, you simply delete the compat code and everything works. Otherwise, you have to maintain messy code indefinitely. Alternatively, to avoid redefinition at all, you could use your own name everywhere: try: unicode_string = unicode except NameError: unicode_string = str Use something less unwieldy if you prefer, but this avoids any chance of collision :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
Le samedi 8 février 2014 03:48:12 UTC+1, Steven D'Aprano a écrit : > > > We consider it A GOOD THING that Python spends memory for programmer > > convenience and safety. Python looks for memory optimizations when it can > > save large amounts of memory, not utterly trivial amounts. So in a Python > > wide build, a ten-thousand block character string requires a little bit > > more than 40KB. In Python 3.3, that can be reduced to only 10KB for a > > purely Latin-1 string, or 20K for a string without any astral characters. > > That's the sort of memory savings that are worthwhile, reducing memory > > usage by 75%. > > > In its attempt to save memory, Python only succeeds to do worse than any utf* coding schemes. --- Python does not save memory at all. A str (unicode string) uses less memory only - and only - because and when one uses explicitly characters which are consuming less memory. Not only the memory gain is zero, Python falls back to the worse case. >>> sys.getsizeof('a' * 100) 125 >>> sys.getsizeof('a' * 100 + 'oe') 240 >>> sys.getsizeof('a' * 100 + 'oe' + '\U0001') 448 The opposite of what the utf8/utf16 do! >>> sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) 123 >>> sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-16')) 225 jmf -- https://mail.python.org/mailman/listinfo/python-list
Re: Using virtualenv to bypass sudoer issues
Jean-Michel Pichavant writes: > Thank you all for you insights. > > I'll probably go with virtualenv, I'll be able to distribute it among > the team. > There's still one point worrying me though: > We're doing a lot a remote execution. We're using "execnet" > http://codespeak.net/execnet/, and I'm not sure it can be compatible > with virtualenv. execnet working at the "python level" I don't see how > I can execute shell stuff before. > > I had a look at fabric http://docs.fabfile.org/en/1.8/, and it looks > like it can handle virtual env (anyone confirm?). > > Has someone already successfully remotely activated a venv then > execute a python scripts within that env, getting back the > stdout/stderr ? > > I'm afraid right now that switching to venv would mean switching from > execnet to fabric as well (I hate redoing stuff that works :-/ ). Call the venv version of python and activation is handled. E.g. in a fabfile myenv/bin/python myscript.py -- Pete Forman -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Monday, February 10, 2014 4:07:14 PM UTC+2, wxjm...@gmail.com wrote: Interesting > >>> sys.getsizeof('a' * 100) here you get string type > >>> sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) and here bytes >>> type ('a' * 1) >>> type(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) >>> Why? -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On 10/02/2014 14:25, Asaf Las wrote: On Monday, February 10, 2014 4:07:14 PM UTC+2, wxjm...@gmail.com wrote: Interesting sys.getsizeof('a' * 100) here you get string type sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) and here bytes type ('a' * 1) type(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) Why? Please don't feed this particular troll, he's spent 18 months driving us nuts with his nonsense. -- 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: Finding size of Variable
On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: > Python does not save memory at all. A str (unicode string) > uses less memory only - and only - because and when one uses > explicitly characters which are consuming less memory. > > Not only the memory gain is zero, Python falls back to the > worse case. > > >>> sys.getsizeof('a' * 100) > 125 > >>> sys.getsizeof('a' * 100 + 'oe') > 240 > >>> sys.getsizeof('a' * 100 + 'oe' + '\U0001') > 448 If Python used UTF-32 for EVERYTHING, then all three of those cases would be 448, so it clearly disproves your claim that "python does not save memory at all". > The opposite of what the utf8/utf16 do! > > >>> sys.getsizeof(('a' * 100 + 'oe' + > >>> '\U0001').encode('utf-8')) > 123 > >>> sys.getsizeof(('a' * 100 + 'oe' + > >>> '\U0001').encode('utf-16')) > 225 However, as pointed out repeatedly, string-indexing in fixed-width encodings are O(1) while indexing into variable-width encodings (e.g. UTF8/UTF16) are O(N). The FSR gives the benefits of O(1) indexing while saving space when a string doesn't need to use a full 32-bit width. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: Using virtualenv to bypass sudoer issues
> Call the venv version of python and activation is handled. > E.g. in a fabfile > > myenv/bin/python myscript.py > > -- > Pete Forman > -- > https://mail.python.org/mailman/listinfo/python-list wow, the solution is so nice and simple. JM -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On 2/10/14 9:43 AM, Tim Chase wrote: On 2014-02-10 06:07, wxjmfa...@gmail.com wrote: Python does not save memory at all. A str (unicode string) uses less memory only - and only - because and when one uses explicitly characters which are consuming less memory. Not only the memory gain is zero, Python falls back to the worse case. sys.getsizeof('a' * 100) 125 sys.getsizeof('a' * 100 + 'oe') 240 sys.getsizeof('a' * 100 + 'oe' + '\U0001') 448 If Python used UTF-32 for EVERYTHING, then all three of those cases would be 448, so it clearly disproves your claim that "python does not save memory at all". The opposite of what the utf8/utf16 do! sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) 123 sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-16')) 225 However, as pointed out repeatedly, string-indexing in fixed-width encodings are O(1) while indexing into variable-width encodings (e.g. UTF8/UTF16) are O(N). The FSR gives the benefits of O(1) indexing while saving space when a string doesn't need to use a full 32-bit width. -tkc Please don't engage in this debate with JMF. His mind is made up, and he will not be swayed, no matter how persuasive and reasonable your arguments. Just ignore him. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
NYC-based Python Careers
Hey everyone! I am a Python developer recruiter based in NYC. I'm currently representing Fortune 500 companies as well as 5 person start ups that have needs for developers with basic to advanced Python skills. If you're looking for a career change in the area or want to experience NYC for the first time, feel free to reach out to me or pass my information along to someone who might want to utilize my services. I'm sure that many of the folks who frequent this group are experienced and have been contacted by recruiters before. Hopefully we haven't left a bad taste in your mouth as I am genuinely interested in helping you further your career or find your dream job. I look forward to working with any and all of you. Thanks, Matt Battista matthew.batti...@workbridgeassociates.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
Chris Angelico wrote: > That's assuming it really is a sort operation. The problem description > isn't entirely clear on this point, but if it's actually a zip, then > it can definitely be done in O(n). Ah, I didn't read it carefully enough. :-) Granted, a zip can be done in O(n) time and O(1) memory using a generator, which by the way is what itertools.izip does. Sturla -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
On Tue, Feb 11, 2014 at 2:03 AM, Sturla Molden wrote: > Chris Angelico wrote: > >> That's assuming it really is a sort operation. The problem description >> isn't entirely clear on this point, but if it's actually a zip, then >> it can definitely be done in O(n). > > Ah, I didn't read it carefully enough. :-) > > Granted, a zip can be done in O(n) time and O(1) memory using a generator, > which by the way is what itertools.izip does. Right. I poked around in itertools but nothing was quite what I was after, so I ended up writing my own generator. But it's still a zip operation, and as such, is just a variant form of iterating over the original list. All I do is follow a pattern other than the Red King's "Begin at the beginning, go on till you come to the end, then raise StopIteration" (or words to that effect). -- https://mail.python.org/mailman/listinfo/python-list
Re: NYC-based Python Careers
On Tue, Feb 11, 2014 at 2:06 AM, Matt Battista wrote: > I am a Python developer recruiter based in NYC. I'm currently representing > Fortune 500 companies as well as 5 person start ups that have needs for > developers with basic to advanced Python skills. If you're looking for a > career change in the area or want to experience NYC for the first time, feel > free to reach out to me or pass my information along to someone who might > want to utilize my services. > Hi! While some of us are indeed looking for jobs (myself included), the right place to discuss them is not the list itself, but the Python Job Board: http://www.python.org/community/jobs/ That's where people look. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
On 10 February 2014 15:03, Sturla Molden wrote: > Chris Angelico wrote: > >> That's assuming it really is a sort operation. The problem description >> isn't entirely clear on this point, but if it's actually a zip, then >> it can definitely be done in O(n). > > Ah, I didn't read it carefully enough. :-) > > Granted, a zip can be done in O(n) time and O(1) memory using a generator, > which by the way is what itertools.izip does. Yes but turning the generator into a list takes O(N) storage (for the new list!). The OP wants to rearrange a list in-place. Something like mylist[:] = reorder_generator(mylist) won't work because the generator would need to access the data non-sequentially (it would need to read elements after they were overwritten). The way to do this is to find the cycles of data movement i.e. the sets of indices for which a permutation occurs. If you know the size of the input then you can find these once and hard-code them. Otherwise you need an algorithm that finds each cycle exactly once using O(1) storage which is definitely not trivial. You can see the top-level code that fftw uses for this here (I think this code is very hard to follow without prior experience of their code base - I certainly don't understand it): https://github.com/FFTW/fftw3/blob/master/rdft/vrank3-transpose.c#L159 I'm not even sure if that really is O(1) storage though: it may be something like O(MN/gcd(M, N)). This page describes the general problem http://en.wikipedia.org/wiki/In-place_matrix_transposition and mentions the existence of "more complicated" algorithms that can use O(N+M) or O(log(MN)) storage. So I don't think an O(1) storage O(N) operations solution exists for the general M*N case although it may be possible for the specialisation to 2*M. (I haven't tried this but if you're interested see what cycles come up for different input sizes and whether there's a pattern that can be predicted using O(1) storage). Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: Pylint across Python versions
On 2/10/14 6:39 AM, thomas.lehm...@adtech.com wrote: Hi, somebody who can tell me about pylint experiences across different Python version. Example: I'm using a construct like this: if sys.version.startswith("3."): unicode = str The reason is that Python 3 does not have this function anymore but pylint yells for Python < 3 about redefinition also it does not happen. How to get forward with this? Regards, Thomas Pylint may have a difficult time understanding what you are doing here. You can use pylint comments to tell it to shut up when you know better. But also, you might find it easier to use the "six" module from PyPI to handle these sorts of differences. It's easier than doing it ad-hoc with your own logic. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
On Tue, Feb 11, 2014 at 2:45 AM, Oscar Benjamin wrote: > Something like > > mylist[:] = reorder_generator(mylist) > > won't work because the generator would need to access the data > non-sequentially (it would need to read elements after they were > overwritten). This would have O(1) space and O(n) time. It's absolutely perfect... except that you now don't technically have a list any more: mylist = reorder_generator(mylist) You can iterate over it, but can't index it. But hey, it complies with the space/time requirements! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Using virtualenv to bypass sudoer issues
On Monday, February 10, 2014 4:46:31 PM UTC+2, Jean-Michel Pichavant wrote: > > Call the venv version of python and activation is handled. > > E.g. in a fabfile > > > > myenv/bin/python myscript.py > > > > -- > > Pete Forman > > -- > > https://mail.python.org/mailman/listinfo/python-list > > wow, the solution is so nice and simple. > > JM > venv activation (venv/bin/activate bash script) adds venv/bin directory in venv into PATH variable in front of PATH's current value. if you plan to use pip or any other executable in venv/bin directory without running bin/activate, they have to be also addressed via absolute path too. It also defines deactivate bash function and if i am not wrong one environment variable to flag activation /Asaf -- https://mail.python.org/mailman/listinfo/python-list
Fwd: Newcomer Help
I am new to Python programming, actually new to any programming language. I sent the email below to the "pythonmac-...@python.org a few days ago. So far I have not seen a reply, actually, I have not seen anything from pythonmac in any emails although I am supposed to be a member. I don't know if I am sending these to the correct place or if I am not receiving emails from the pythonmac list. I would appreciate any assistance either in how do I get to the pythonmac list or answers to the issue below. I went to the pythonmac list because I am trying to run Python 3.3 on a Mac computer. Thank you, Walter - Original Message - From: "Walter Hughey" To: pythonmac-...@python.org Sent: Friday, February 7, 2014 11:54:49 AM Subject: Newcomer Help Greetings, I am new at Python programming, technically a newbie at writing programming code. I have been involved in the maintenance of computers for several years and have decided to increase my knowledge and experience. I am taking a course that - although not a programming course - does require writing of code. I am trying to use Python to write the code. I use a Mac computer and the first issue is getting working with Python. The computer I currently use is running Mac OS X 10.6.8, Intel Core i5 Processor, with 4GB RAM. It has Python 2.3, 2.5, and 2.6 installed by Apple. I have added Python 3.3, the version our Professor recommended. I have checked out the Python installed by Apple and can enter in code and it works, but I need to create a file, run it, and then provide it for the Professor to grade and I don't know how with the Apple installed version. While reading about Python, I saw comments about the note concerning outdated software: If you are using Python from a python.org 64-bit/32-bit Python installer for Mac OS X 10.6 and later , you should only use IDLE or tkinter with an updated third-party Tcl/Tk 8.5, like ActiveTcl 8.5 installed. I located, downloaded and installed the recommended version of ActiveTcl 8.5.15.0. When I open Idle, I see a warning that "The version of Tcl/Tk (8.5.7) in use may be unstable." I received this warning both before and after installing the software above. I open Idle, choose "New File" then most often the computer will freeze, Idle does nothing, cannot enter text into the text box, cannot close the application either with the red circle or by selecting Idle>Close Idle. As often as that, Idle freezes as soon as I open new file, and I cannot close without resorting to Force Quit. I have removed and re-installed Python after downloading and installing the Tcl/Tk software and it does not help. I have seen this work fine on a Mac running Mac OS X 10.8.3. I really just need to get this working on the older version. A am not only new to Python, I am new on this list and hope I have started my stay here in the correct manner! Thank you, Walter -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
On 10 February 2014 15:52, Chris Angelico wrote: > On Tue, Feb 11, 2014 at 2:45 AM, Oscar Benjamin > wrote: >> Something like >> >> mylist[:] = reorder_generator(mylist) >> >> won't work because the generator would need to access the data >> non-sequentially (it would need to read elements after they were >> overwritten). > > This would have O(1) space and O(n) time. It's absolutely perfect... > except that you now don't technically have a list any more: > > mylist = reorder_generator(mylist) > > You can iterate over it, but can't index it. But hey, it complies with > the space/time requirements! That is very likely a practical solution for many problems involving transposition. Doing this in Python is pretty artificial since a new list object will likely use a lot less memory than the elements it contains. The practical use for such algorithms is in something like C and even then it's often better to simply iterate in a different order. The advantage of physically transposing the data is to improve memory locality but this only makes sense if your transpose algorithm itself has a good memory access pattern (which is likely impossible with O(1) storage). Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
On 2014-02-09, Chris Angelico wrote: > Heavy computation might be unideal in Python, but if you can grunge > it into NumPy operations, that won't be a problem. While one might thing Python is not suitable for heavy number crunching, it actually gets used for that a lot due to the wide variety of hard-core number-crunching libraries[1] available (BLAS, LINPACK, LAPACK, and the sort of thing usually associated with boffins writin FORTRAN programs). If you're interestedin that sort of stuff, check out Scientific Python, SciPy, et al. http://www.scipy.org/ http://en.wikipedia.org/wiki/ScientificPython/ https://wiki.python.org/moin/NumericAndScientific For extra geek-points you run them on the Fermilab/CERN "Scientific Linux" distro: https://www.scientificlinux.org/ You can also get a Python distribution with all the extra geekyness already baked in: https://www.enthought.com/products/epd/ [1] Some of those libraries are in FORTRAN because I guess there are some sorts of numerical hocus-pocus that still writes easier and runs faster in FORTRAN than in C. -- Grant Edwards grant.b.edwardsYow! I'm ZIPPY the PINHEAD at and I'm totally committed gmail.comto the festive mode. -- https://mail.python.org/mailman/listinfo/python-list
Re: system wide mutex
On 2014-02-09, Asaf Las wrote: > Hi > > Which one is most recommended to use for mutex alike locking to > achieve atomic access to single resource: > > - fcntl.lockf > - os.open() with O_SHLOCK and O_EXLOCK > - https://pypi.python.org/pypi/lockfile/0.9.1 > - https://pypi.python.org/pypi/zc.lockfile/1.1.0 > - any other ? Posix "pthread" mutexes shared memory. -- Grant Edwards grant.b.edwardsYow! Give them RADAR-GUIDED at SKEE-BALL LANES and gmail.comVELVEETA BURRITOS!! -- https://mail.python.org/mailman/listinfo/python-list
Re: Newcomer Help
On Monday, February 10, 2014 9:40:22 PM UTC+5:30, Walter Hughey wrote: > I am new to Python programming, actually new to any programming language. I > sent the email below to the "python...@python.org a few days ago. So far I > have not seen a reply, actually, I have not seen anything from pythonmac in > any emails although I am supposed to be a member. > > > I don't know if I am sending these to the correct place or if I am not > receiving emails from the pythonmac list. I would appreciate any assistance > either in how do I get to the pythonmac list or answers to the issue below. I > went to the pythonmac list because I am trying to run Python 3.3 on a Mac > computer. > > > Thank you, > > > Walter > > From: "Walter Hughey" > To: python...@python.org > Sent: Friday, February 7, 2014 11:54:49 AM > Subject: Newcomer Help > > > Greetings, > I am new at Python programming, technically a newbie at writing programming > code. I have been involved in the maintenance of computers for several years > and have decided to increase my knowledge and experience. I am taking a > course that - although not a programming course - does require writing of > code. I am trying to use Python to write the code. > > I use a Mac computer and the first issue is getting working with Python. The > computer I currently use is running Mac OS X 10.6.8, Intel Core i5 Processor, > with 4GB RAM. It has Python 2.3, 2.5, and 2.6 installed by Apple. I have > added Python 3.3, the version our Professor recommended. I have checked out > the Python installed by Apple and can enter in code and it works, but I need > to create a file, run it, and then provide it for the Professor to grade and > I don't know how with the Apple installed version. > > While reading about Python, I saw comments about the note concerning outdated > software: If you are using Python from a python.org > 64-bit/32-bit Python installer for Mac OS X 10.6 and later, > you should only use IDLE or tkinter with an updated > third-party Tcl/Tk 8.5, like > ActiveTcl 8.5 > installed. > > I located, downloaded and installed the recommended version of ActiveTcl > 8.5.15.0. When I open Idle, I see a warning that "The version of Tcl/Tk > (8.5.7) in use may be unstable." I received this warning both before and > after installing the software above. I open Idle, choose "New File" then most > often the computer will freeze, Idle does nothing, cannot enter text into the > text box, cannot close the application either with the red circle or by > selecting Idle>Close Idle. As often as that, Idle freezes as soon as I open > new file, and I cannot close without resorting to Force Quit. > > I have removed and re-installed Python after downloading and installing the > Tcl/Tk software and it does not help. I have seen this work fine on a Mac > running Mac OS X 10.8.3. I really just need to get this working on the older > version. > > A am not only new to Python, I am new on this list and hope I have started my > stay here in the correct manner! > Hi! You have started on a clear note and are welcome here. I dont know anything about macs so hopefully someone else will give you more specific answers. However can you check that python interpreter runs in a shell, and that after starting it if you type say: 2 + 3 RETURN you get 5 If that is the case you can still develop the way most python programmers develop, viz Write your code in a normal text editor Load it into the interpreter Check it Go back to the editor and continue writing/correcting the code -- https://mail.python.org/mailman/listinfo/python-list
Re: system wide mutex
IIRC creating a directory is atomic in most environments. On Sunday, February 9, 2014 2:39:51 AM UTC-8, Asaf Las wrote: > Hi > > > > Which one is most recommended to use for mutex alike locking to > > achieve atomic access to single resource: > > > > - fcntl.lockf > > - os.open() with O_SHLOCK and O_EXLOCK > > - https://pypi.python.org/pypi/lockfile/0.9.1 > > - https://pypi.python.org/pypi/zc.lockfile/1.1.0 > > - any other ? > > > > Thanks > > > > /Asaf -- https://mail.python.org/mailman/listinfo/python-list
PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)
## START CODE ### def foo(): # foo represents a patternless function # or method that returns a Boolean value # based on some internal test. # if 1==1: return True return False # # The fun begins when two tiny chars are forgotten, # however, since the code is legal, python will happily # give us the wrong answer. # if foo: # <- forgot parenthesis! print 'implicit conversion to bool bites!' else: # # This block will NEVER execute because foo is # ALWAYS True! # # # Some introspection to understand why this happened. # print 'foo =', foo print 'bool(foo) ->', bool(foo) # ## END CODE # It's obvious i did not follow the syntactical rules of Python, i understand that, however, there are three design flaws here that are contributing to this dilemma: 1. Implicit conversion to Boolean is evil 2. Conditionals should never accept parameter-less functions. If you want to check if a callable is True or False, then use "if bool(callable)". Any usage of a bare callable in conditionals should raise SyntaxError. 3. Implicit introspection is evil, i prefer all references to a callable's names to result in a CALL to that callable, not an introspection! Introspection should ALWAYS be explicit! For a long time i thought Python's idea of a returning the value of a callable-- who's name is unadorned with "(...)" --was a good idea, however, i am now wholly convinced that this design is folly, and the reason is two fold: 1. Parenthesis should not be required for parameter- less functions. I realize this is a bit more complicated in languages like Python where attributes are exposed to the public, but still, not reason enough to require such onerous typing. 2. Implicit introspection is evil. I would prefer an explicit method attached to all callables over a sugar for "callable.call". We should never consume syntactical sugars UNLESS they can greatly reduce the density of code (like math operators for instance!) -- https://mail.python.org/mailman/listinfo/python-list
Re: Help with python functions?
On Monday, September 23, 2013 6:48:20 PM UTC-4, Terry Reedy wrote: > On 9/23/2013 6:32 PM, kjaku...@gmail.com wrote: > > > On Monday, September 23, 2013 9:56:45 AM UTC-4, Steven D'Aprano wrote: > > >> On Mon, 23 Sep 2013 05:57:34 -0700, kjakupak wrote: > > >> > > >> Now you're done! On to the next function... > > >> > > >> > > >> > > >> -- > > >> > > >> Steven > > > > > > def temp(T, from_unit, to_unit): > > > conversion_table = {('c', 'k'):lambda x: x + 273.15, > > > ('c', 'f'):lambda x: (x * (9.0/5)) + 32, > > > ('k', 'c'):lambda x: x - 273.15, > > > ('k', 'f'):lambda x: (x * (9.0/5)) - 459.67, > > > ('f', 'c'):lambda x: (x - 32) * (5.0/9), > > > ('f', 'k'):lambda x: (x + 459.67) * (5.0/9)} > > > f = conversion_table[(from_unit.lower(), to_unit.lower())] > > > return f(T) > > > > What happens if you run some tests? If you use unittest, you can use the > > assertAlmostEqualMethod, or just write something similar yourself. Be > > careful with values near 0.. > > > > At minimum, how many tests do you need, 6 or 9? > > > > > > -- > > Terry Jan Reedy can I use elif instead of lambda? -- https://mail.python.org/mailman/listinfo/python-list
Re: Help with python functions?
On Monday, September 23, 2013 6:48:20 PM UTC-4, Terry Reedy wrote: > On 9/23/2013 6:32 PM, kjaku...@gmail.com wrote: > > > On Monday, September 23, 2013 9:56:45 AM UTC-4, Steven D'Aprano wrote: > > >> On Mon, 23 Sep 2013 05:57:34 -0700, kjakupak wrote: > > >> > > >> Now you're done! On to the next function... > > >> > > >> > > >> > > >> -- > > >> > > >> Steven > > > > > > def temp(T, from_unit, to_unit): > > > conversion_table = {('c', 'k'):lambda x: x + 273.15, > > > ('c', 'f'):lambda x: (x * (9.0/5)) + 32, > > > ('k', 'c'):lambda x: x - 273.15, > > > ('k', 'f'):lambda x: (x * (9.0/5)) - 459.67, > > > ('f', 'c'):lambda x: (x - 32) * (5.0/9), > > > ('f', 'k'):lambda x: (x + 459.67) * (5.0/9)} > > > f = conversion_table[(from_unit.lower(), to_unit.lower())] > > > return f(T) > > > > What happens if you run some tests? If you use unittest, you can use the > > assertAlmostEqualMethod, or just write something similar yourself. Be > > careful with values near 0.. > > > > At minimum, how many tests do you need, 6 or 9? > > > > > > -- > > Terry Jan Reedy can elif be used instead of lambda -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)
On 10/02/2014 18:45, Rick Johnson wrote: ## START CODE ### def foo(): # foo represents a patternless function # or method that returns a Boolean value # based on some internal test. # if 1==1: return True return False # # The fun begins when two tiny chars are forgotten, # however, since the code is legal, python will happily # give us the wrong answer. # if foo: # <- forgot parenthesis! print 'implicit conversion to bool bites!' else: # # This block will NEVER execute because foo is # ALWAYS True! # # # Some introspection to understand why this happened. # print 'foo =', foo print 'bool(foo) ->', bool(foo) # ## END CODE # It's obvious i did not follow the syntactical rules of Python, i understand that, however, there are three design flaws here that are contributing to this dilemma: 1. Implicit conversion to Boolean is evil 2. Conditionals should never accept parameter-less functions. If you want to check if a callable is True or False, then use "if bool(callable)". Any usage of a bare callable in conditionals should raise SyntaxError. 3. Implicit introspection is evil, i prefer all references to a callable's names to result in a CALL to that callable, not an introspection! Introspection should ALWAYS be explicit! For a long time i thought Python's idea of a returning the value of a callable-- who's name is unadorned with "(...)" --was a good idea, however, i am now wholly convinced that this design is folly, and the reason is two fold: 1. Parenthesis should not be required for parameter- less functions. I realize this is a bit more complicated in languages like Python where attributes are exposed to the public, but still, not reason enough to require such onerous typing. 2. Implicit introspection is evil. I would prefer an explicit method attached to all callables over a sugar for "callable.call". We should never consume syntactical sugars UNLESS they can greatly reduce the density of code (like math operators for instance!) This particular PyWart would immediately be caught if another PyWart, namely the unittest module, were to be used to catch this programming error. All of your preferences can be met by raising an issue on the bug tracker and providing a patch that changes code, docs and test suites as appropriate. Simples :) -- 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: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)
On 2/10/14 1:45 PM, Rick Johnson wrote: ## START CODE ### def foo(): # foo represents a patternless function # or method that returns a Boolean value # based on some internal test. # if 1==1: return True return False # # The fun begins when two tiny chars are forgotten, # however, since the code is legal, python will happily # give us the wrong answer. # if foo: # <- forgot parenthesis! print 'implicit conversion to bool bites!' else: # # This block will NEVER execute because foo is # ALWAYS True! # # # Some introspection to understand why this happened. # print 'foo =', foo print 'bool(foo) ->', bool(foo) # ## END CODE # It's obvious i did not follow the syntactical rules of Python, i understand that, however, there are three design flaws here that are contributing to this dilemma: 1. Implicit conversion to Boolean is evil 2. Conditionals should never accept parameter-less functions. If you want to check if a callable is True or False, then use "if bool(callable)". Any usage of a bare callable in conditionals should raise SyntaxError. 3. Implicit introspection is evil, i prefer all references to a callable's names to result in a CALL to that callable, not an introspection! Introspection should ALWAYS be explicit! For a long time i thought Python's idea of a returning the value of a callable-- who's name is unadorned with "(...)" --was a good idea, however, i am now wholly convinced that this design is folly, and the reason is two fold: 1. Parenthesis should not be required for parameter- less functions. I realize this is a bit more complicated in languages like Python where attributes are exposed to the public, but still, not reason enough to require such onerous typing. 2. Implicit introspection is evil. I would prefer an explicit method attached to all callables over a sugar for "callable.call". We should never consume syntactical sugars UNLESS they can greatly reduce the density of code (like math operators for instance!) It seems like you are only looking at how to improve the error you just stumbled over, and not how the full proposal would work out, or even if you would like it better. You haven't made the entire idea explicit yet. How would I pass the function foo to another function? The word "foo" now means, invoke foo. You mean an explicit method attached to callables, like "foo.as_callable" ? But why doesn't the word "foo" there invoke foo? Surely the word "as_callable" isn't special, so is it that "foo.anything" means direct attribute access on foo? So to perform attribute access on the result of foo I need "foo().something" ? In what cases does the word foo invoke the function, and when doesn't it? It's not possible to make a programming language error-proof. There will always be mistakes programmers can make. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Newcomer Help
Thank you for your reply. One quick question, when I reply should it be replay to all or to the person who sent the emial? Apple does install a version of Python, normally a somewhat older version. My computer has 2.5 and 2.6 installed and I have opened it and inserted code that works. I do need a way to write the code, test it, and then save a copy to turn in for the assignment. I was not aware that a normal text editor would work. I shall definitely look at that later today. Walter - Original Message - From: "Rustom Mody" To: python-list@python.org Sent: Monday, February 10, 2014 11:07:14 AM Subject: Re: Newcomer Help On Monday, February 10, 2014 9:40:22 PM UTC+5:30, Walter Hughey wrote: > I am new to Python programming, actually new to any programming language. I > sent the email below to the "python...@python.org a few days ago. So far I > have not seen a reply, actually, I have not seen anything from pythonmac in > any emails although I am supposed to be a member. > > > I don't know if I am sending these to the correct place or if I am not > receiving emails from the pythonmac list. I would appreciate any assistance > either in how do I get to the pythonmac list or answers to the issue below. I > went to the pythonmac list because I am trying to run Python 3.3 on a Mac > computer. > > > Thank you, > > > Walter > > From: "Walter Hughey" > To: python...@python.org > Sent: Friday, February 7, 2014 11:54:49 AM > Subject: Newcomer Help > > > Greetings, > I am new at Python programming, technically a newbie at writing programming > code. I have been involved in the maintenance of computers for several years > and have decided to increase my knowledge and experience. I am taking a > course that - although not a programming course - does require writing of > code. I am trying to use Python to write the code. > > I use a Mac computer and the first issue is getting working with Python. The > computer I currently use is running Mac OS X 10.6.8, Intel Core i5 Processor, > with 4GB RAM. It has Python 2.3, 2.5, and 2.6 installed by Apple. I have > added Python 3.3, the version our Professor recommended. I have checked out > the Python installed by Apple and can enter in code and it works, but I need > to create a file, run it, and then provide it for the Professor to grade and > I don't know how with the Apple installed version. > > While reading about Python, I saw comments about the note concerning outdated > software: If you are using Python from a python.org > 64-bit/32-bit Python installer for Mac OS X 10.6 and later, > you should only use IDLE or tkinter with an updated > third-party Tcl/Tk 8.5, like > ActiveTcl 8.5 > installed. > > I located, downloaded and installed the recommended version of ActiveTcl > 8.5.15.0. When I open Idle, I see a warning that "The version of Tcl/Tk > (8.5.7) in use may be unstable." I received this warning both before and > after installing the software above. I open Idle, choose "New File" then most > often the computer will freeze, Idle does nothing, cannot enter text into the > text box, cannot close the application either with the red circle or by > selecting Idle>Close Idle. As often as that, Idle freezes as soon as I open > new file, and I cannot close without resorting to Force Quit. > > I have removed and re-installed Python after downloading and installing the > Tcl/Tk software and it does not help. I have seen this work fine on a Mac > running Mac OS X 10.8.3. I really just need to get this working on the older > version. > > A am not only new to Python, I am new on this list and hope I have started my > stay here in the correct manner! > Hi! You have started on a clear note and are welcome here. I dont know anything about macs so hopefully someone else will give you more specific answers. However can you check that python interpreter runs in a shell, and that after starting it if you type say: 2 + 3 RETURN you get 5 If that is the case you can still develop the way most python programmers develop, viz Write your code in a normal text editor Load it into the interpreter Check it Go back to the editor and continue writing/correcting the code -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Newcomer Help
On 2014-02-10, Walter Hughey wrote: > Apple does install a version of Python, normally a somewhat older > version. My computer has 2.5 and 2.6 installed and I have opened it > and inserted code that works. I do need a way to write the code, test > it, and then save a copy to turn in for the assignment. I was not > aware that a normal text editor would work. I shall definitely look > at that later today. Can't you just use to edit a Python source file and then run it like you do on other Unix systems? $ emacs myprog.py or $ vi myprog.py or $ myprog.py then $ python myprog.py -- Grant Edwards grant.b.edwardsYow! The SAME WAVE keeps at coming in and COLLAPSING gmail.comlike a rayon MUU-MUU ... -- https://mail.python.org/mailman/listinfo/python-list
[RELEASED] Python 3.3.4
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm very happy to announce the release of Python 3.3.4. Python 3.3.4 includes several security fixes and over 120 bug fixes compared to the Python 3.3.3 release. This release fully supports OS X 10.9 Mavericks. In particular, this release fixes an issue that could cause previous versions of Python to crash when typing in interactive mode on OS X 10.9. Python 3.3 includes a range of improvements of the 3.x series, as well as easier porting between 2.x and 3.x. In total, almost 500 API items are new or improved in Python 3.3. For a more extensive list of changes in the 3.3 series, see http://docs.python.org/3.3/whatsnew/3.3.html To download Python 3.3.4 visit: http://www.python.org/download/releases/3.3.4/ This is a production release, please report any bugs to http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's contributors) -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlL5PMwACgkQN9GcIYhpnLCv4wCePNVqwsOYCHdJBix2bKk4PNpK GBoAnRML2x6obCssnUJe5xwuUZYw8ZSY =+/Nz -END PGP SIGNATURE- -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)
On 10/02/2014 18:45, Rick Johnson wrote: [...] 3. Implicit introspection is evil, i prefer all references to a callable's names to result in a CALL to that callable, not an introspection! So, for example, none of isinstance(x, myclass) map(myfunc, range(10)) x = property(x_get, x_set) would still work? -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)
On 2/10/14 4:12 PM, Rotwang wrote: On 10/02/2014 18:45, Rick Johnson wrote: [...] 3. Implicit introspection is evil, i prefer all references to a callable's names to result in a CALL to that callable, not an introspection! So, for example, none of isinstance(x, myclass) map(myfunc, range(10)) x = property(x_get, x_set) would still work? I guess neither would: except ValueError: :( -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Newcomer Help
"Walter Hughey" wrote: Thank you for your reply. One quick question, when I reply should it be replay to all or to the person who sent the emial? When replying, the most important thing to remember is... order. A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? Get the picture now newcomer? --gv -- this crap came from you - Apple does install a version of Python, normally a somewhat older version. My computer has 2.5 and 2.6 installed and I have opened it and inserted code that works. I do need a way to write the code, test it, and then save a copy to turn in for the assignment. I was not aware that a normal text editor would work. I shall definitely look at that later today. Walter - Original Message - From: "Rustom Mody" To: python-list@python.org Sent: Monday, February 10, 2014 11:07:14 AM Subject: Re: Newcomer Help On Monday, February 10, 2014 9:40:22 PM UTC+5:30, Walter Hughey wrote: I am new to Python programming, actually new to any programming language. I sent the email below to the "python...@python.org a few days ago. So far I have not seen a reply, actually, I have not seen anything from pythonmac in any emails although I am supposed to be a member. I don't know if I am sending these to the correct place or if I am not receiving emails from the pythonmac list. I would appreciate any assistance either in how do I get to the pythonmac list or answers to the issue below. I went to the pythonmac list because I am trying to run Python 3.3 on a Mac computer. Thank you, Walter From: "Walter Hughey" To: python...@python.org Sent: Friday, February 7, 2014 11:54:49 AM Subject: Newcomer Help Greetings, I am new at Python programming, technically a newbie at writing programming code. I have been involved in the maintenance of computers for several years and have decided to increase my knowledge and experience. I am taking a course that - although not a programming course - does require writing of code. I am trying to use Python to write the code. I use a Mac computer and the first issue is getting working with Python. The computer I currently use is running Mac OS X 10.6.8, Intel Core i5 Processor, with 4GB RAM. It has Python 2.3, 2.5, and 2.6 installed by Apple. I have added Python 3.3, the version our Professor recommended. I have checked out the Python installed by Apple and can enter in code and it works, but I need to create a file, run it, and then provide it for the Professor to grade and I don't know how with the Apple installed version. While reading about Python, I saw comments about the note concerning outdated software: If you are using Python from a python.org 64-bit/32-bit Python installer for Mac OS X 10.6 and later, you should only use IDLE or tkinter with an updated third-party Tcl/Tk 8.5, like ActiveTcl 8.5 installed. I located, downloaded and installed the recommended version of ActiveTcl 8.5.15.0. When I open Idle, I see a warning that "The version of Tcl/Tk (8.5.7) in use may be unstable." I received this warning both before and after installing the software above. I open Idle, choose "New File" then most often the computer will freeze, Idle does nothing, cannot enter text into the text box, cannot close the application either with the red circle or by selecting Idle>Close Idle. As often as that, Idle freezes as soon as I open new file, and I cannot close without resorting to Force Quit. I have removed and re-installed Python after downloading and installing the Tcl/Tk software and it does not help. I have seen this work fine on a Mac running Mac OS X 10.8.3. I really just need to get this working on the older version. A am not only new to Python, I am new on this list and hope I have started my stay here in the correct manner! Hi! You have started on a clear note and are welcome here. I dont know anything about macs so hopefully someone else will give you more specific answers. However can you check that python interpreter runs in a shell, and that after starting it if you type say: 2 + 3 RETURN you get 5 If that is the case you can still develop the way most python programmers develop, viz Write your code in a normal text editor Load it into the interpreter Check it Go back to the editor and continue writing/correcting the code -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)
On Tue, Feb 11, 2014 at 5:45 AM, Rick Johnson wrote: > if foo: # <- forgot parenthesis! > print 'implicit conversion to bool bites!' You also forgot the parentheses on the second line, and that's nothing to do with boolification :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)
On 2/10/2014 4:12 PM, Rotwang wrote: On 10/02/2014 18:45, Rick Johnson wrote: [...] 3. Implicit introspection is evil, i prefer all references to a callable's names to result in a CALL to that callable, not an introspection! So, for example, none of isinstance(x, myclass) map(myfunc, range(10)) x = property(x_get, x_set) would still work? No. That is what makes this a troll post, for fun, rather than a serious proposal. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
On Sun, 09 Feb 2014 06:17:03 +0100, Skybuck Flying wrote: > " > I got to know about Python a few months ago and today, I want to develop > only using Python because of its code readability. This is not a healthy > bias. To play my own devil's advocate, I have a question. What are the > kinds of software that are not advisable to be developed using Python? " > > Anything that needs to be super reliable. Obvious troll is obvious. Okay, I'll bite. What evidence do you have that programs written in Python are more bug-ridden or less reliable than programs written in other languages? Your own poorly written, buggy software doesn't count as evidence. Hypothetical arguments based on "it stands to reason" or "everybody knows" that static-typed compilers catch more bugs don't count either. Let's see some hard, reliable statistics. > My experience so far with Python versus Delphi has shown that Python > requires way more time to debug than Delphi. I'm sorry to hear that you aren't yet fluent at reading, writing and debugging Python code. While it's true that somebody can write hard-to- debug code in any language, in general Python's ease of us, dynamic but not too dynamic nature, and powerful introspection makes debugging quite easy. > The reason for this is the interpreter versus the compiler. Which interpreter is that? Do you understand that Python has a compiler? There's even a "compile" built-in function which compiles source code at runtime, ready to run it whenever you like. > Delphi's compiler will catch many bugs in branches that have not been > executed or tested. Only if you write many bugs. You can't catch bugs that aren't there *wink* But seriously, Delphi's compiler will catch a tiny subset of all possible bugs, namely, those which can be recognised by static type-checking. While that's useful, it doesn't happen for free. The cost is that Delphi, like Pascal, is a lot less flexible, and a lot more tightly constrained by the need to keep the compiler happy. Although Delphi does have type inference, it is apparently quite limited, which means you're writing a lot more boilerplate code declaring types compared to Python. > While Python's interpreter will mostly catch bugs in executed and tested > branches. > > Most of the code that has not been executed yet could contain bugs and > even syntax/typos/non declared variables and so forth. Deary deary me, you've just exposed yourself as somebody who doesn't actually know much about Python. Non-declared variables? Python doesn't require declarations for variables. Nor can syntax errors hide in code branches that haven't been run. (Well, technically they could, if you use eval or exec.) But for normal code, it is checked for syntax errors during the compilation phase, all at once. > Which means that the entire Python program will have to be re-executed > from the start to ultimately end up in branches that were not executed > the last time. That's certainly true. But the same applies to Delphi. Type errors and syntax errors are only a tiny subset of all the possible errors. You can have off-by-one errors, logic errors, out-of-bounds errors, network errors, database errors, file system errors... Delphi can't check for those at compile time. No matter how clever the programmer or the compiler, code that hasn't been run and tested cannot be trusted to be correct. As Donald Knuth said: Beware of bugs in the above code; I have only proved it correct, not tried it. > This way of debugging will require many many many many many many many > many runs of the same Python program before it's somewhat debugged. And if your Delphi code doesn't have just as many many many many many many many many runs, it won't be debugged either. > This is time lost in the debugging phase. > > Having said that... time is gained in the programming phase thanks to > it's shortened syntax. > > However there is more... Python may lack some technical language > elements like, call by reference, and perhaps other low level codes, > like 8 bit, 16 bit, 32 bit integers which play a roll with interfacing > with hardware. Call by reference is a means to an end, not an end to itself. Apart from that, all those things you say Python "may" lack, it actually has. > Types of software which would not go onto my python list: operating > systems, drivers, perhaps also virtual machines and even compilers, > python slow execution speed hampers that as well. Agree with the first three. Not so much the last one. Perhaps you have heard of PyPy? It's not just an optimizing Python compiler, but a more general compiler-building tool. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Drawing polygons in python turtle
Hi can anyone help finding the angle to draw different polygons shapes in this example import turtle wm = turtle.Screen() alex = turtle.Turtle() for i in range(5): alex.left(216) alex.forward(50) wm.exitonclick() Why do we use 216 -- https://mail.python.org/mailman/listinfo/python-list
Re:Drawing polygons in python turtle
genius...@gmail.com Wrote in message: > Hi > can anyone help finding the angle to draw different polygons shapes > > in this example > > import turtle > wm = turtle.Screen() > alex = turtle.Turtle() > for i in range(5): > alex.left(216) > alex.forward(50) > wm.exitonclick() > > Why do we use 216 > 216 degrees doesn't seem to me that it would make a polygon, but rather a star. I can tell you what I remember about geometry, however. To make a regular polygon, you need to turn by a fixed amount and go a fixed distance each time. For an equilateral triangle, you turn 120 degrees. For a square, 90. For a pentagon, 108. 180 - (360/n) degrees. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
Chris Angelico wrote: mylist = reorder_generator(mylist) You can iterate over it, but can't index it. But hey, it complies with the space/time requirements! Rather than a generator, you could use a view object that rearranges the indices when you access an element. That would comply with the space/time requirements and be indexable as well. Actually it would do better than meet the requirements, since in a sense it would be O(1) in both space and time! -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
On Tuesday, February 11, 2014 1:44:28 AM UTC+2, geni...@gmail.com wrote: > Hi > > can anyone help finding the angle to draw different polygons shapes > in this example > import turtle > wm = turtle.Screen() > alex = turtle.Turtle() > for i in range(5): > alex.left(216) > alex.forward(50) > wm.exitonclick() > Why do we use 216 because of every for every turn we need to make angle between edges equal to 36. If you will have a look to pentagon definition: http://en.wikipedia.org/wiki/Pentagon inner angle is equal to 108. from that you can easily calculate the angle between edges of star. there is no difference between these 2: alex.left(216) alex.right(144) change left() to right() and see. /Asaf -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
On Tuesday, February 11, 2014 2:23:11 AM UTC+2, Asaf Las wrote: > On Tuesday, February 11, 2014 1:44:28 AM UTC+2, geni...@gmail.com wrote: > > Hi > > > > can anyone help finding the angle to draw different polygons shapes > > in this example > > import turtle > > wm = turtle.Screen() > > alex = turtle.Turtle() > > for i in range(5): > > alex.left(216) > > alex.forward(50) > > wm.exitonclick() > > > Why do we use 216 > because of every for every turn we need to make angle between edges > equal to 36. If you will have a look to pentagon definition: > http://en.wikipedia.org/wiki/Pentagon > inner angle is equal to 108. from that you can easily calculate > the angle between edges of star. > there is no difference between these 2: > alex.left(216) > alex.right(144) > > change left() to right() and see. > /Asaf just a bit add - confusing things here is the reference of 0 degree turtle takes to make turn from. i was also confused when so that (never tried turtle before). the 0 degree is the virtual line which is continuation of direction from point where forward(50) ends. so when left executes it should turn more than 180 to achieve 36 degrees and when right - less. p.s. i am not good in explaining things. -- https://mail.python.org/mailman/listinfo/python-list
Re: Fwd: Newcomer Help
In article <675340207.6922848.1392048622415.javamail.r...@okbu.edu>, Walter Hughey wrote: > I am new to Python programming, actually new to any programming language. I > sent the email below to the "pythonmac-...@python.org a few days ago. So far > I have not seen a reply, actually, I have not seen anything from pythonmac in > any emails although I am supposed to be a member. That's too bad! It may be that your email is being held for moderation on the list, especially if you haven't subscribed or are just subscribing. https://mail.python.org/mailman/listinfo/pythonmac-sig > I don't know if I am sending these to the correct place or if I am not > receiving emails from the pythonmac list. I would appreciate any assistance > either in how do I get to the pythonmac list or answers to the issue below. I > went to the pythonmac list because I am trying to run Python 3.3 on a Mac > computer. > > > Thank you, > > > Walter > - Original Message - > > From: "Walter Hughey" > To: pythonmac-...@python.org > Sent: Friday, February 7, 2014 11:54:49 AM > Subject: Newcomer Help > > > Greetings, > I am new at Python programming, technically a newbie at writing programming > code. I have been involved in the maintenance of computers for several years > and have decided to increase my knowledge and experience. I am taking a > course that - although not a programming course - does require writing of > code. I am trying to use Python to write the code. > > > I use a Mac computer and the first issue is getting working with Python. The > computer I currently use is running Mac OS X 10.6.8, Intel Core i5 Processor, > with 4GB RAM. It has Python 2.3, 2.5, and 2.6 installed by Apple. I have > added Python 3.3, the version our Professor recommended. I have checked out > the Python installed by Apple and can enter in code and it works, but I need > to create a file, run it, and then provide it for the Professor to grade and > I don't know how with the Apple installed version. > > > While reading about Python, I saw comments about the note concerning outdated > software: If you are using Python from a python.org 64-bit/32-bit Python > installer for Mac OS X 10.6 and later , you should only use IDLE or tkinter > with an updated third-party Tcl/Tk 8.5, like ActiveTcl 8.5 installed. > > > I located, downloaded and installed the recommended version of ActiveTcl > 8.5.15.0. When I open Idle, I see a warning that "The version of Tcl/Tk > (8.5.7) in use may be unstable." I received this warning both before and > after installing the software above. I open Idle, choose "New File" then most > often the computer will freeze, Idle does nothing, cannot enter text into the > text box, cannot close the application either with the red circle or by > selecting Idle>Close Idle. As often as that, Idle freezes as soon as I open > new file, and I cannot close without resorting to Force Quit. That should work. Just to be sure, here are the URLs for the current ActiveTcl and python.org 3.3 installers for OS X 10.6. http://downloads.activestate.com/ActiveTcl/releases/8.5.15.0/ActiveTcl8.5 .15.1.297588-macosx10.5-i386-x86_64-threaded.dmg http://www.python.org/ftp/python/3.3.4/python-3.3.4-macosx10.6.dmg Make sure you have quit IDLE before installing both. After installing, go to the /Applications/Python 3.3 folder and double-click on the IDLE icon. You should not see the "(8.5.7) may be unstable" message. As others have noted, though, you could use another editor and just run python3.3 from a Terminal window command line: /usr/local/bin/python3.3 your_filename_here.py Good luck! -- Ned Deily, n...@acm.org -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
Well how about the star of david what are the angles -- https://mail.python.org/mailman/listinfo/python-list
Re: Sorting dictionary by datetime value
How about make it simple by using sorted(a.values()) ... >>> a = {} >>> a['first'] = datetime.datetime.now() >>> a['second'] = datetime.datetime.now() >>> a['third'] = datetime.datetime.now() >>> a['forth'] = datetime.datetime.now() >>> a['fifth'] = datetime.datetime.now() >>> sorted(a.values()) [datetime.datetime(2014, 2, 10, 19, 24, 35, 163585), datetime.datetime(2014, 2, 10, 19, 24, 53, 244532), datetime.datetime(2014, 2, 10, 19, 25, 9, 483683), datetime.datetime(2014, 2, 10, 19, 25, 25, 581743), datetime.datetime(2014, 2, 10, 19, 25, 37, 789907)] -- https://mail.python.org/mailman/listinfo/python-list
New to Py 3.3.3 having prob. with large integer div. float.
I am coming off Python 2.6.6 32 bite platform and now in win 8.1 64 bite. I had no problems with gmpy in 2.6.6 and large integer floating points where you could control the length of the floating point by entering the bite size of the divisor(s) you are using. That would give the limit length of the float in the correct number of bites. In Python 3.3.3 and gmpy2 I have tried many things in the import mpfr module changing and trying all kinds of parameters in the gmpy2 set_context module and others. The best I can get without an error is the results of a large integer division is a/b = inf. or an integer rounded up or down. I can't seem to find the right settings for the limit of the remainders in the quotient. My old code in the first few lines of 2.6.6 worked great and looked like this - import gmpy BIG =(A large composite with 2048 bites) SML =(a smaller divisor with 1024 bites) Y= gmpy.mpz(1) A= gmpy.mpf(1) y=Y x=BIG z=SML a=A k=BIG j=BIG x=+ gmpy.next.prime(x) while y < 20: B = gmpy.mpf(x.1024) ## the above set the limit of z/b float (see below) to 1024 b=B a=z/b c=int(a) d=a-c if d = <.001: proc. continues from here with desired results. gmpy2 seems a lot more complex but I am sure there is a work around. I am not interested in the mod function. My new conversion proc. is full of ## tags on the different things I tried that didn't work. TIA Dan -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
On Tuesday, February 11, 2014 4:13:16 AM UTC+2, geni...@gmail.com wrote: > Well how about the star of david what are the angles hexagon is not constructed similar to your program for pentagon because crossing path can't jump from one triangle to another. you have 60 degrees turn after 2 turns edges will be concatenated. /Asaf -- https://mail.python.org/mailman/listinfo/python-list
Re: Sorting dictionary by datetime value
On Tue, Feb 11, 2014 at 1:31 PM, pete suchsland wrote: > How about make it simple by using sorted(a.values()) ... > a = {} a['first'] = datetime.datetime.now() a['second'] = datetime.datetime.now() a['third'] = datetime.datetime.now() a['forth'] = datetime.datetime.now() a['fifth'] = datetime.datetime.now() > sorted(a.values()) > [datetime.datetime(2014, 2, 10, 19, 24, 35, 163585), datetime.datetime(2014, > 2, 10, 19, 24, 53, 244532), datetime.datetime(2014, 2, 10, 19, 25, 9, > 483683), datetime.datetime(2014, 2, 10, 19, 25, 25, 581743), > datetime.datetime(2014, 2, 10, 19, 25, 37, 789907)] Works nicely if you don't care about the keys. Otherwise, you need to somehow look them back up, which is at best going to add an extra O(n) step (creating a reverse dictionary), and at worst will require an O(n*n) search (if the objects aren't hashable). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
so does that mean i have to draw two separate triangles -- https://mail.python.org/mailman/listinfo/python-list
Re: Sorting dictionary by datetime value
Why not use collections.OrderedDict ? There are nice examples in doc: http://docs.python.org/3.3/library/collections.html?highlight=ordered#ordereddict-examples-and-recipes -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the recommended python module for SQL database access?
Chris Angelico wrote: > Broad recommendation: Single application, tiny workload, concurrency > not an issue, simplicity desired? Go SQLite. Big complex job, need > performance, lots of things reading and writing at once, want > networked access? Go PGSQL. And don't go MySQL if PG is an option. > > And definitely don't go for a non-free option (MS-SQL, DB2, etc) > unless you've looked into it really closely and you are absolutely > thoroughly *sure* that you need that system (which probably means you > need your app to integrate with someone else's, and that other app > demands one particular database). > I agree 100% with this. And speaking as an ex Oracle and DB2 DBA - not to mention MS-SQL (spit), with which I occasionally had to dabble, avoid them like the plague unless circumstances dictate. -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
On Tuesday, February 11, 2014 4:51:56 AM UTC+2, geni...@gmail.com wrote: > so does that mean i have to draw two separate triangles If you need view of crossing triangles - yes, this is the simplest recipe. -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
Is there a better way of drawing such as another modules -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the recommended python module for SQL database access?
On Tuesday, February 11, 2014 4:57:30 AM UTC+2, Walter Hurry wrote: > Chris Angelico wrote: > > > > And definitely don't go for a non-free option (MS-SQL, DB2, etc) > > unless you've looked into it really closely and you are absolutely > > thoroughly *sure* that you need that system (which probably means you > > need your app to integrate with someone else's, and that other app > > demands one particular database). > > > > I agree 100% with this. And speaking as an ex Oracle and DB2 DBA - > not to mention MS-SQL (spit), with which I occasionally had to dabble, > avoid them like the plague unless circumstances dictate. What is about clustering? Do we have such option for free alternatives? Thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
On Tuesday, February 11, 2014 5:01:33 AM UTC+2, geni...@gmail.com wrote: > Is there a better way of drawing such as another modules Could you please elaborate with question? What do you mean? -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
A better way to draw stuff on screen -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the recommended python module for SQL database access?
On Tue, Feb 11, 2014 at 1:57 PM, Walter Hurry wrote: > Chris Angelico wrote: > >> Broad recommendation: Single application, tiny workload, concurrency >> not an issue, simplicity desired? Go SQLite. Big complex job, need >> performance, lots of things reading and writing at once, want >> networked access? Go PGSQL. And don't go MySQL if PG is an option. >> >> And definitely don't go for a non-free option (MS-SQL, DB2, etc) >> unless you've looked into it really closely and you are absolutely >> thoroughly *sure* that you need that system (which probably means you >> need your app to integrate with someone else's, and that other app >> demands one particular database). >> > I agree 100% with this. And speaking as an ex Oracle and DB2 DBA - not to > mention MS-SQL (spit), with which I occasionally had to dabble, avoid them > like the plague unless circumstances dictate. > I can't speak for Oracle as I've never used it, but DB2 is not at all a bad product. In fact, it's excellent. I'm not sorry to have spent a couple of decades using it; it's part of what taught me to assume transactions everywhere, for instance (you don't "BEGIN TRANSACTION", you simply are in one - after you COMMIT, another transaction is automatically opened (at next query, I think), so you have to explicitly COMMIT everything), and its networking support is excellent. (Also, back in the 1990s, PostgreSQL wasn't nearly as easy to use as it is now.) But it's non-free, and that makes a HUGE difference when you start deploying servers. You have to count up how many boxes you're using, and then factor in the number of test machines you have too. Licenses for your OS, database, etc, etc, all add up pretty quickly. When there are no license fees whatsoever, life's easy - I can create myself a Debian Linux VM image, install all our stuff on it, and then clone it a whole bunch of times to try different things; doing that with Windows or DB2 or anything pay-for is a lot less convenient (or even straight-up illegal, depending on the license terms). That's a pretty huge downside, and I've yet to use any pay-for database engine or operating system that outdoes that. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
Going off-topic Which resource do you recommend for learning this wonderful language -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
On Tuesday, February 11, 2014 5:06:11 AM UTC+2, geni...@gmail.com wrote: > A better way to draw stuff on screen It depends on particular case/figure you wish to draw. Drawing is separate knowledge field with its own set of algorithms. Geometry is field of wonders. i never dealt with this stuff actually. -- https://mail.python.org/mailman/listinfo/python-list
Re: Drawing polygons in python turtle
On Tuesday, February 11, 2014 5:19:52 AM UTC+2, geni...@gmail.com wrote: > Going off-topic Which resource do you recommend for learning this > wonderful language My advice won't be good as mentioned before i never dealt with it. You have chance to discover that country yourself or wait for advice of others or do both at same time. -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the recommended python module for SQL database access?
On Tue, Feb 11, 2014 at 2:02 PM, Asaf Las wrote: > On Tuesday, February 11, 2014 4:57:30 AM UTC+2, Walter Hurry wrote: >> Chris Angelico wrote: >> > >> > And definitely don't go for a non-free option (MS-SQL, DB2, etc) >> > unless you've looked into it really closely and you are absolutely >> > thoroughly *sure* that you need that system (which probably means you >> > need your app to integrate with someone else's, and that other app >> > demands one particular database). >> > >> >> I agree 100% with this. And speaking as an ex Oracle and DB2 DBA - >> not to mention MS-SQL (spit), with which I occasionally had to dabble, >> avoid them like the plague unless circumstances dictate. > > What is about clustering? Do we have such option for free alternatives? > > Thanks PostgreSQL has replication in-built now, which will do most forms of clustering. With some third-party software like Slony (also free), you can do even more (including replicating between different PostgreSQL versions, so you can upgrade progressively without any downtime; PG's internal replication has tight restrictions on that). I've used PG's streaming replication to fairly good effect. You do need some kind of system to decide when to promote a slave to master, though - my boss had this weird idea that each node had to be a perfect peer with no external authority [1], which led to unsolvable problems, but if you have an external system that declares which of several slaves should be promoted, it's pretty easy to do. I could whip you up a proof-of-concept in an hour, probably; just needs a heartbeat script and some way of signalling them to fail over to the new master. Clustering for performance, as opposed to reliability, is a bit trickier. You can do read-only queries on slaves (so if you have a many-readers-few-writers model, this can work nicely), but otherwise, you probably need some third-party middleware. I haven't looked into that side of things. Ultimately your biggest bottleneck is going to be locking, which fundamentally has to be done in one place... or else you have to deal with merge conflicts (the bane of true multi-master replication). So, it all depends on what you need to accomplish, and how much work you're willing to do. Postgres offers a particular set of primitives (including replication, promotion of a slave to master, etc), and lets you trigger things from scripts (execute "pg_ctl promote" to make this node become master). Advanced logic can be done by writing a Python script that edits config files, runs programs, sends Unix signals, whatever. There are pay-for Postgres support companies, too, if you need that sort of thing. tl;dr: Yeah, you can do that too. :) ChrisA [1] He had a weird issue with the concept of authority, actually. I think his dislike of any form of government polluted his thinking so he wouldn't accept even the IT sense of the word "authority". Never mind that that's the best way to solve a lot of problems. But I digress. -- https://mail.python.org/mailman/listinfo/python-list
Re: What is the recommended python module for SQL database access?
On Tuesday, February 11, 2014 5:31:35 AM UTC+2, Chris Angelico wrote: > On Tue, Feb 11, 2014 at 2:02 PM, Asaf Las wrote: > > > On Tuesday, February 11, 2014 4:57:30 AM UTC+2, Walter Hurry wrote: > >> Chris Angelico wrote: > >> > > >> > And definitely don't go for a non-free option (MS-SQL, DB2, etc) > >> > unless you've looked into it really closely and you are absolutely > >> > thoroughly *sure* that you need that system (which probably means you > >> > need your app to integrate with someone else's, and that other app > >> > demands one particular database). > >> > > >> > >> I agree 100% with this. And speaking as an ex Oracle and DB2 DBA - > >> not to mention MS-SQL (spit), with which I occasionally had to dabble, > >> avoid them like the plague unless circumstances dictate. > > > > What is about clustering? Do we have such option for free alternatives? > > > > Thanks > > PostgreSQL has replication in-built now, which will do most forms of > clustering. With some third-party software like Slony (also free), you > can do even more (including replicating between different PostgreSQL > versions, so you can upgrade progressively without any downtime; PG's > internal replication has tight restrictions on that). I've used PG's > streaming replication to fairly good effect. You do need some kind of > system to decide when to promote a slave to master, though - my boss > had this weird idea that each node had to be a perfect peer with no > external authority [1], which led to unsolvable problems, but if you > have an external system that declares which of several slaves should > be promoted, it's pretty easy to do. I could whip you up a > proof-of-concept in an hour, probably; just needs a heartbeat script > and some way of signalling them to fail over to the new master. > > Clustering for performance, as opposed to reliability, is a bit > trickier. You can do read-only queries on slaves (so if you have a > many-readers-few-writers model, this can work nicely), but otherwise, > you probably need some third-party middleware. I haven't looked into > that side of things. Ultimately your biggest bottleneck is going to be > locking, which fundamentally has to be done in one place... or else > you have to deal with merge conflicts (the bane of true multi-master > replication). > > So, it all depends on what you need to accomplish, and how much work > you're willing to do. Postgres offers a particular set of primitives > (including replication, promotion of a slave to master, etc), and lets > you trigger things from scripts (execute "pg_ctl promote" to make this > node become master). Advanced logic can be done by writing a Python > script that edits config files, runs programs, sends Unix signals, > whatever. There are pay-for Postgres support companies, too, if you > need that sort of thing. > > tl;dr: Yeah, you can do that too. :) > > ChrisA > > [1] He had a weird issue with the concept of authority, actually. I > think his dislike of any form of government polluted his thinking so > he wouldn't accept even the IT sense of the word "authority". Never > mind that that's the best way to solve a lot of problems. But I > digress. Chris, Thank You very much for your detailed answer Regards /Asaf -- https://mail.python.org/mailman/listinfo/python-list
Error getting while running python function
I have defined one function as below. def InfoDir(msg): msg1 = wx.MessageDialog(msg) msg1.ShowModal() msg1.Destroy() InfoDir("Testing") It gives below error. msg1 = wx.MessageDialog(msg) File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py", line 2922, in __init__ _windows_.MessageDialog_swiginit(self,_windows_.new_MessageDialog(*args, **kwargs)) TypeError: Required argument 'message' (pos 2) not found Process finished with exit code 1 Please give me solution for this. -- https://mail.python.org/mailman/listinfo/python-list
Re: Error getting while running python function
On Tue, Feb 11, 2014 at 3:07 PM, Jaydeep Patil wrote: > I have defined one function as below. > > def InfoDir(msg): > msg1 = wx.MessageDialog(msg) > msg1.ShowModal() > msg1.Destroy() > > InfoDir("Testing") > > > It gives below error. > msg1 = wx.MessageDialog(msg) > File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py", > line 2922, in __init__ > _windows_.MessageDialog_swiginit(self,_windows_.new_MessageDialog(*args, > **kwargs)) > TypeError: Required argument 'message' (pos 2) not found > > Process finished with exit code 1 It looks like you're missing a required argument :) http://www.wxpython.org/docs/api/wx.MessageDialog-class.html#__init__ Try passing it a parent window as well as the message. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Newcomer Help
On Feb 10, 2014, at 11:10 AM, Walter Hughey wrote: > I am new to Python programming, actually new to any programming language. I > sent the email below to the "pythonmac-...@python.org a few days ago. So far > I have not seen a reply, actually, I have not seen anything from pythonmac in > any emails although I am supposed to be a member. > > I don't know if I am sending these to the correct place or if I am not > receiving emails from the pythonmac list. I would appreciate any assistance > either in how do I get to the pythonmac list or answers to the issue below. I > went to the pythonmac list because I am trying to run Python 3.3 on a Mac > computer. > > Thank you, > > Walter Walter, I'm one of the (relatively few) people on this list who develops using Macs and therefore also subscribes to pythonmac-sig. I don't know what may have happened to your e-mail, but I can assure you that if you didn't get answers from the pythonmac list it wasn't because people were ignoring you. I've looked back through the last six months of pythonmac and saw nothing with your name in it. I assume you signed up here: https://mail.python.org/mailman/listinfo/pythonmac-sig if not, that would explain things. I see others are providing the help you need, so I won't attempt any other comments. -Bill -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
On Saturday, February 8, 2014 10:43:47 PM UTC-5, Steven D'Aprano wrote: > PyPy can generate code which is comparable to compiled C in speed. > Perhaps you mean, "if execution speed is the most important thing, using > a naive Python interpreter may not be fast enough". Given that the OP seems to be new enough to Python to not know what it is not as good for, my guess is that PyPy may not yet be "ready enough" to serve some/most of his needs. For example, if he wanted to write a GUI app, AFAIK he is, for now, limited to Tkinter and a constrained section of wxPython, and wxPython is dicey. I tend to see things through a desktop GUI application lens, so maybe this is just my bias. And I hope I am wrong. I am in no way trying to slight the PyPy efforts. Maybe he could somehow write the GUI part with CPython and the speed-critical parts with PyPy but I don't know if that is possible. (Is it?) -- https://mail.python.org/mailman/listinfo/python-list
Re: Error getting while running python function
On Tuesday, 11 February 2014 09:37:23 UTC+5:30, Jaydeep Patil wrote: > I have defined one function as below. > > > > def InfoDir(msg): > > msg1 = wx.MessageDialog(msg) > > msg1.ShowModal() > > msg1.Destroy() > > > > InfoDir("Testing") > > > > > > It gives below error. > > msg1 = wx.MessageDialog(msg) > > File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py", > line 2922, in __init__ > > _windows_.MessageDialog_swiginit(self,_windows_.new_MessageDialog(*args, > **kwargs)) > > TypeError: Required argument 'message' (pos 2) not found > > > > Process finished with exit code 1 > > > > > > > > Please give me solution for this. Is anybody answer my query? Regards Jay -- https://mail.python.org/mailman/listinfo/python-list
Re: Error getting while running python function
On Tuesday, 11 February 2014 09:42:35 UTC+5:30, Chris Angelico wrote: > On Tue, Feb 11, 2014 at 3:07 PM, Jaydeep Patil > wrote: > > > I have defined one function as below. > > > > > > def InfoDir(msg): > > > msg1 = wx.MessageDialog(msg) > > > msg1.ShowModal() > > > msg1.Destroy() > > > > > > InfoDir("Testing") > > > > > > > > > It gives below error. > > > msg1 = wx.MessageDialog(msg) > > > File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py", > > line 2922, in __init__ > > > > > _windows_.MessageDialog_swiginit(self,_windows_.new_MessageDialog(*args, > > **kwargs)) > > > TypeError: Required argument 'message' (pos 2) not found > > > > > > Process finished with exit code 1 > > > > It looks like you're missing a required argument :) > > > > http://www.wxpython.org/docs/api/wx.MessageDialog-class.html#__init__ > > > > Try passing it a parent window as well as the message. > > > > ChrisA @ Chris: There is not parent window such. I just write a simple function to define. There is no class. Is it possible to work like the way i am doing? Regards Jay -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
On 02/08/2014 05:54 PM, Sam wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bias. To play my own devil's advocate, I have a question. What are the kinds of software that are not advisable to be developed using Python? Anything requiring strict time determinism - interrupt handlers, hard realtime, etc. Embedded software (stuff going into ROM). Virtual memory managers or any other core part of a OS that manipulates hardware. It can be done with a minimal lower language shim to the hardware, but it likely would be slow. Life-critical (life support, weapons control, etc.) unless you're willing to strictly avoid the runtime dynamism of the language. When life and limb are at stake you want a very static language with strong type enforcement and lots of assertion checks. In principle, you can certainly do this in Python, but the language naturally encourages dynamic typing, introspection, and other, similar runtime behaviors. Applications where storage for programs is at a premium such as Atmel and PIC microcontrollers with onboard flash. Applications in which you do not want the casual reader to be able to derive the meaning of the source code. -- Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
On Tue, Feb 11, 2014 at 3:21 PM, CM wrote: > On Saturday, February 8, 2014 10:43:47 PM UTC-5, Steven D'Aprano wrote: > >> PyPy can generate code which is comparable to compiled C in speed. >> Perhaps you mean, "if execution speed is the most important thing, using >> a naive Python interpreter may not be fast enough". > > Given that the OP seems to be new enough to Python to not know what it is > not as good for, my guess is that PyPy may not yet be "ready enough" to > serve some/most of his needs. For example, if he wanted to write a GUI > app, AFAIK he is, for now, limited to Tkinter and a constrained section of > wxPython, and wxPython is dicey. I tend to see things through a desktop GUI > application lens, so maybe this is just my bias. And I hope I am wrong. I > am in no way trying to slight the PyPy efforts. > > Maybe he could somehow write the GUI part with CPython and the speed-critical > parts with PyPy but I don't know if that is possible. (Is it?) More likely, he can write the whole thing in Python, and then run it in CPython. Then see if its speed is good enough. Sometimes "good enough" means "finishes executing in less than 100ms after user interaction". Sometimes it's even more generous. Other times it's "can handle at least X requests per second on a single CPU core", where X is defined based on the number of requests that the network can handle. If it meets that requirement, there's no reason to go to any sort of effort to improve performance. And that's how it is for huge HUGE numbers of Python scripts. Of course, if performance _is_ a problem, then the next step is to measure and find out exactly what's the slow bit. It's seldom what you first think of. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Error getting while running python function
On Tue, Feb 11, 2014 at 3:34 PM, Jaydeep Patil wrote: > There is not parent window such. I just write a simple function to define. > There is no class. > Is it possible to work like the way i am doing? You could try reading the docs; there might be a way to say "no parent window" (maybe pass it None), but you can't simply omit parameters. Start with the docs. They're friendly. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
On Mon, 10 Feb 2014 10:20:33 +, Sturla Molden wrote: > Wesley wrote: >> [Wesley] This is not homework:-) >> And actually I am new to algorithm, so you guys can feel free to say >> anything you want > > In general, we cannot sort a sequence in O(n) time. O(n log n) is the > lower bound on the complexity. Firstly, you're talking about average complexity, not best-case complexity. The base-case can be O(N) for a sequence which is already sorted. Worst case can be much greater, e.g. O(N**2) for Quicksort, or unbounded for Bogosort. (That is, Bogosort is not guaranteed to sort a sequence even after infinite time!) Secondly, O(N*log N) applies to *comparison sorts*. Non-comparison sorts such as radix-, counting- and bucket-sort have average case complexity of O(N). See, for example: http://algorithmstwo.soc.srcf.net/resources/asides/noncomparison/ http://en.wikipedia.org/wiki/Bead_sort http://en.wikipedia.org/wiki/Radix_sort http://en.wikipedia.org/wiki/Spaghetti_sort etc. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Sort one sequence by O(n) in time and O(1) in space
On 02/10/2014 04:20 AM, Sturla Molden wrote: In general, we cannot sort a sequence in O(n) time. O(n log n) is the lower bound on the complexity. Only true for sorting that involve comparison. However, sorts that use the values of the inputs as positional keys have a lower bound complexity (omega) of O(n) and a worst case complexity of O(n) and are thus asymptotically optimal. For example, given a range of integers guaranteed to be within the range of j to k (lower to higher), one can created a bit field to represent all possible values of j to k. Then, as values are read in, the corresponding but is set true. You have to process the list of n elements once to read it in, and then a second time to read them out in order. This is a 2n operation which is O(n). For very large ranges of j to k, this is impractical and we resort to things like hashing functions which can perform better than n log n sorting algorithms. But there are lots of real world applications where inputs-as-keys works just fine, such as short dispatch tables in operating systems where the value to be sorted represents a process priority, for example. -- Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
On Mon, 10 Feb 2014 22:40:48 -0600, Tim Daneliuk wrote: > On 02/08/2014 05:54 PM, Sam wrote: >> I got to know about Python a few months ago and today, I want to >> develop only using Python because of its code readability. This is not >> a healthy bias. To play my own devil's advocate, I have a question. >> What are the kinds of software that are not advisable to be developed >> using Python? [snip a bunch of good examples] > Applications in which you do not want the casual reader to be able to > derive the meaning of the source code. That's a bad example. Do you think that the casual reader will be able to understand the meaning of .pyc files? -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Get a datetime with nanoseconds
Hi, ALL, I am woking on an application for digital forensic. In this application I am getting this 2 pieces of information: atime - long representing the time stamp atime_nano - long representing the nanoseconds. What I'd like to do is to have a python datetime object which will be a representation of those 2 values. I can get a datetime object out of atime timestamp, but I don't know how to do it for atime_nano. I did a little research. It looks like people on SO are saying that I will not be able to get this kind of precision, but I'd be grateful if I can at least get the best possible precision (millioseconds?) it would be great. Thank you for any pointers. -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
On 02/10/2014 11:35 PM, Steven D'Aprano wrote: On Mon, 10 Feb 2014 22:40:48 -0600, Tim Daneliuk wrote: On 02/08/2014 05:54 PM, Sam wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bias. To play my own devil's advocate, I have a question. What are the kinds of software that are not advisable to be developed using Python? [snip a bunch of good examples] Applications in which you do not want the casual reader to be able to derive the meaning of the source code. That's a bad example. Do you think that the casual reader will be able to understand the meaning of .pyc files? Point taken :) -- Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- https://mail.python.org/mailman/listinfo/python-list
Send commands to USB device in Python
Hi fellows, I am facing difficulties in order to send USB commands to an RFID reader. This is the command reference of the device: https://github.com/mti-rfid/RFID_Explorer I am working with the MTI RU-824 model. The manufacturer of the device only provide a driver for Windows (using .Net), but we need to run the device on Linux. That's why I need to write few lines of code in Python as a new "driver". I am using PyUSB for accessing the device, and this is few lines of my code: import usb.core import usb.util import sys VENDOR_ID = 0x24e9 PRODUCT_ID = 0x0824 device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID) if device is None: sys.exit("Could not find Id System Barcode Reader.") else: print 'Device detected' device.set_configuration() cfg = device.get_active_configuration() interface_number = cfg[(0, 0)].bInterfaceNumber alternate_setting = usb.control.get_interface(device, interface_number) usb_interface = usb.util.find_descriptor( cfg, bInterfaceNumber=interface_number, bAlternateSetting=alternate_setting ) endpoint_out = usb.util.find_descriptor( usb_interface, # match the first OUT endpoint custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT ) endpoint_in = usb.util.find_descriptor( usb_interface, # match the first IN endpoint custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN ) endpoint_out.write('0x01') print endpoint_in.read(len('0x01'), 1000) = My question is on the last 2 lines. I am using endpoint_out to send a command and endpoint_in to read data from the reader. Am I correct? The problem is, when I run the code, there is an error message like this: usb.core.USBError: [Errno 110] Operation timed out Anyone can give a clue? Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)
On Mon, 10 Feb 2014 10:45:40 -0800, Rick Johnson wrote: > ## START CODE ### > def foo(): > # foo represents a patternless function Patternless? I have never heard that term before in this context. Do you mean a parameter-less or argument-less function? > # or method that returns a Boolean value > # based on some internal test. > # > if 1==1: > return True > return False This always returns True, since 1 always equals 1. > # The fun begins when two tiny chars are forgotten, > # however, since the code is legal, python will happily > # give us the wrong answer. > # > if foo: # <- forgot parenthesis! > print 'implicit conversion to bool bites!' No it doesn't. It rocks. You have found one tiny little disadvantage, about the size of a mote of dust floating: if you write functions that take no arguments (already a code-smell) and forget the brackets (mistakes will happen...) and have no tests to ensure that both branches of the `if` are tested (what, are you careless and negligent?), then you might be bitten by a bug of your own creation. Compared to that mote, the usefulness and convenience of duck-typing bools is about the size of Mt Everest. > else: > # > # This block will NEVER execute because foo is > # ALWAYS True! Correct. And since foo() is also always True, there is no difference. [...] > It's obvious i did not follow the syntactical rules of Python, i > understand that, No you don't understand that. You *did* follow the syntactical rules of Python. `if foo` is perfectly correct syntax, if it were not, you would have got a SyntaxError exception at compile-time. You need to understand the difference between syntax and semantics. This is invalid English syntax: "Cat mat on sat the." This is valid syntax, but semantically wrong: "The mat sat on the cat." This is both syntactically and semantically correct: "The cat sat on the mat." > however, there are three design flaws here that are > contributing to this dilemma: > > 1. Implicit conversion to Boolean is evil It's not implicit conversion. You're not understanding what is going on. foo is not converted to a bool, foo remains a function object. Rather, it's duck-typing truthiness, which is no different from any other duck- typing. If it swims like a bool and quacks like a bool, it might as well be a bool. Duck-typing is a design feature, not a flaw. > 2. Conditionals should never accept parameter-less functions. How is the conditional supposed to know that its term is a function? What's so special about parameter-less functions? You can forget to call functions with any number of parameters, especially if they take default values. Let's suppose that you get your way. Which of the following if-tests should be prohibited, and when should they be prohibited? At compile time? if random.random() > 0.5: spam = lambda x=23: x eggs = 42 else: spam = 42 eggs = lambda x=23: x if spam: print "spam is a truthy value" if eggs: print "eggs is a truthy value" > If you > want to check if a callable is True or False, then use "if > bool(callable)". Ewww. That's horrible. bool() should only be used to get a canonical bool object, e.g. for writing to a database or something. It should never be used just because you are scared of Python's power. > Any usage of a bare callable in conditionals should > raise SyntaxError. Ah, so it should happen at compile-time, not run-time? I'm afraid you're not as clear about how Python operates as you perhaps think you are. > 3. Implicit introspection is evil, i prefer all references to a > callable's names to result in a CALL to that callable, not an > introspection! Introspection should ALWAYS be explicit! Again, this is a complete misunderstanding of Python's execution model. It is true that callables have names, but they are only used for displaying error messages in tracebacks. Otherwise, callables are no different from any other object: they can have zero, one or many names bound to them, and referring to the name gives you access to the object itself. spam = spam # this is a reference to the object Introspection has nothing to do with this. > For a long time i thought Python's idea of a returning the value of a > callable-- who's name is unadorned with "(...)" --was a good idea, > however, i am now wholly convinced that this design is folly, Oh well, not everyone has the sense to recognise good design. You should do more Python programming, and less ranting, you might learn something. > and the > reason is two fold: > > 1. Parenthesis should not be required for parameter- less functions. Of course they should. Firstly, parameter-less functions are a code- smell, and ought to be discouraged. Secondly, even if you have a good reason for using one -- for example, random.random -- then the diffe
Re: New to Py 3.3.3 having prob. with large integer div. float.
On Monday, February 10, 2014 6:40:03 PM UTC-8, hlauk.h...@gmail.com wrote: > I am coming off Python 2.6.6 32 bite platform and now in win 8.1 64 bite. > I had no problems with gmpy in 2.6.6 and large integer floating points where > you could control the length of the floating point by entering the bite size > of the divisor(s) you are using. That would give the limit length of the float > in the correct number of bites. > > In Python 3.3.3 and gmpy2 I have tried many things in the import mpfr module > changing and trying all kinds of parameters in the gmpy2 set_context module > and others. > > The best I can get without an error is the results of a large integer > division is a/b = inf. or an integer rounded up or down. > I can't seem to find the right settings for the limit of the remainders in the > quotient. > > My old code in the first few lines of 2.6.6 worked great and looked like this > - > > import gmpy > > BIG =(A large composite with 2048 bites) > SML =(a smaller divisor with 1024 bites) > > Y= gmpy.mpz(1) > A= gmpy.mpf(1) > > y=Y > > x=BIG > z=SML > a=A > k=BIG > j=BIG > x=+ gmpy.next.prime(x) > > while y < 20: > B = gmpy.mpf(x.1024) > ## the above set the limit of z/b float (see below) to 1024 > b=B > a=z/b > c=int(a) > d=a-c > if d = <.001: > proc. continues from here with desired results. > > gmpy2 seems a lot more complex but I am sure there is a work around. > I am not interested in the mod function. > > My new conversion proc. is full of ## tags on the different things > I tried that didn't work. > > TIA > Dan The following example will divide two integers with a result precision of 1024 bits: import gmpy2 # Set mpfr precision to 1024 gmpy2.get_context().precision=1024 # Omitting code a = gmpy2.mpz(SML)/gmpy2.mpz(x) Python 3.x performs true division by default. When integer division involves an mpz, the result will be an mpfr with the precision of the current context. Does this help? casevh -- https://mail.python.org/mailman/listinfo/python-list
[RELEASED] Python 3.4.0 release candidate 1
On behalf of the Python development team, I'm delighted to announce the first release candidate of Python 3.4. This is a preview release, and its use is not recommended for production settings. 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 Python 3.4 is now in "feature freeze", meaning that no new features will be added. The final release is projected for mid-March 2014. To download Python 3.4.0rc1 visit: http://www.python.org/download/releases/3.4.0/ Please consider trying Python 3.4.0rc1 with your code and reporting any new issues you notice to: http://bugs.python.org/ Enjoy! -- Larry Hastings, Release Manager larry at hastings.org (on behalf of the entire python-dev team and 3.4's contributors) -- https://mail.python.org/mailman/listinfo/python-list