Domain: effbot.org
Stories and comments across the archive that link to effbot.org.
Comments · 9
-
Re:Python has pointers the way Java does
Actually, Python doesn't pass objects as references. It's call by object. It might take a few read-throughs to grok it but it's well worth it.
-
Re:gag me with a shift buttonActually, having something like `len(x)` instead of `x.len()` has some benefits. Check out Guido's rationale for why it was done that way in python:
There are two bits of “Python rationale” that I’d like to explain first.
First of all, I chose len(x) over x.len() for HCI reasons (def __len__() came much later). There are two intertwined reasons actually, both HCI:
(a) For some operations, prefix notation just reads better than postfix — prefix (and infix!) operations have a long tradition in mathematics which likes notations where the visuals help the mathematician thinking about a problem. Compare the easy with which we rewrite a formula like x*(a+b) into x*a + x*b to the clumsiness of doing the same thing using a raw OO notation.
(b) When I read code that says len(x) I know that it is asking for the length of something. This tells me two things: the result is an integer, and the argument is some kind of container. To the contrary, when I read x.len(), I have to already know that x is some kind of container implementing an interface or inheriting from a class that has a standard len(). Witness the confusion we occasionally have when a class that is not implementing a mapping has a get() or keys() method, or something that isn’t a file has a write() method.
Saying the same thing in another way, I see ‘len‘ as a built-in operation. I’d hate to lose that. // -
Re:Readability
Same AC here --
Thank you for the Python code in question.
In the last line, did you mean to write interleaved.write(item)? If not, what exactly is data?
I completely and fully agree what you've written is significantly easier to understand in comparison, although I've never heard of the itertools module (possibly the author of the previous code hadn't either). Not loading the entire contents into memory (for working with large files) = huge plus, barring the I/O trade-off. Sounds akin to when I see folks new to Perl doing things like $foo = <FH>, or worse, @foo = <FH> (obligatory Dilbert for that one.
The with statement in Python looks, well... bizarre. I had to read this to understand it. My own opinion is that it looks lazy -- I guess to me this stems from the strong belief (based in my experience with assembly and C) that when it comes to resources you clean up after yourself; if you open a file, close the fd when done; if you malloc(), free() when you're done. Yes, I admit with can/will do this for you, but if you ask me all it's doing is forcing the programmer to write __enter__ and __exit__ methods, which to me are completely 100% akin to constructors and destructors. I'm really against object-oriented anything, so you'll have to excuse my annoyance I guess.
:-)Here's a question: how exactly did you know that with would actually close the fds associated with even/odd/interleaved? I don't see that implied anywhere.
-
Re:Sparkleshare
Linux was just a Unix clone. I can't think of any area where it stood out as driving innovation.
It started out as a UNIX clone, but has lots of innovation going on under the hood. Subscribe to Linux Weekly News and read the kernel updates every week, and you will get a better feel for the innovation going on.
Note that IBM is pushing Linux. IBM used to push their own UNIX, AIX; but now they have taken all the best features from AIX and ported them to Linux. Can you think of any reason why IBM might have done that?
Linux has been a disruptive technology, and if it were such a blah "me-too" technology as you seem to think, I don't know why it would have been so disruptive.
PostgreSQL: Just a relational database, and usually behind the heavy-hitters in terms of features. Mainly notable for at least being competitive with the big, commercial databases.
Oracle: Just a relational database, and I hear it can be a real pain to work with it. Mainly notable for being well-supported and crazy expensive. See, this sort of negative comment even works on the industry leader.
Let's face it, SQL was invented in the 70's and every SQL database system is "just a relational database" with some combination of features and price.
And let's face it, mostly people just need a relational database that they can trust with their data. There are a few companies that have very specific needs that only Oracle can handle, but most would be just fine with PostgreSQL.
For innovation, how about NoSQL? For some purposes, these work better than SQL; for others, not; but you have to admit these are not "just another relational database".
In the area of desktop environments, GNOME 3 is doing something really different. Lots of people hate it, understand, but it's definitely a new environment. And I think Enlightenment was pushing the envelope a lot in the early days.
The GNOME 3 example shows that sometimes innovation is met with resistance. Some innovations are not popular and languish in obscurity (deserved or not). I think there are a lot of innovative open source projects you have never heard about. (I have a Python project I thought was pretty innovative, but the problem it solves doesn't seem to be a problem people have, because nobody seems to care. On the other hand, ElementTree is very popular and I would call it innovative; if you disagree, what exactly do you think ElementTree is a clone of?)
steveha
-
OMG!!! Ponies!!!
Just for you: http://effbot.org/zone/ponies.htm
-
Re:The VM is decent. The language sucks.
The various "scripting" languages have been moving towards VM architectures, and some are quite good, but none that I know of actually feature any kind of ahead-of-time compilation, even to bytecode. That includes Perl, Python, Ruby, JavaScript, and plenty of others.
Just a minor correction, Python can be pre-compiled to bytecode:
http://effbot.org/zone/python-compile.htm
But I definitely agree with you on the whole.
-
effbot.org
Very good articles on Python:
http://effbot.org/ -
Re:Why Yahoo
Python can be 'compiled' to bytecode files (using the py_compile module), there are also ways to pack python and your application into single Windows
.exe files's. Details -
Compare Perl to Python, not PHP
Of course it's easy to compare Perl to a lame language like PHP, but how is Perl any better than real languages like Python, Ruby or Lisp, which make it much easier to learn, maintain, read and reuse code written by other people?
It's easy to do all that you require in Python by integrating existing modules: imaplib IMAP4 protocol client module, Integrating Python and MS Excel, pyExcelerator library for generating and importing Excel files, Python Midi Package for handling MIDI input and output.
-Don