Domain: python.org
Stories and comments across the archive that link to python.org.
Comments · 1,513
-
Goodbye, Python 2
I don't know of a major Python library that isn't upgrading to Py3 - and this release marks the tipping point where we wave goodbye to the aging 2.x codebase.
PEP-3003, the moratorium to changes to the language to allow alternative Python implementations to catch up, only applies up to the 3.2 series so we're going to continue moving forward from here. Nobody's forcing Python 2 users to upgrade their code, but there's many advantages and ever decreases hurdles to doing so.
Don't fear change, this change is good and necessary for the advancement of the language.
-
Re:Since when?
You might want to have a look at pip and virtualenv.
In many cases, it lets you largely ignore what python-stuff is installed on the server, that you don't have root access, what package manager it use, and how outdated everything is.
It's still a bit of compiling going on, so you would need source packages for python and posgres (for pysocopg2) - but overall it's considerably easier (also, perfect for testing new versions of packages)
Example, to replicate a set of packages:
pip freeze > reqs.txt #dumps installed packages to the text file
pip install -UE newvirtenvfolder -r reqs.txt
and to activate the new virtenv (which is just a folder that you point env variables to):
source newvirtenvfolder/bin/activate -
VAAPI Acceleration?
I didn't see any mention of VAAPI or XvBA Acceleration for playing media? How about OpenCL support?
Granted the HD 6000 looks more like a gamers card than something you'd stick in a home theater pc, but I'd think that OpenCL support would interest quite a few people doing massive number crunching. Especially since there's even PyOpenCL available.
-
Re:Python vs. BASIC
Python doesn't have turtle graphics
-
Re:But CPAN is shit
There is "pythonforge" but I've never used it.
Pythonforge? Do you mean PyPI, the main repository for Python frameworks and libraries that is the default download location of the flurry of Python install tools (setuptools, distribute, pip) and that contains 12487 packages? You never used it? Good sir, you are missing a little something.
-
Re:Slashdotters get Java wrong, again
Since you mentioned Python directly
Java's JVM does true multithreading.
So does Python. It uses POSIX threads.
Productive, predictable concurrency is possible in Java and not in many other languages
I don't buy that for second. I've written enough multi-threaded and multi-process applications in Python to know that it works well. That is, Python facilitates productive, predictable concurrency. I'll give you the GIL issue, which prevents maxing out multiple CPUs for CPU intensive multi-threaded tasks, but it's not an issue for threading IO (disk and network) bound tasks. And for processor heaving concurrent tasks, the multiprocessing module is well suited.
Java includes a lot of well-organized, stable libraries for doing everything from handling HTTP requests and crafting responses to doing cryptography. Its collections API has many data structures that just aren't present in other languages without looking to a third party.
Python has that too. In fact, its native list and dict types take care of most needs. Although there is a collections module too - no third party software needed. Cryptography has been blocked by the U.S.'s stupid export laws. Pycrypto is available for crypto needs.
Finally, the JVM makes naive code fast. One can write reasonably expressive, straightforward code and expect that the hotspot compiler will optimize it. It's a boon for getting maintainable, quality code out-the-door quickly.
I don't think this gives Java much advantage. Python is arguably more expressive and readable. Everyone here has their own experience they will draw on. Mine has been that although the JVM is much faster, the programs written in Python are at least fast enough, as fast, or sometimes even faster than the Java equivalent. I think this is because often times, much of the processing for Python apps is handled by modules written in C. Anyway, the issues I've run into haven't included apps running too slowly and the "expressive and readable" part are more important to me.
-
Re:Popular Opinion
There are several tools like Psyco that already do this for Python. But if you really want efficient code execution, then you can write your own C modules to Python easily -> http://docs.python.org/extending/extending.html
-
Re:Maybe they did it wrong...
Why settle for snake oil, when you can have the whole snake?
-
Re:Um, isn't java code GPL?
-
Re:Need a better client-side scripting language
Except that Scaling python across multiple cores is also a problem... CPython actually downgrades performance across multiple cores.
see http://wiki.python.org/moin/GlobalInterpreterLock for more information.
-
Install Python in your computer
This will surely get your computer rid of rabbits.
-
Re:Autotools do not need a book
I've run into the same problem with cmake. I don't really have that problem with python tools as python's virtual environment tools seem to handle things nicely. Tools such as pip natively handle virtual environments, automatically installing into it when one is active.
Also, there are lots of nice wrappers to work with python's tools, for developers, such as gogo.
-
Re:Autotools do not need a book
I've run into the same problem with cmake. I don't really have that problem with python tools as python's virtual environment tools seem to handle things nicely. Tools such as pip natively handle virtual environments, automatically installing into it when one is active.
Also, there are lots of nice wrappers to work with python's tools, for developers, such as gogo.
-
Re:Autotools do not need a book
I've run into the same problem with cmake. I don't really have that problem with python tools as python's virtual environment tools seem to handle things nicely. Tools such as pip natively handle virtual environments, automatically installing into it when one is active.
Also, there are lots of nice wrappers to work with python's tools, for developers, such as gogo.
-
Python!
While this answer will almost certainly not suit the OP, it may be of interest to other folk looking to archive their email. Using python and a combination of imaplib and some basic file I/O you can save the original text of messages. My rationale for this was firstly that it's probably less problematic than converting between various email client formats; and secondly that it's a decent way to learn some python!
;)My rather basic implementation just dumps every email from an (IMAP) folder sequentially. I rely on grep for searching. However, it does have the prerequisite of the email being stored on a mailserver accessible via IMAP.
-
Guido's style guide suggests 2.
http://www.python.org/dev/peps/pep-0008/: You should use two spaces after a sentence-ending period. When writing English, Strunk and White apply.
-
Re:Mailing lists
2) What worked for me usually was to subscribe to a mailing list. Not necessarily even the 'official' *-users mailing list, but just one that talks about problems. By reading through other people's common problems, not-so-common problems, and more importantly, the community's solutions will help get a perspective of the language and how other people are using it.
Have any links? It's not hard to find a list if you know a languages' "official" site (Python), but something older (like C) seems to be harder to locate.
-
learn python
Postpone learning the other languages and focus on Python. It has almost as many modules as PERL but us much more readable. It supports object oriented design and is easier to use for small projects than C++.
http://python.org/ -
Re:I like the PHP suggestion.
The python wiki does an ok comparison.
The bottom line is that PHP can be very casual and python can be very scientific. So for someone that wants to whip up a web page, PHP is what I'd recommend. My bias is I'm from a C background and the curly braces are nice. I don't like having to adhere to a particular format to make the language work, make huge long lines, or use weird line-continuation separators. That's also what I hated about VB.
if(1)
{
dothis; dothisalso;
alsothis; this; thistoo;
andthis;thisone;thisalso;andfinallythis(
"with",
"this","parameter" ,"because"
)
;
} -
Re:And this is news?
Python is similar in the "no private or protected methods". As it was said, "We're all consenting adults here."
-
summary wrong on two counts about "one language"
ahh, the summary is wrong both from a W3C DOM standards perspective, because java is listed as the 2nd language supported by the W3C. the summary is wrong from a second perspective in that language bindings to HTML5-compliant web browser engines such as XulRunner and WebKit have been available for years. if Microsoft actually intend also to follow the HTML5 process properly, then it can be said that MSHTML, through its COM interface, also offers other language alternatives for decades rather than just years.
now it's a sad fact that nobody really *knows* that you can get at HTML5-compliant web browser engines and use DOM functions (3000+) and access DOM properties (20,000+) through XPCOM, or Glib/Gobject or COM, but it's perfectly possible. the best demonstration of this at its most extreme limit, taking advantage of absolutely all HTML5 W3C DOM features, is the http://pyjs.org/ pyjamas project, which abstracts the differences between these three major web browser engine types (XulRunner, Webkit and MSHTML aka Trident) and presents a single uniform API. on top this uniform API, normalising the discrepancies between the three engine types, an entire Desktop GUI Widget Set API has been created.
so the statement that there is "one HTML5 language: javascript" is just nonsense. for further examples of accessing HTML5 DOM using python, some of which will lead through to links to Ruby accessing HTML5 DOM such as AppCelerator, see http://wiki.python.org/moin/WebBrowserProgramming
-
Re:Not just for Linux
You can use the OS module to try and abstract some of those problems. For example, os.mkdir() or os.chdir() always does the right thing, using the string os.sep (if I recall correctly, it's been a long time since I've last used it), although I've just noticed that os.chdir() only works on Unix and Windows, so I guess your point still stands.
-
Use Web Engines not Web Browsers
you might want to give serious consideration to creating an application that uses the web engine itself, directly, rather than relies on the broken-ness of the web browser "applications".
two possibilities for you where you can start: http://wiki.python.org/moin/WebBrowserProgramming if you prefer python, or if you truly prefer ruby, try http://github.com/ppibburr/rbwebkitgtk which is ruby bindings to webkit *including* direct access to the 2,000+ functions of the DOM model.
in this way, you can set up an application (ruby-gtk+ app) where you will be able to have your *own* menubar at the top - not the stupid web browser's one; on it, you would have a "Print" option which went and accessed the DOM model's "innerHTML", and you passed it to a *decent* printing system under *your* control, using whatever printing methodology is accessible to you via ruby, running on the user's machine.
or python, if you prefer.
this type of methodology seems to have been entirely forgotten about, as people scramble for conversion of complex apps to "entirely web-based" because they were convinced that "web 2.0 is Good and is God", and then run head-long into exactly the difficulties you're encountering, by which time it's too late.
advice: bypass the web browser as a de-facto application, and create your own application still using the incredible power of web browser *engines*.
-
Re:Common sense prevails
At least Python users generally admit that they're using Python as a prototyping language, just because it allows for quick, but shitty, development. When their idea is somewhat proven, then go back and rewrite it using a real programming language like Java or C++.
You mean like Youtube?
Python is fast enough for our site and allows us to produce maintainable features in record times, with a minimum of developers.
Or like EVE Online?
Python enabled us to create EVE Online, a massive multiplayer game, in record time. The EVE Online server cluster runs over 50,000 simultaneous players in a shared space simulation, most of which is created in Python.
More: http://www.python.org/about/quotes/
I don't know about Ruby, but I disagree with your opinion on "shitty development" of Python.
-
If it slithers like a duck and hisses like a duck
When talking about dynamic typing, what most people mean is dynamic member dispatch - i.e. being able to call method "foo" on any object that has it without knowing its type.
In other words, duck typing, where the entirety of an interface is the name of a method, as opposed to interfaces with names that in turn contain the names of multiple methods. Python is one language that has this, but in fact lately it has been trying to get away from duck typing; witness the deprecation of isCallable(), isMappingType(), isNumericType(), and isSequenceType() in favor of interface-like abstract base classes in Python 2.6's new collections and numbers modules designed for testing with isinstance(), which acts like a Java cast or a C++ dynamic_cast.
-
If it slithers like a duck and hisses like a duck
When talking about dynamic typing, what most people mean is dynamic member dispatch - i.e. being able to call method "foo" on any object that has it without knowing its type.
In other words, duck typing, where the entirety of an interface is the name of a method, as opposed to interfaces with names that in turn contain the names of multiple methods. Python is one language that has this, but in fact lately it has been trying to get away from duck typing; witness the deprecation of isCallable(), isMappingType(), isNumericType(), and isSequenceType() in favor of interface-like abstract base classes in Python 2.6's new collections and numbers modules designed for testing with isinstance(), which acts like a Java cast or a C++ dynamic_cast.
-
If it slithers like a duck and hisses like a duck
When talking about dynamic typing, what most people mean is dynamic member dispatch - i.e. being able to call method "foo" on any object that has it without knowing its type.
In other words, duck typing, where the entirety of an interface is the name of a method, as opposed to interfaces with names that in turn contain the names of multiple methods. Python is one language that has this, but in fact lately it has been trying to get away from duck typing; witness the deprecation of isCallable(), isMappingType(), isNumericType(), and isSequenceType() in favor of interface-like abstract base classes in Python 2.6's new collections and numbers modules designed for testing with isinstance(), which acts like a Java cast or a C++ dynamic_cast.
-
Why *reboot*? Perl & Python *do exist* for Win
This being
/. though, I'll have to mention a small customized LiveCD (think DSL sized) with a (perl script | python script | brainfuck implementation | emacs extension | vi/vim script | whatever)Why reboot onto a CD ?!?
Python, Perl, and the likes are all freely available on Windows too.
Several even features way to pack everything needed (Run-time env + your script + its dependencies) into a single installer or executable.I would definitely vote for them as they are widely available language on lots of different platform and each feature huge collection of extensions.
(As are Visual Studio Express and Monad PowerShell if you deffinitely need a pure Microsoft solution while trading some freedom and portability)
-
Re:Python for Scientific use
Yes they are. Skip down to the section Changes Already Present In Python 2.6. String formatting is deprecated in favor of their new horrible way. They're going to try to get rid of the old, good way. I won't switch to 3.0 unless they give up on that, but so far they haven't.
-
Re:Python for Scientific use
The original plan was to completely eliminate the '%' string formatting operator by version 3.2
I don't know if they are still committed to this, since, as I mentioned, this is one of the stupidest decisions one can imagine. But they still mention in the str.format method documentation that "This method of string formatting is the new standard in Python 3.0, and should be preferred to the % formatting described in String Formatting Operations in new code."
In the PEP-3101 documentation the abstract says: "This PEP proposes a new system for built-in string formatting operations, intended as a replacement for the existing '%' string formatting operator"
In the official Python 3 specification it's mentioned that "A new system for built-in string formatting operations replaces the % string formatting operator. (However, the % operator is still supported; it will be deprecated in Python 3.1 and removed from the language at some later time.)"
So, there is a very well defined intention to eliminate the '%' string formatting operator, although I believe they will find it harder to implement than they thought at first.
If they go ahead and implement every stupid proposal that has been made for Python 3, I think the best solution would be to fork Python. Name it the "Python 2.7" version, one that will never reach version 3. My proposal is to do like Donald Knuth did for TeX versions, which approach the value of pi. Let's have Python 2.7, 2.7.1,
... 2.7.1.8.2.8.1.8.2.8.4.5.9.0.4.5, etc. -
Re:Python for Scientific use
Yes, I saw that and had similar thoughts. Also they should look at virtual environment and look at Interactive python
-
the problem with learning insecurity from web-devs
is that they generally don't know wtf they're talking about; I only looked at the part on buffer/integer related overflows; where they take the moment to not only give me flat out wrong advice, but also see fit to try and propagandize me:
"This codelab doesn't cover overflow vulnerabilities because Jarlsberg is written in Python, and therefore not vulnerable to typical buffer and integer overflow problems. Python won't allow you to read or write outside the bounds of an array and integers can't overflow. While C and C++ programs are most commonly known to expose these vulnerabilities, other languages are not immune. For example, while Java was designed to prevent buffer overflows, it silently ignores integer overflow. "
The thing is google of all organizations, and specifically appspot should know better. I mean, I already told them. I mean seriously, look at this.
Of particular interest is: http://bugs.python.org/issue2620 ... reported: 2008-04-11 22:35:37 bug closed: ?????
Just stop with this incessant bullshit 'lol hey my program-by-number language of choice doesnt have memory corruption security issues@#@!#'. It's all assembly at the end, and the processor does whatever you tell it, so everything has this problem. I thought this would be clear from my work, Dowd's actionscript work, nemo's obj-c work, ilja's pascal work, brezinski & mcdonalds ruby work, et cetera.
In short, when you try to talk about things you don't know, especially in the realm of security; you do more harm than good. -
the problem with learning insecurity from web-devs
is that they generally don't know wtf they're talking about; I only looked at the part on buffer/integer related overflows; where they take the moment to not only give me flat out wrong advice, but also see fit to try and propagandize me:
"This codelab doesn't cover overflow vulnerabilities because Jarlsberg is written in Python, and therefore not vulnerable to typical buffer and integer overflow problems. Python won't allow you to read or write outside the bounds of an array and integers can't overflow. While C and C++ programs are most commonly known to expose these vulnerabilities, other languages are not immune. For example, while Java was designed to prevent buffer overflows, it silently ignores integer overflow. "
The thing is google of all organizations, and specifically appspot should know better. I mean, I already told them. I mean seriously, look at this.
Of particular interest is: http://bugs.python.org/issue2620 ... reported: 2008-04-11 22:35:37 bug closed: ?????
Just stop with this incessant bullshit 'lol hey my program-by-number language of choice doesnt have memory corruption security issues@#@!#'. It's all assembly at the end, and the processor does whatever you tell it, so everything has this problem. I thought this would be clear from my work, Dowd's actionscript work, nemo's obj-c work, ilja's pascal work, brezinski & mcdonalds ruby work, et cetera.
In short, when you try to talk about things you don't know, especially in the realm of security; you do more harm than good. -
Python
Python has a human-centric method of working with floating-point numbers: the Decimal class.
-
Re:Who cares?
The standard discussion forums for a great many tech communities are still on Usenet: comp.lang.python,
Nope, it's a mailinglist far as I'm concerned: python-list
I could care less if the newsgroup counterpart went offline tomorrow; for me, it'd just mean less spam and no more invalid "From" addresses in posts.
-
Re:Tricky
I see you used spaces rather than tabs... How anti-developer of you!
Somebody's clearly not a Pythonista. (oh I know, it's an awful name)
-
Re:The VM is decent. The language sucks.
They gave up on removing the GIL, and their work is accepted for merge into Python 3.3.
-
Re:python python python blahblahblah
you are exaggerating.
PHP has 5718 functions in the main namespace. Python has 79. Which is easier to learn and less likely to cause collisions?
-
Re:My $0.02
>"Eve online has stacks of code written in python. If that isn't "published" enough for you, then Civ4 runs a stack of python code as well. "
I don't mean that kind of "published". I mean getting Joe Sixpack to install a Python app on his machine.
If I Google for "Python deployment" the first hit is this: "One of the most-frequently asked questions of all time is this: "I have a Python application I've developed; how do I deliver it to my customer/friend/...?" "
If the 'typical answer' is this: "tar up the source and send it. It's reasonable to expect that the end-user's host will have Python installed." then I'm not so sure Python is ready for the big time.
-
python python python blahblahblah
http://wiki.python.org/moin/PythonVsPhp
this is from python's own wikia. i dont see why some of you try to lord it over everyone over php. and despise the latter.
-
Re:Faster than you think
I have to agree. I think python is going to be the easiest to teach them and will be plenty fast enough. Here is a link to an article about a teacher introducing high school students to python and the successes encountered. http://www.python.org/workshops/2000-01/proceedings/papers/elkner/pyYHS.html
-
Re:"many developers are so intrigued"
see threading, okay no JIT i give you, but python does have threads. http://docs.python.org/library/threading.html http://docs.python.org/library/thread.html
-
Re:"many developers are so intrigued"
see threading, okay no JIT i give you, but python does have threads. http://docs.python.org/library/threading.html http://docs.python.org/library/thread.html
-
Re:Use a persistence library
Except that Python's DB-API is a horrible mess. Depending on what db_module is, you might need to spell your query as:
curs.execute('select field1, field2 from table1 where field3 = ? and field4 = ?', ('foo', 7.6))
curs.execute('select field1, field2 from table1 where field3 = :1 and field4 = :2', ('foo', 7.6))- curs.execute('select field1, field2 from table1 where field3 =
:field3 and field4 = :field4', {field3:'foo', field4:7.6}) - curs.execute('select field1, field2 from table1 where field3 = %s and field4 = %s', ('foo', 7.6))
- curs.execute('select field1, field2 from table1 where field3 = %(field3)s and field4 = %(field4)s', {field3:'foo', field4:7.6})
These aren't options that you have as a programmer, no. db_module.paramstyle tells you what format to use, and your application needs to use the one the back-end is expecting. It's a perfect example of why "can't decide? just make it an option!" is not a viable strategy.
-
Re:Cover art
http://www.python.org/doc/faq/general/#why-is-it-called-python It's not named after that nasty snake thing. so no snake on the cover is good.
:P -
Re:Better Than First Edition?
If not this book, care to share an alternative recommendation or two?
Well, I can't disagree with the grandparent's very nice flame, but why not start with Guido's tutorial? http://docs.python.org/tutorial/ Between that and the library reference, I was up and running making useful scripts in an afternoon at work one day, but I had previous programming experience. But since this book isn't for people like that, who is it for? Only people I can think of are language lawyers, and there's a free source for that as well! http://docs.python.org/reference/index.html
-
Re:Better Than First Edition?
If not this book, care to share an alternative recommendation or two?
Well, I can't disagree with the grandparent's very nice flame, but why not start with Guido's tutorial? http://docs.python.org/tutorial/ Between that and the library reference, I was up and running making useful scripts in an afternoon at work one day, but I had previous programming experience. But since this book isn't for people like that, who is it for? Only people I can think of are language lawyers, and there's a free source for that as well! http://docs.python.org/reference/index.html
-
Re:Not mentioned is that he was using linux....
That's very kind....makes my day.... There was also Ada Lovelace on the other side of the card...... Tech details... Ubuntu, python http://www.python.org/ enthought http://code.enthought.com/ opencv http://opencv.willowgarage.com/ yarp http://eris.liralab.it/yarp/ KDL http://www.orocos.org/kdl Gamera http://gamera.sourceforge.net/ Shapely http://pypi.python.org/pypi/Shapely/ few other bits and pieces Hardware: Dell xps13, Intel atom motherboards, 1gig ram, 4gig usb thumb drive, and wifi dongle, router... Arduinos, philips webcam, low cost micro servos, AX12 Bioloids servos, USB2Dynamixel, ikea lights and tables...that's about it..pen and paper...
-
Re:Not mentioned is that he was using linux....
That's very kind....makes my day.... There was also Ada Lovelace on the other side of the card...... Tech details... Ubuntu, python http://www.python.org/ enthought http://code.enthought.com/ opencv http://opencv.willowgarage.com/ yarp http://eris.liralab.it/yarp/ KDL http://www.orocos.org/kdl Gamera http://gamera.sourceforge.net/ Shapely http://pypi.python.org/pypi/Shapely/ few other bits and pieces Hardware: Dell xps13, Intel atom motherboards, 1gig ram, 4gig usb thumb drive, and wifi dongle, router... Arduinos, philips webcam, low cost micro servos, AX12 Bioloids servos, USB2Dynamixel, ikea lights and tables...that's about it..pen and paper...
-
Re:Final cut pro == sad
Lets not forget things like Big Buck Bunny (http://www.bigbuckbunny.org/) the whole video was made with FOSS tools. Hell, here's the list of every program/software they used:
Blender http://www.blender.org/
GIMP http://www.gimp.org/
Python http://www.python.org/
Inkscape http://www.inkscape.org/
SVN http://subversion.tigris.org/ (I think thats the right link)
Ubunutu http://www.ubuntu.com/