Domain: python.org
Stories and comments across the archive that link to python.org.
Comments · 1,513
-
Re:first post?
Real scientist use the Python programming language with Numpy and MatPlotLib
:DHa! Real scientists don't use Perl, Python, or any of those namby-pamby programming languages. Real scientists use slide rules and a No. 2 pencil.
-
Re:first post?
No Perl is. Real scientist use the Python programming language with Numpy and MatPlotLib
:DIn my experience, scientists tend to use Excel VBA and incredibly convoluted batch files.
Disclaimer: I mostly met mad scientists.
-
Re:first post?
No Perl is. Real scientist use the Python programming language with Numpy and MatPlotLib
:D -
Re:Django
Seems a bit weird, but I did some digging, and it appear that versions before 1.2.1p2 weren't thread-safe. According to details at http://wolfram.kriesing.de/blog/index.php/2006/multithreading-with-mysqldb-and-weakrefs
From here:
If you are using the older version you will see
bugs. There is no question about this. It's just dangerous in production
environments. So we should be up front about it.You don't say which version of django you were trying to run, but apparently v0.96 (where the requirement bump happened) they added an option to still run with the old mysql backend, but it wouldn't be maintained in the future..
https://docs.djangoproject.com/en/dev/releases/0.96/?from=olddocs#mysqldb-version-requirement
While I do understand the change, I also understand the frustration of old packages (and various hacks to get newer versions installed). And in the python ecosystem things still happen rather fast. Which is why I've changed to use virtualenv and pip for my development and deployment, and that mostly take all the problems out of it. I have a system that's deployed to gentoo, debian stable and newest ubuntu release - before virtenv and pip it was a royal PITA to keep everything synced up. Now I can more or less deploy it effortlessly on just about any unix. I haven't tried on windows, but most of it should be working there, too.
But generally, making a large python / django app these days without either pip+virtualenv or buildout (or equivalent) is just irresponsible. Both makes it incredibly easy to reproduce an exact python environment, and makes both testing and deploying much, much easier (often, its a 1-2 command deploy, instead of 1-2 days deploy + debug all the different versions)
Anyway.. Sorry to hear of your problems, and I'm a bit sad to see it being necessary.. But there was a reason for it, and there are tools to make it much easier on the sysadmin (lovely feeling knowing that all that crazy stuff is contained in one user directory, and does not touch anything system-wide). And also, next time someone mentions django, maybe you won't dismiss it out of hand
:) -
Re:Design Matters
Here is the Perl shell documentation
Here is the documentation for Python's interactive shell
And let's not argue that there is a difference between a "shell" and an "interactive command-line interpreter".
-
Re:What happened to "Batteries Included"?
Whoever said that Python is the best tool for every problem?
Guido van Rossum. Next question, please?
Guido never said any such thing.
The rest of your post is riddled with equally sloppy reasoning.
|>ouglas
-
What happened to "Batteries Included"?
Whoever said that Python is the best tool for every problem?
Guido van Rossum. Next question, please?
I used to be a big Python fan, but Python 3 cured me of this disease. Python 3 was a big blunder from some theorists who never actually had to develop a complex software system. The most dangerous fuck-up was changing the way division works.
It used to be that (3 / 2) in Python returned 1, now it returns 1.5. That's a big no-no to everyone who works with professional software. If you work with toy systems like class assignments that will be run once and then forgotten, it's no problem changing the way an operator works. If your software does something important, you cannot accept a change that means you have to go through every line of code with a fine-toothed comb looking for every division and verifying if it will be affected or not by the new rules. Remember, Python has dynamically typed variables.
Yes, I know, there's a PEP somewhere that said to use
// whenever you wanted an integer result from a division. This means that when you learn Python the first thing you must do is to read a collection of several hundreds of PEPs before you write your first line of code. Is that a great introductory programming language?I think Python 3 was a blunder of first magnitude. A computer language should be about easing the use of the computer, not creating needless tasks. As a matter of fact, every single change introduced by Python 3 makes the language harder to use. Compare the old formatting operator with the new format method, for instance. How much more typing you need just on the off-chance that someday somewhere someone will want to use both position and name to locate the arguments.
Python now has walked very far from the "batteries included" principle. If I have to learn a programming language just to need to learn a new programming language when I start using a computer, what use is it? Better to start learning C instead.
The first computer language I learned was Fortran, I know people who never learned another language because Fortran was all an engineer used to need. Pascal was also used as an introductory language in the 1970s and 1980s, and I think it's much better than Python in that respect. Knowing Pascal you can jump effortlessly to C.
I have used Python a lot for what it does best, which is prototyping scientific calculations using NumPy and SciPy. It's much better than Matlab for this because it has a better syntax. Unfortunately, since I run the risk of getting new bugs from Python 3 or other future versions, now I feel I must convert all those programs I wrote in Python to C. My approach used to be that if a program is not used often enough for the lack of speed to bother me I left it in Python, alas, no more.
-
Re:Why BASIC? What for?
-
Re:Why BASIC? What for?
-
Re:Why BASIC? What for?
-
Re:Why BASIC? What for?
-
Re:Why BASIC? What for?
-
Re:Can you elaborate?
Yes, I mean DBUS. It has nice bindings for many languages, but python works well enough for simple scripting. Here are some simple examples to get you started, but it should be easy to write some scripts and have FVWM2 call those to populate whatever you need populated.
-
Re:Windows virus detector in python?
To install python on windows
http://python.org/ftp/python/3.2.2/python-3.2.2.msi
My problem is that the
.py file seems to be coded as HTML. Perhaps it is just that darn time change... -
Re:Quorum looks a lot like Pascal
-
Re:What are they trying to prove?
It is. It's not correct to call whitespace a block delimiter, by the way, every line starts with a number of spaces corresponding with its block nesting level.
In the years that I've been using Python I haven't had a single issue with it. I just keep enjoying the lack of the kind of visual clutter in many other languages that I've always percieved as a distraction. All the stupid discussions about where exactlty you should put the accolades are a clear indication that they get in people's way.
Why do you use indentation in languages that don't need it to compile? Because it corresponds with how humans recognise structure. Every programming language is a bridge between what a human can oversee and what a CPU can process. Making indentation meaningful puts the balance a bit closer to the human. That's good, it helps to make a better bridge.
If some language theory say it's wrong to give meaning to whitespace to indicate blocks (I've seen that argument several times) I would say that when things that work just fine are in conflict with a theory then there may be something wrong with the theory. If there are practical objections based on things you do with your editor then they can be solved by changing one or two habits. You do need to overcome religious wars about tabs vs spaces for indentation, and just use the 4 spaces per indentation level that PEP 8 recommends.
It isn't a good fit for every situation, I want to have explicit delimiters in a template language, eg. for HTML. But if that becomes a mess without explicit block delimiters it's because mixing languages in that manner is messy anyway.
-
Re:PostgreSQL?
I develop web applications every day with PostgreSQL and Python, both very popular projects which originated in universities. I also depend on the ubiquitous Apache HTTP server which was originally a derivative of a university project. Both my development and production environments are GNU/Linux. GNU and Linux were not projects at universities, but they were non-commercial and inspired by experiences in universities.
Though Unix originated at AT&T, the additions from BSD have profound and lasting effects on all modern operating systems, especially Unix-like ones. The Internet was developed at universities and TCP/IP was originally implemented on BSD Unix.
-
Re:Die!
Is that why Python doesn't have advanced concepts like threading? Is that why Python is considered a good teaching language? Do you really think there aren't mediocre Python programmers out there?
-
Re:Makes sense
You haven't named any flaws in JavaScript as a language
This question keeps coming up in every Slashdot story mentioning JS. Frankly, I'm sick and tired of having to re-type it over and over again. I'll just keep linking to this post from now on.
there are a lot of things that JavaScript does really well. Try doing what an asynchronous XMLHttpRequest does in Python, or Java, or pretty much any other language.
What, you've never used an asynchronous API in other languages? I guess then that you don't know that some of them have a single standardized API that is shared beween all async operations (rather than some ad-hoc, slapped-together design for one very narrow use case). And some even have extensive support for async operations in the language itself.
-
Take a Look at CPython
CPython's source is easy to find and easy to read. The core dev community has gone to pains to keep it simple. It's also pretty well documented and has a great community in general. You can download the source at python.org or look at it online (http://hg.python.org/cpython/). You make a mercurial clone on your local box for hacking and use bitbucket to host it publicly.
I've found the CPython source to be a fount of knowledge. A great place to start is the devguide. -
Take a Look at CPython
CPython's source is easy to find and easy to read. The core dev community has gone to pains to keep it simple. It's also pretty well documented and has a great community in general. You can download the source at python.org or look at it online (http://hg.python.org/cpython/). You make a mercurial clone on your local box for hacking and use bitbucket to host it publicly.
I've found the CPython source to be a fount of knowledge. A great place to start is the devguide. -
Re:Lua?
Python being the poorer choice because it is not designed to be an extension (scripting) language.
Well somebody needs to tell CCP of Eve-Online they're doing it wrong, same goes for Stackless Python project, and the authors who wrote the official Python documentation that they were wrong to document Embedding Python in Another Application. Because batrick on Slashdot said it wasn't designed for that...
If you go back to the history of Python you'll see that it wasn't originally designed with embedding in mind. As a consequence, many of its features and choices make it very difficult to do [1]. Keep drinking the Koolaid. If you hammer on a screw enough times, it will eventually sink into the wood.
[1] http://developers.slashdot.org/comments.pl?sid=2406518&cid=37267170
-
Re:Lua?
Python being the poorer choice because it is not designed to be an extension (scripting) language.
Well somebody needs to tell CCP of Eve-Online they're doing it wrong, same goes for Stackless Python project, and the authors who wrote the official Python documentation that they were wrong to document Embedding Python in Another Application. Because batrick on Slashdot said it wasn't designed for that...
-
Need a python editor?
Try snaked!
Its a materialistic, foss editor with python focus from python programmers for python programmers. You have to spend a little time getting used to it but wont regret it.
And yes, it does run on linux.
-
Re:Oh come on!
I'd like to know what Guido thinks of this.
If I do a new PSA budget, will I have to add a line item for M$?
Wow, 20 years of making sure my indents aren't screwed up.
-
Re:Works as well as it did 10 years ago
Here you go, just not linked from the downloads page: http://python.org/ftp/python/
Thanks! I'll see if I can get that application going (PyROOT) when I get my laptop back
:) -
Re:Works as well as it did 10 years ago
The problem with dropping support is that many organisation take away the old versions from their web or ftp sites. I experienced this recently, trying to get Python 2.6 for windows, because some software depended on it.
Here you go, just not linked from the downloads page: http://python.org/ftp/python/
-
Re:One day we will be done with java...
Its funny that Python has had this licked for some time now. In fact, they have an entire interface to allow for clean resource acquisition and release of any object and even added a statement to compliment.
Python's combination of, "with/as", context management, and, "try/except/else/finally", make error handling and recovery for even complex use cases fairly easy and extremely powerful.
-
Re:One day we will be done with java...
Its funny that Python has had this licked for some time now. In fact, they have an entire interface to allow for clean resource acquisition and release of any object and even added a statement to compliment.
Python's combination of, "with/as", context management, and, "try/except/else/finally", make error handling and recovery for even complex use cases fairly easy and extremely powerful.
-
Re:serious factual inaccuracy
Granted, the choice of words is vague and the concept of coverage needs elaboration. Despite the distinction that is often made between the 2.x and 3.x branches, some features appear in minor versions belonging to each of them. Specifically, many of the features that were originally intended for 3.0 were back-ported to 2.6 as described in What's New in Python 3.0. In fact, there are library components in 3.0 that were later deprecated in 3.1!
I suppose I was paraphrasing the author's statement about his attempt to write future-proof code (as much as possible), so that most of the code could run unmodified or with minimal modifications. If you understand coverage as such, then there will be no confusion. However, if you understand coverage as the ability to write code that will readily run on both versions (having been tested on both), then you are right in pointing out the discrepancy.
As to the last comment, I surely did not go through an exhaustive proof-reading of the book à la peer review! I don't know about you, but I don't have that much free time to spare on such an adventure, so no, I didn't go through the 1300-page book, looking closely at the statements and library calls to know which versions of Python it covers (2.5, 2.6, 2.7, 3.0, 3.1, or a subset). My aim was to describe the structure of the book and overall place within the literature as well as the benefits that it may endow a programmer to carry out development activities.
-
keep the day job, expand your skills
for my employer, on any job I might be project manager, systems architect, developer, sometimes even racker of hardware and cable puller. I still learn a new language now and then, and now and again actually use them at a client.
Have you had much object oriented exposure? if not, get that way of thinking into your skill set with a widely versatile language that is used for command line, web, daemon and applications. I'd suggest Python, learn the basics, then do some web development, then go into a web framework (take your pick) and also learn to call C libraries with python.
http://docs.python.org/index.html -
Re:Bazaar
Then some other features like "explicit moves/renames" may sound great for novices, but it does not work well in truly distributed workflow.
Wow, I am offended that you consider me to be a "novice". I have never heard this argument before: the old mantra "explicit is better than implicit" applies here -- usually it's argued that implicit may sound great for novices, but it doesn't work well having a heuristic in the large scale, and if you have people who know what they're doing, explicit is far better.
I don't follow your argument at all. I use Bazaar's branching and merging extensively -- I have branches on branches and I merge every whichway imaginable. You're going to have to justify your statement that when "the history graph is far more complex... your explicit tracking does not work well". In Bazaar, you say "file A was renamed to file B." It doesn't matter how many branches or merges that change propagates through, or in which direction, it still remembers (because you told it) that that file was renamed. All changes made to the file in any branch, regardless of whether the changes were made to the file when it was called "A" or when it was called "B", are merged correctly. I have never encountered such a problem, nor can I imagine a situation in which a problem might arise (assuming you correctly told Bazaar that the file was renamed in the first place). With Git, on the other hand, you have to hope that the rename detection has works, and it is especially poor across merges. Even the expert cannot help in certain situations. I have encountered this problem on small trivial examples as well as on large repositories. The following is all that is required to trigger a complete merge failure on Git:
1. Create a repository with a file "A" in it,
2. Create a second branch,
3. In the branch, modify the file extensively (about 50% of the file). To make it more realistic, do it over, say, 10 commits instead of just one (this voids the argument "you shouldn't be changing so much in a single commit"),
4. In the branch still, rename the file to "B", and commit the change,
5. In the master, modify the file just a tiny bit (one byte should do it),
6. Merge from the branch to master.You will find (if you changed the file enough in step 3) that Git hasn't detected the rename, so instead, there is a merge conflict in "A" between the change made in step 5 and the deletion of the file (Git keeps the file around and says "Deleted by them"). There is no conflict in "B"; it's just a new file. Now the user must manually merge the files "A" and "B", because Git hasn't even attempted a three-way merge. I tried this example using both Git and Bazaar. With Git it happened exactly as I described. With Bazaar, because I explicitly told it about the move, the three-way merge worked perfectly.
I would like to hear some examples of where explicitly specifying moves breaks things. I can't imagine how it could possibly be a problem, and all you've said is "it doesn't work well".
This is not true. By definition metadata is "data about data", and Git stores its own metadata in the commit object, but it does not store foreign metadata. There is two reasons for that. First, Git may not know how to deal with them during some operations (e.g. git-rebase).
Exactly -- it doesn't store foreign metadata. That's the problem: Git is hostile to foreign VCSes. Why shouldn't git know how to deal with them during some operations? Bazaar stores foreign metadata and it tracks it perfectly fine. You mention rebase: that's actually an exception. The reason a foreign VCS needs to store metadata is to make sure the same commit object contains exactly the same data. When you rebase, you're creating a commit object, so it's fine if Git were to drop the metadata at that point.
if this information does not make sense to the user and only necessary for inteeropera
-
Not recommended, the explanations are too thin.
I have done very little programming (other than excel) since my college classes in Pascal. based on the reviews here, and the fact that the book is available online for free, I decided to give this book a try.
I have gotten to this, "Try more format characters. %r is a very useful one. It's like saying "print this no matter what". Search online for all of the Python format characters."
Well, I searched online. I went to http://docs.python.org/library/stdtypes.html and found this
String and Unicode objects have one unique built-in operation: the % operator (modulo). This is also known as the string formatting or interpolation operator. Given format % values (where format is a string or Unicode object), % conversion specifications in format are replaced with zero or more elements of values. The effect is similar to the using sprintf() in the C language. If format is a Unicode object, or if any of the objects being converted using the %s conversion are Unicode objects, the result will also be a Unicode object.
If format requires a single argument, values may be a single non-tuple object. [4] Otherwise, values must be a tuple with exactly the number of items specified by the format string, or a single mapping object (for example, a dictionary).
A conversion specifier contains two or more characters and has the following components, which must occur in this order:
The '%' character, which marks the start of the specifier.
Mapping key (optional), consisting of a parenthesised sequence of characters (for example, (somename)).
Conversion flags (optional), which affect the result of some conversion types.
Minimum field width (optional). If specified as an '*' (asterisk), the actual width is read from the next element of the tuple in values, and the object to convert comes after the minimum field width and optional precision.
Precision (optional), given as a '.' (dot) followed by the precision. If specified as '*' (an asterisk), the actual width is read from the next element of the tuple in values, and the value to convert comes after the precision.
Length modifier (optional).
Conversion type.
When the right argument is a dictionary (or other mapping type), then the formats in the string must include a parenthesised mapping key into that dictionary inserted immediately after the '%' character. The mapping key selects the value to be formatted from the mapping.Just to ask, do you really think this means much to a person who has not been involved in programming for several years?
This book is both too basic, with the instructions of "just type what you see," and too advanced, with an assumption that the reader already knows about the subject and needs no explanation beyond "go look it up somewhere"
-
This sounds like a good start
A month or so ago I decided to pick up a Python book at the Borders-is-dying sale, and while it's from O'Reilly, the book is too much of a reference - a lot of bottom-up "here's are six different list-like things" and "nobody expected the Spanish Inquisition, which is why you need to use this method to catch the exception it throws, but you can change that by overloading _ _ that _ _ method name's variable __pope__ or using _ComFyChaiR_ instead, but you can't set __pope__ to French, because that object uses __antipope__ instead, though in later versions you can modify it by using Cardinal()."
A friend of mine pointed me to python.org's tutorials", which were going to be my next step, but this looks pretty simple and accessible too.
-
Re:Starter
Actually, it has... http://docs.python.org/release/3.0.1/whatsnew/3.0.html Python is a mess.
-
Re:Close, but no Cigar...
I would pay good money for a PowerShell implementation on Linux, and even more if Linux internals were exposed in the same way that WMI objects are on Windows.
And this is from a thirteen-year Linux veteran.
It's surprising that a thirteen-year Linux veteran wouldn't have discovered Python, which also is based on the idea that everything is an object, and has run on Windows and any kind of *nix for many years before PowerShell showed up. Its standard library has a huge amount of functionality built in and PSI - Python System Information looks like an easy way to get at system information. The enhanced interactive shell IPython has a lot of time saving features compared to the default one. Even on Windows, I'd rather use Python than PowerShell, since it has easy access to all the same COM and WMI objects that PowerShell does.
-
Re:Python 3 is death to Python
Here's your memo: PEP 238. I believe that it's frequently referenced in the "what's new" section of various point releases of Python since the PEP was published.
-
Examples from Python itertoolsI don't know Haskell or ML, but I do know the itertools module in Python, which represents a bunch of lazy-evaluated iteration concepts borrowed from Haskell and ML.
with for loops, you can: * break out of it early
Some cases of breaking early can be represented as composition of iterator operations: "Find the first ten elements that meet these criteria" is something like islice(ifilter(criterion, seq), 10) where criterion is a function returning nonzero for elements that match. "Find all elements until the first not meeting the criteria" is takewhile(criterion, seq). What were you thinking?
iterate a subsequence without actually creating a subsequence, step across several elements on each iteration
You mean like Python islice(seq, start, stop, step), which takes anything iterable and returns an iterator of a subsequence?
-
Re:Worst /. article ever?
There are many documented large non-open projects that use Python. It is nowhere nearly as wide-spread as Java or C#, but it also has no marketing department.
I'm not going to say it is "better" than C# or Java, because those are both awesome tools. I was merely pointing to Python + C code as an example of where you could benefit from mixing languages when you need more speed than Python (or for that matter Java or C#) can give you alone. Certainly you don't want to write an entire application in C just because you want the speed of C in some areas?
Another example, if you prefer C#, would be to call a custom DLL that is written in C/C++ from C#. This can be done in a clean, maintainable way. There are probably whole books on marshaling.
-
EAFP
Who comes up with data structures that throw an exception because you asked it if something was inside and the answer was 'no'?
Guido, that's who. One of the Pythonic principles is that forgiveness (try/except) is easier than permission (testing first).
-
Re:Seriously
When will emacs or vim be available for Mac???
You mean like they already are?
Python packages are also a huge problem on a Mac. It is not like setuptools exist for Mac OS X....
Do you just just not know how to google that shit?
Also, when I develop for the web I always format all my devices to HFS+. I will never use FTP or SAMBA as they do not work on Mac.
What on earth?! Are you suggesting you can't just FTP from or to a Mac? Are you trying to mount a Mac drive as a Samba share? why?
-
Re:Letting it all out
I understand your criticism of prototype languages, but Python is not one of them. Python is a strongly typed language.
-
Re:Another great Python 3.x series release
Guido has stated quite publically that anyone is welcome to fork any version of Python - this exact topic has been discussed many times on python-dev (the mailing list for development of Python). Of course, it's up to them to maintain and popularise the fork.
What they don't get to do is call it Python. "Python" is a trademark of the Python Software Foundation when the term is used to refer to a programming language.
The fork could be called a "Python-like" language, or even claim to be "Python-compatible"*.
* for some level of "compatible".
-
Re:And there is NO...
Looking for "python hosting" gave me plenty
I put python 3 web hosting into Google but couldn't quickly find anything relevant.
including here which lists multiple. [...] I'd bet that lots of these also provide general python 3 hosting as well.
Notice how all the hosts on this list still offer only 2.x.
If you're looking for python hosting you'd also likely be looking for django hosting
Is Django even ported to Python 3 yet?
-
Re:And there is NO...
You might want to try learning how to search. Looking for "python hosting" gave me plenty, including here which lists multiple.
If you're looking for python hosting you'd also likely be looking for django hosting, of which there are many to choose from, and I'd bet that lots of these also provide general python 3 hosting as well.
So, to sum up, there is LOTS of python 3 web hosting that I managed to find in under 3 minutes.
-
Re:Another great Python 3.x series release
Yes, $10.00/month is horribly expensive and common and is becoming more and more common every day.
You do realize its trivially easy to find hosting which allows you to install your own languages?
Python does not require root access to install. Not to mention, python's virtualenv makes installing, configuring, and carrying your custom python environment and dependencies to other hosts trivial.
-
Python 3 packages
PIL is working on Python 3; "The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and 2.6. A version for 3.X will be released later" (source). So is Django, Turbogears, wxpython, pygtk, etc. You can vote on which major 3rd party packages you'd like to see ported.
PyQT, CherryPy, Genshi, and many others are already ported to Python 3.
-
Python 3 packages
PIL is working on Python 3; "The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and 2.6. A version for 3.X will be released later" (source). So is Django, Turbogears, wxpython, pygtk, etc. You can vote on which major 3rd party packages you'd like to see ported.
PyQT, CherryPy, Genshi, and many others are already ported to Python 3.
-
Re:Is the GIL removed from the interpreter
ha, at least a nice reply. You are not a butt-hurt loud mouth like one of the above poster. Thank yuo
Oh, you wanted an answer. Honestly, it never crossed my mind that you were doing anything but trolling about a difficult problem lots of smart folks are dilligently working on that have been discussed for years.
My apologies, I thought this was yet another insouciant probe along the lines of "Oh, is Perl object-orented?" or "Gosh, do people use OpenBSD?". Sorry to prompt that wounded tone from you there.
Oh, and for reference, your (indirect) response requires "neckbeard" or a veiled reference to the autism spectrum to be canon. Just as mine requires a "My fault for feeding the trolls"
-
Re:Is the GIL removed from the interpreter
Yes, it would be great if an update to this were covered in the article, like if they put notes on changes to the GIL right here or something.