Slashdot Mirror


Interviews: Guido van Rossum Answers Your Questions

Last week you had a chance to ask Guido van Rossum, Python's BDFL (Benevolent Dictator For Life), about all things Python and his move to Dropbox. Guido wasted no time answering your questions and you'll find his responses below. From Google to Dropbox
by nurhussein

Hi, What prompted the move from Google to Dropbox? What did you do at Google, and what are you going to do at Dropbox?

Guido: After seven years at Google I was just ready for some change in environment, and then the Dropbox offer came along. At a high level, my job hasn't changed much: I still

- spend 50% of my time on whatever I want to do for Python in my BDFL role
- am a regular engineer in the organization (not a manager or even TL)
- do a lot of code reviews, architecture and design work
- handle a lot of email
- do a lot of actual coding for my job, in Python

The specifics differ of course. I really did only two things at Google: the first two years I worked on one of the first online code review tools Mondrian, which itself was never open-sourced but begat Rietveld, which did, and is used amongst others, by the Python, Go and Chromium communities. After that I joined Google App Engine where I did a lot of different things, almost all of them in Python. My last big project there was a new Python database API, NDB.

I've been at Dropbox for 7 months and my main project has been the design of the Dropbox Datastore API . It's ironic but not my fault that this also uses the "datastore" moniker -- there's little overlap between Dropbox Datastores and the Google App Engine Datastore.

What's even more ironic is that even though I did much of the design, and wrote two prototypes in Python, the SDKs we released last month only support Java, Objective-C and JavaScript. But I am working on a fix, this interview is just slowing me down. :-)



Why did Python avoid some common "OO" idioms?
by i_ate_god

Interfaces, abstract classes, private members, etc... Why did python avoid all this?

Guido: I can think of two reasons: (a) you don't really need them, and (b) they are hard to do if you have no compile-time type checking. Python started out as a skunkworks project (not endorsed or encouraged by management but not actively prevented), and I wanted results quickly. This led me to remove features that weren't actually needed or urgent; it also led me to do all type checking at run time, which gave me natural constraints on what features Python could support. I also had no religious OO ax to grind -- I just wanted an easy language, and it became OO more or less by accident.

In modern Python there are rough equivalents for all of these, but they don't necessarily work all that well, or they cause a lot of execution overhead, so they are often avoided, but they have their uses and their fans.



functional programming
by ebno-10db

Some people claim that Python is, at least partly, a functional language. You disagree, as do I. Simply having a few map and filter type functions does not make for a functional language. As I understand it those functions were added to the libraries by a homesick Lisper, and that several times you've been tempted to eliminate them. In general it seems you're not a fan of functional programming, at least for Python.

Question: do you feel that the functional programming approach is not very useful in general, or simply that it's not appropriate for Python? It would be nice to hear your reasons either way.


Guido: I'm not a fan of religiously taking some idea to the extreme, and I try to be pragmatic in my design choices (but not *too* pragmatic, see the start of this sentence :-). I value readability and usefulness for real code. There are some places where map() and filter() make sense, and for other places Python has list comprehensions. I ended up hating reduce() because it was almost exclusively used (a) to implement sum(), or (b) to write unreadable code. So we added builtin sum() at the same time we demoted reduce() from a builtin to something in functools (which is a dumping ground for stuff I don't really care about :-).

If I think of functional programming, I mostly think of languages that have incredibly powerful compilers, like Haskell. For such a compiler, the functional paradigm is useful because it opens up a vast array of possible transformations, including parallelization. But Python's compiler has no idea what your code means, and that's useful too. So, mostly I don't think it makes much sense to try to add "functional" primitives to Python, because the reason those primitives work well in functional languages don't apply to Python, and they make the code pretty unreadable for people who aren't used to functional languages (which means most programmers).

I also don't think that the current crop of functional languages is ready for mainstream. Admittedly I don't know much about the field besides Haskell, but any language *less* popular than Haskell surely has very little practical value, and I haven't heard of functional languages *more* popular than Haskell. As for Haskell, I think it's a great proving ground for all sorts of ideas about compiler technology, but I think its "purity" will always remain in the way of adoption. Having to come to grips with Monads just isn't worth it for most people.

(A similar comment applies to Scala. It may be the best you can do trying to combine functional and OO paradigms in one language, but the result isn't all that easy to use unless you're really smart.)



Multi-line lambdas
by NeverWorker1

One of the most common complaints about Python is the limitations of its lambdas, namely being one line only without the ability to do assignments. Obviously, Python's whitespace treatment is a major part of that (and, IIRC, I've read comments from you to that effect). I've spent quite a bit of time thinking about possible syntax for a multi-line lambda, and the best I've come up with is trying to shoehorn some unused (or little used) symbol into a C-style curly brace, but that's messy at best. Is there a better way, and do you see this functionality ever being added?

Guido: Really? I almost never hear that complaint except from people who submit questions to Slashdot interviews. :-)

There is indeed a better way, and that is using the 'def' keyword to define a regular function in a local scope. The defined function object becomes a local variable that has exactly the same semantics as a lambda except that it is bound to a local variable, and it doesn't have any of the syntactic constraints. For example, there is *no* semantic difference between

def make_adder(n):
__def adder(x):
____return x + n
__return adder

and this equivalent using lambda:

def make_adder(n):
__return lambda x: x + n

(except that when you introspect the lambda asking for its name, it will say '' instead of 'adder').

Andrew Koenig once pointed out to me that there's one pattern where lambdas are really much more convenient, and that is if you have a long list or dict (perhaps some kind of switching definition) containing lots of lambdas, since if you wanted to do that without lambda you'd end up first having to define lots of little functions, giving them all names, and then referencing them all by name from inside the list or dict. But in that pattern the lambdas are usually simple enough to be lambdas, and if you have a few exceptions, using 'def' before starting the list or dict is a fine compromise.



PyPy
by Btrot69

Do you see PyPy as the future? Or do you remain unconvinced, and -- if so -- why ?

Guido: I'm still unconvinced, for two reasons: (a) they don't support Python 3 (well) yet, and (b) there are lots of extension modules (both third party and in the standard library) that they don't support well. But I hope they'll fix those issues. I think it's competition from projects like PyPy, Jython and IronPython that keeps the CPython project honest and on its toes.



Python in the browser ?
by Btrot69

Over the years, there have been several attempts to create a sandboxed version of python that will safely run in a web browser.Mostly this was because of problems with Javascript. Now that Javascript works -- and we have nice things like CoffeeScript -- is it time to give up on python in the browser ?

Guido: I gave up on it in 1995, so yes. And please don't try to compile Python to JavaScript. The semantics are so different that you end up writing most of a Python runtime in JavaScript, which slows things down too much. (CoffeScript's strength is that it is designed to map cleanly to JavaScript, and the two are now co-evolving to make the mapping even cleaner.)



Python 3
by MetalliQaZ

How do you feel about the current state of the migration to Python 3 (Py3k)? From a user perspective it seems that the conversion of popular libraries has lagged far behind, which has impeded the transition. In my professional capacity, nearly every single system I use lacks an installed 3.x interpreter. In fact, 2.7 is a rarity. I'd like to get your thoughts.

Guido: Curious where you work. I agree that Python 3 migration will still take a long time, but if your systems don't come with Python 2.7 they must be pretty ancient! When I left Google they were about done with the internal transition to Python 2.7 (having successfully migrated from 2.4 to 2.6 over the past few years) and here at Dropbox both the client and the server are using Python 2.7. Both companies are already thinking about Python 3 too.

Back to Python 3 migration, I am actually pretty optimistic. Lots of popular libraries have a working port or are working on one. (The Python Software Foundation also occasionally funds projects to port libraries that are widely used but don't have enough of a community to do a port.) It will take a long time, but I see a lot of progress, and in a few years I expect most new code will be written in Python 3. Totally eradicating Python 2 usage will probably take much longer, but then again, Windows XP isn't quite dead yet either. :-)



Key question for any language designer
by dkleinsc

Have the prospects of Python in any way improved since you grew a beard? To what degree does language success correlate to beard length?

Guido: It is absolutely essential. Just look at Perl's fate -- Larry Wall is just too clean-shaven. :-)

169 comments

  1. Re:BAHAHA!!! by h4rr4r · · Score: 1, Troll

    Or maybe someone should consider such silliness when they make a new language.

  2. Re:BAHAHA!!! by Billly+Gates · · Score: 1

    Well, leaving aside the fact that neither of them will compile because of lack of whitespace. Editors, you might want to think about when use of the <pre> tag is appropriate.

    I still wish the parrot project took off and combined with Perl. Just imagine the poor joy using Lambda's combined with Perl and white spaces? Sounds like a pure paradise.

  3. Broaden your functional horizons, Guido! by EricTheGreen · · Score: 3, Interesting

    but any language *less* popular than Haskell surely has very little practical value, and I haven't heard of functional languages *more* popular than Haskell.

    There is this language called Lisp. Might have heard of it before.

    Erlang, also.

    I understand the kiddies are feeling the Clojure love these days as well (although I suppose that just ends up categorized as a Lisp subset)

    C'mon Guido, you're smarter than this...

    1. Re:Broaden your functional horizons, Guido! by DuckDodgers · · Score: 4, Insightful

      If Lisp was going to take over the world, or even just be used in as much as 10% of the software created in any given year, it would have done it already. That, I think, is the entire reason why Clojure ( and before Clojure, Scheme and Racket, https://en.wikipedia.org/wiki/Racket_(programming_language), and since Clojure, Hy http://docs.hylang.org/en/latest/ ) have been created - attempts to tweak the Lisp formula into something more palatable for the mainstream without losing any of the core features that make the language useful.

      I wish Lisp and Clojure were more prevalent. Most of my work experience is with Java, and now that I've become comfortable with Lisp and Clojure in my spare time I'm chafing at the tools I have to use for work. There just aren't that many jobs around, at least outside Silicon Valley, that use either language. So I'm trying to do useful Clojure stuff in my spare time in order to have a portfolio I can show off for a Clojure shop.

      But to your point, I think Guido is safe to dismiss Lisp - it's a spectacular functional language, it's one of the most well known functional languages, and at least in original and Common Lisp form it just can't get traction in the mainstream.

    2. Re:Broaden your functional horizons, Guido! by phantomfive · · Score: 2

      FWIW Lisp isn't a functional programming language; it has functional parts, but it's a multi-paradigmatic language that includes object oriented programming. So yeah, it can be used like that, but modern Lisp is much, much more.

      Incidentally, currently my favorite part of Lisp that I wish was in other languages is the way the variable binding allows for easy dependency injection, even in places where it wasn't originally designed that way. It makes unit testing a lot easier.

      --
      "First they came for the slanderers and i said nothing."
    3. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 1

      Guido, you're smarter than this...

      No, he isn't.
      If he was, Python would not rely on whitespace for scoping.

    4. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      eh, the functional guys scream and yell when you call lisp or erlang functional. I mean, they have side effects! No, you have to program in lambda calculus or some other gimped language that's not actually capable of doing anything useful.

    5. Re:Broaden your functional horizons, Guido! by HiThere · · Score: 1

      Lisp doesn't work well without a good IDE...and I don't count EMACS.

      Racket would be ok. It has a decent IDE. But it doesn't do multi-processing, even though it has the appropriate language features.

      I don't know Clojure well enough. The last time I tried it (over a year ago) the install instructions produced an only-partially-working result. This is probably NetBeans fault rather than Clojure, but I didn't follow this up. I never got as far as checking how it did on parallel processing.

      Most Scheme's and most Lisps don't handle Unicode gracefully.

      I've considered Lisp several times, and always found some reason, not always the same, why it was not satisfactory. Most of them weren't inherent in the language, but in the state of the libraries or of the development environment.

      P.S.: For Python, Ruby, Vala, etc. I don't feel the need of an IDE. For Java one is highly desireable. For Lisp it's essential. This largely has to do with the state of the libraries and the documentation....but it also has to do with the size of the active namespace (and how familiar I am with it).

      P.P.S.: If you're going to depend on a set of public libraries instead of an included set, they you had better verify them for quality. This is why Python's "batteries included" stance is so good. You can depend on the basic libraries. Ruby tries to handle this with Ruby gems. The quality isn't as good as Python, but it's pretty good, and it has wide coverage. Lisp....The public Lisp libraries often don't work as advertised. It appears as if anyone can add anything to the library collection without any quality control. D also has that problem. It's one of my favorite languages, but it's collection of libraries is abyssmal. Often they will only work with an old or new version, but the requirements aren't usually listed. Frequently they have dependencies that aren't listed.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    6. Re:Broaden your functional horizons, Guido! by ebno-10db · · Score: 2

      Even though I have mixed feelings about the Lisp family of languages, I wish they would become more popular. I've never been convinced that it's the One True Approach, but for some things they're great.

      Unfortunately, much of the Lisp(s) community is the biggest enemy of the broader adoption of Lisp(s). Part of the problem is that one has to refer to Lisp(s) in the plural. Common Lisp is clearly the most powerful variant, but it's byzantine in its (unnecessary) complexity and redundant features, as well as still using a standard from 1985 (the later ANSI standard didn't change much). I understand that CL started as an attempt to unify various Lisp dialects, which explains its byzantine and redundant features. But that was 27 years ago! They could have moved towards deprecating parts of it. Allow it to compiled with a switch that says "accept deprecated", "warn on deprecated" or "forbid deprecated". The libraries also need some serious updating. 27 years ago people didn't expect networking and graphics in standard libraries, but times change. The usual rebuttal that there are many such libraries is part of the problem. Lisp is the ultimate in herding cats.

      Scheme turns that around. It started as a "toy" language for teaching, but 30+ years still doesn't have standard features needed in a powerful language (e.g. a module system). R6RS tried to fix that, but was largely rejected by the implementers. R7RS is supposed to fix that, but we'll see. Meanwhile Racket (and other implementations) go off and do their own thing (albeit Racket has pragmas to enforce R5RS or R6RS compatibility).

      Now along comes Clojure. I haven't even looked at it because my reaction is that the last thing the world needs is YALV (Yet Another Lisp Variant). Undoubtedly Clojure fans will tell me what's newer and betterer about it, but it's still YALV.

      Lastly there's the attitude of a small but vocal minority of Lispers who believe Lisp(s) are the One True Approach, are condescending towards anyone who doesn't accept that as an article of faith, and argue that every drawback of Lisp(s) is actually an advantage that lesser programmers don't appreciate. If their goal is to keep Lisp(s) a niche language used only by the self-proclaimed cognoscenti, they're doing a damn good job of it.

    7. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      It sounds like you're equating "traction in the mainstream" or "used in as much as 10% of the software created in any given year" with Guido's "very little practical value."

      I think that's nutty. Practical value and mainstream acceptance don't correlate much. There are impractical things in the mainstream, and practical things outside of it.

    8. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      Umm...and JavaScript.

      It has first-class functions and closures, so it meets at least the minimum definition of functional. Though I might buy an argument that it's more of an abomination than a language. Still, there's no denying that it's more popular than Haskell.

      Also, Scala is more popular than Haskell too.

    9. Re:Broaden your functional horizons, Guido! by DuckDodgers · · Score: 2

      Then you and I are using different criteria to measure practicality - though I suspect my criteria line up more closely with Guido's criteria than yours.

      No matter how effective a tool is, if it's not in mainstream use that's a significant mark against its practicality. Four decent Lisp developers might be able to build a particular piece of business software faster and with fewer errors than fifteen decent Python developers - but if I can't find four decent Lisp developers in the local market, I'm still going to pick Python when I start the project.

    10. Re:Broaden your functional horizons, Guido! by DuckDodgers · · Score: 1

      Maybe I was lucky, the first time I tried Clojure was within the past year and the installation worked flawlessly. My biggest problem with the language is that some error messages from simple mistakes (mis-aligned parenthesis, etc..) are obtuse - I consider that an obstacle to adoption of the language. I've acquired the patience to work past errors like that, even though they drive me bonkers for the first few weeks I'm learning a new language. But that kind of thing can and will make the difference between widespread adoption and fading to obscurity in the long term.

      Once you do get comfortable with Clojure, the documentation search features right in the REPL are wonderful, so if you don't remember how to do a certain thing you can often find it quickly.

      With regard to libraries, Clojure of course benefits from the fact that Java's standard library is rock solid. It's full of warts and odd inconsistencies, but it's reliable.

      It's interesting that you mention D. It's one of the languages I spent some time learning when I began my "anything but Java" search, and I think the language itself is brilliant - definitely a huge evolutionary step forward from C++, in my humble opinion ahead of Google's Go language. But I hadn't realized the standard library was so weak, my exploration hadn't reached that far. That's a damn shame. Andrei Alexandrescu's "The D Programming Language" book is probably the best programming language book I've ever read.

    11. Re:Broaden your functional horizons, Guido! by DuckDodgers · · Score: 1

      I'm a Clojure fan, sorry. :) Clojure offers many things, but I think the three most important features it adds to the standard Lisp strengths are:
      1. Variables are immutable by default, though there are mechanisms for traditional mutable variables you have one extra step to use them. That makes it easier to reason about your code, without forcing every variable to be immutable like Haskell.
      2. It's interoperable with Java, so aside from the relatively small Clojure standard library your extended "standard library" is the Java standard library. Plus of course you can use any of the tens of thousands of other existing Java libraries. That of course also provides Clojure with a single solution to the standard libraries question - under the hood you use java.net for networking, java.io and java.nio for IO, etc...
      3. It's interoperable with Java, so the learning curve for developers and the adoption curve for tens of thousands of existing companies is much more straightforward than bringing in another Lisp dialect that's only compatible with C++, C#, Perl, Ruby, Java, etc... by using foreign function interfaces.

      I think your point about multiple conflicting implementations and disputes between them is insightful. I do think that's the reason Clojure may have a better chance at mainstream adoption than any other Lisp dialect of the past 20 years.

    12. Re:Broaden your functional horizons, Guido! by ebno-10db · · Score: 1

      I agree points 2 and 3 are important. As for point 1, I didn't say that Clojure was a bad language (I don't even know it), just that it was YALV. Even if it's superior to other Lisp(s), it's still another step in the balkanization that has helped keep Lisp(s) in a niche.

      Having many standards is the same as having no standard, and often even a mediocre standard is better than no standard at all.

    13. Re:Broaden your functional horizons, Guido! by angel'o'sphere · · Score: 1

      Lips is a multi paradigm language, you hardly can call it functional. (Hint: is Lisp more popular than Haskel anyway?)
      Erlang certainly is far less used than Haskel, so his point is very valid.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    14. Re:Broaden your functional horizons, Guido! by DuckDodgers · · Score: 2

      Right. But nobody in the Lisp community has the authority to fix the situation - and as you noted, the community is full of people who are opposed to any such fix, so the chances of someone entering the community to fix it is small.

      So the best possible solution, weak though it may be, is to create something new that just borrows strengths from Lisp but is intentionally different. Clojure is that kind of attempt at a fresh start, and it breaks some Lisp syntax (using square brackets in some cases) and intentionally does not have compatibility with the Common Lisp standard. Maybe that's more balkanization, but maybe these intentionally more different offshoots have a chance to succeed when the dialects that are closer to each other have failed.

      If you read articles on Lisp dialects on Github, the sad news is that Emacs Lisp configuration files are the most popular Lisp variant. That's great for fans of Emacs, not so great for people who want to see Lisp widely adopted. Outside of those files, the two most popular Lisp dialects are Clojure and Racket - which I believe are the two versions of Lisp that are furthest from the Lisp core family.

      Armed Bear Common Lisp is a full Lisp implementation on the JVM. To my knowledge its popularity is miniscule. Clojure is newer, not a standard Lisp, and it's used hundreds of times as often.

    15. Re:Broaden your functional horizons, Guido! by Anonymous+Brave+Guy · · Score: 4, Insightful

      If you're going to depend on a set of public libraries instead of an included set, they you had better verify them for quality. This is why Python's "batteries included" stance is so good. You can depend on the basic libraries.

      Ironically, that's actually one of my biggest concerns about using Python. IME, the included batteries aren't very good, once you get past the first few parts of the library reference that everyone uses all the time. A lot of the later parts -- things like file and directory manipulation, data formats and compression tools, process control, networking, even some of the date/time functionality -- have elements that are horribly slow, platform-dependent, or simply too bug-ridden to trust in production.

      It's unfortunate that package management in Python is such a mess, mostly for historical reasons. There's quite a bit of good stuff on PyPI these days, and if we were starting over, I think we'd do better to limit the standard library to a much smaller set of essential foundations, and to promote the best libraries from outside sources via the standardised package repository and tools.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    16. Re:Broaden your functional horizons, Guido! by BasilBrush · · Score: 1

      Actually, if other language designers were smarter, other languages would use indenting for blocks.* Eliminating redundancy is a general aim in computing. Languages that use curly brackets or other delimiters for blocks are unreadable unless they also use indenting. And once you have the redundancy of both delimiters AND whitespace you have the danger that the two may not be in agreement. Which is compounded by the one that the compiler relies on (delimiters) not being the same as the one that stands out most to the human (indenting.)

      Using indents for blocks has a drawback in that standard text editors aren't good at matching the indent level when cutting and pasting. But that simply means that only Python aware editors should be used for python code. Not difficult when most programmers use IDEs.

      * (Which is what you actually mean. Scope relies on more than whitespace.)

    17. Re:Broaden your functional horizons, Guido! by Half-pint+HAL · · Score: 1

      It sounds like you're equating "traction in the mainstream" or "used in as much as 10% of the software created in any given year" with Guido's "very little practical value."

      I think that's nutty. Practical value and mainstream acceptance don't correlate much. There are impractical things in the mainstream, and practical things outside of it.

      No, he's just using a different sense on the word "practical" from the one you're thinking of. You're thinking "practicality", as in "facilty, ease-of-use, utility and efficiency." Guido, on the other hand means "in practice, in the status quo". It's of little value in the real world if the work isn't there.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    18. Re:Broaden your functional horizons, Guido! by Half-pint+HAL · · Score: 2

      Actually, if other language designers were smarter, other languages would use indenting for blocks.* Eliminating redundancy is a general aim in computing. Languages that use curly brackets or other delimiters for blocks are unreadable unless they also use indenting. And once you have the redundancy of both delimiters AND whitespace you have the danger that the two may not be in agreement. Which is compounded by the one that the compiler relies on (delimiters) not being the same as the one that stands out most to the human (indenting.)

      Using indents for blocks has a drawback in that standard text editors aren't good at matching the indent level when cutting and pasting. But that simply means that only Python aware editors should be used for python code. Not difficult when most programmers use IDEs.

      * (Which is what you actually mean. Scope relies on more than whitespace.)

      You have almost achieved enlightment, grasshopper, but you have yet to catch that fly with your chopsticks...

      Q: Why is (for example) C reliant on human intervention for both curly-bracing and indentation? A: Because coders have a fetish for "human-readable" source code that can be used in a "dumb" text editor.

      Now, you state that the solution to the Python copy-and-paste problem is a "Python-aware" editor... so why shouldn't the solution to the braces/indentation redundancy in C, Java etc. be a C-/Java-aware editor? The user inserts the curly braces, and the editor automatically manages spaces. I'm working in Python just now, and for all the things I love about it, the indentation still messes me up

      The most common bugs in my code are when I end multiple blocks simultaneously (I tend to deindent either too far or not far enough) and forgetting to change IF to ELIF when I add a higher precedence case as the first IF condition above it. I never make this latter mistake in C or Javascript, and the reason is a quite simple question of task design and psychology. In Python, when I'm finished writing the body of the branch, I feel "finished", but the curly-brace notation of C etc makes "finishing" an active process, so I don't just stop dead...

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    19. Re:Broaden your functional horizons, Guido! by Half-pint+HAL · · Score: 1

      eh, the functional guys scream and yell when you call lisp or erlang functional. I mean, they have side effects! No, you have to program in lambda calculus or some other gimped language that's not actually capable of doing anything useful.

      I think you mean "not actually capable of doing everything useful." Functional programming is a wonderful paradigm for handling a whole lot of serious numerical data. It is clean to the point of being almost bomb-proof. Yes, real user-space applications has interaction as its main goal, so FP's term "side-effect" seems almost insulting.

      So no, you can't write a whole software package functionally, but if FP was integrated properly into multi-paradigm programming, it would simplify debugging no end. What do I mean by properly? FP should be a restricted subsystem. No side-effects: no prints, no inputs, no state changes or variable asserts. This has to be an unbreakable rule (with the possible exception of debug info). Procedures can call functions, and functions can call other functions, but functions can't call procedures. This has to be an unbreakable rule, and I don't beleive most multi-paradigm languages enforce it. Why does it have to be unbreakable? Because the whole point is to reduce debugging effort. With true FP, bug tracking is (relatively) easy: if the function gives the wrong answer, there's a bug in it; if it gives the right answer, there's no bug. But as soon as you allow state changes and other side effects, it's a procedure, not a function, and a side-effect bug might only show itself further down the line (eg you accidentally leave an A in the print buffer and the next message gets an erroneous A at the start) and you're left on a looooong hunt.

      Have you read the Kotaku article on the "beauty" of the Doom 3 source code? One of the things the author liked so much about it was the way that iD established conventions for procedure parameters that made it clear which variables were inputs and which were outputs, and used const to prevent inadvertant changes. Good practice, given the limitations of the language, but limitations they are, and in the end it all looks like "jumping through hoops" to me. FP doesn't let you use arguments as outputs: arguments are inputs, anf your outputs are the returned result. Doom 3 is a prime example of where functional-programming-within-procedural-programming would be supremely useful: a 3D engine is pure geometry, maths, functions. For every single user input there are millions of determinstic calculations made. Whole swathes of code operate in the background before a single dot is placed on screen. A lot of that's time when no state-change actions are required, or even wanted... such changes are genuine "side-effects": i.e. bugs.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    20. Re:Broaden your functional horizons, Guido! by mattack2 · · Score: 1

      The "redundancy" is because we want human-readable source code, as you state.

      But it's not really redundant, because it (should) just be ADDITIONAL information.

      BTW, I like and use Python, but would pay money for a way I could turn off intent == scope *in a way that would work in every Python interpreter I'm likely to find*. (i.e. not a hack I have to add on and build my own interpreter)

      Copy-paste is one example that often wrecks code. Also, simply wanting to turn off a conditional check to debug something perhaps. Sometimes that involves manually reformatting a hunk of code, instead of simply commenting out the if line, as one could do in C.

    21. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      Lastly there's the attitude of a small but vocal minority of Lispers who believe Lisp(s) are the One True Approach, are condescending towards anyone who doesn't accept that as an article of faith, and argue that every drawback of Lisp(s) is actually an advantage that lesser programmers don't appreciate. If their goal is to keep Lisp(s) a niche language used only by the self-proclaimed cognoscenti, they're doing a damn good job of it.

      Citation needed. The closest I've seen is Lispers trying to convince C++ programmers (for example) that what appears to be a drawback of Lisp is actually not such a big deal (sometimes known as "Old Shoe or Glass Bottle"). Almost all of these that I've seen have since been proven in other languages. For example, C++ programmers would traditionally complain that they don't have enough control over memory allocation, or that anonymous functions are too hard for common use. Today there are millions of people writing Javascript and Ruby and other languages without any apparent trouble. I've heard lots of complaints about Ruby and Javascript, but lack of C++'s memory model or presence of anonymous functions have never been among them.

      I guess your perspective determines how you see history. I would say that Lisp's numerous innovations, thanks to their vocal support, are now commonly found in most of today's mainstream languages. I can think of one or maybe two features of Lisp that have not been used in at least a half dozen newer programming languages.

      Lisp is kind of like the Mac of programming languages. Everybody thinks the advocates are kind of dicks, and it never had anywhere close to a majority market share, but its technical influence is far out of proportion with the number of people actually using it on any one day. The average person isn't using a machine with "Mac" printed on the label, but they are using pull-down menus and push-buttons and scroll-bars and other technologies which were developed into their current form by Apple. The average programmer isn't using a programming language with "Lisp" in the name, but they are often using garbage collection and if-statements (yes, really!) and lambdas and bignums and recursion.

      Do you think that it is more important that people get to use these concepts, or that people only use these concepts if they are called "Lisp"? It's just a name. (I'm a Lisp programmer, and even I think it's a pretty dumb name.) I say, it's better that people get to use ideas like garbage collection, even if not in Lisp.

    22. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      I gather you never used Lisp before? Scheme is functional, most Lisps including Common Lisp (that is usually called Lisp) are not.
      Lisp is a multiparadigmatic language that I've seen used mostly as imperative with some functional and object incursions.

    23. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      Lisp is unimportant except in niche uses and fields. 90% of the world has no need of it.

    24. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      Pip and virtualenv seem to work really well for... pretty much everyone.

    25. Re:Broaden your functional horizons, Guido! by mrvan · · Score: 1

      +1, I'm a big python fan, but I think the whitespace is a mistake, for a number of reasons:

      1) a snippet of whitespace-blocked code has an absolute indentation level; while a piece of curly bracket style code has relative levels. This makes copy paste and refactoring clumsy. A 'python aware editor' does not really solve this since there is not 'end of block' mark except for the indentation

      2) the python whitespace system is redundant in itself by requiring both a colon and a increase-indent token as a block starter. Why is the colon required if the increase-indent makes it obvious that a block is starting (and all the block statements, ie if for def class etc, require the colon anyway, there is 0 information in the colon)? In fact, since the end of a 'block statement' always starts a new block

      3) why replace a somewhat redundant system that works relatively well and is used by the majority of languages by a new redundant system that is not really tested? I am sure they didn't really anticipate the snippet copy/paste or refactor difficulty - in the motivations they talk about easy to learn for beginners, but I don't think you should sacrifice usefulness of the language for a slightly gentler learning curve. Also, with curly brackets existing editors/ide's would be more or less useful, with basic highlighting, folding, structure-display, etc still working; while this requires completely new modes/editors to be developed

      4) it doesn't really solve a problem, since any ide or (almost) trivial preprocessor can 'correct' the indentation based on curly brackets

      5) it is keeping some people from using the language, which is a shame, because they might contribute to the language or community; and it is distracting the discussion away from a true discussion of the merits/drawbacks of the language, e.g. static vs dynamic typing, but also having classes and functions be true first level citizens without the need for clumsy introspection, yet not choosing the obvious next step of making class and def functions instead of statements.

      (PS I have no problems whatsoever with newlines ending statements. You can still use semicolons to put multiple statements on a line (generally a bad idea even in C) and since open parentheses suppress statement ends it almost never leads to problems. I think a '\n' is a more intuitive statement ender that a ';'. )

    26. Re:Broaden your functional horizons, Guido! by HiThere · · Score: 1

      D's basic language, and standard library, are excellent and solid. But they don't cover enough. This is probably inevitable, but it *IS* a real problem. The obvious way to solve it is to wrap C libraries with D code, and include them. This, however, takes the time and effort of skilled people.

      E.g.: Sqlite3 wrappers are currently included, but they are so thin that calling them wrappers is almost a misnomer. There have been several attempts to wrap Sqlite3 in the past, but they've all been completed, used, and dropped. (Well, the ones that I know of.) It's hard to tell whether a external library has been abandoned, or is just considered "good enough".

      OTOH, if you are comfortable with C, then using C libraries directly from D is not a problem. So I suspect the language maintainers don't understand the scope of the problem. Even I have successfully wrapped a library once or twice, and I'm not highly skilled at any particular language. (OTOH, I'm at far better than basic skill level in a large number of languages. But I haven't concentrated on one. [Professionally, before I retired, I was finally forced to use MS Access Basic, which I came to after over a decade of Fortran and various specialized languages, e.g. DataFlex.])

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    27. Re:Broaden your functional horizons, Guido! by HiThere · · Score: 1

      OK. I've never encountered that problem. Did you inform them of your problem? Ask about it on the list?

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    28. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      A closure is a property of something. Why do you fuckwits confuse anonymous functions with closures?

      Referential transparency is the most important part of a functional language.

      Javascript is as functional as Ruby, as in it kinda supports it but it is not a functional language.

    29. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      How can you claim Erlang is less used than Haskell?

      Besides telecom equipment Erlang is used in many web based projects.

      Haskell is used, well nowhere.

    30. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 1

      I haven't encountered explicit bugs in the standard library, but my impression was that it was well-accepted that lots of the standard library has not been well-maintained. Conventions are not followed. Designs are inconsistent and not particularly synergistic. Things like path manipulation are a monstrosity.

      The biggest fuck-up in Python's history was not to take advantage of the Python 3 compatibility break to dramatically reorganize and clean up the standard library. That opportunity has been missed and we're not likely to have another one.

      My hope is that newbies will be increasingly instructed to use widely-accepted PyPI packages in place of lots of the standard library, to at least minimize the hurt.

    31. Re:Broaden your functional horizons, Guido! by BasilBrush · · Score: 1

      You have almost achieved enlightment, grasshopper

      Yeah. That tactic only really works when you are addressing someone with a higher UID than you.

      "Fetish" is a strange choice of word for humans being more efficient at maintaining easy to read code than hard to read code. And indenting blocks is near the top of the list of most significant aids for readability.

      so why shouldn't the solution to the braces/indentation redundancy in C, Java etc. be a C-/Java-aware editor?

      It might be a help. But the fact it hasn't become a common feature in IDEs raises some question marks. (Note to others, there are plenty of IDEs that indent after a curly brace. But few if any that always keep the braces and indenting of a program in sync as you describe.)

      But fundamentally it's a band aid over the issue of redundancy. Whereas Python removes the redundancy.

      The most common bugs in my code are when I end multiple blocks simultaneously (I tend to deindent either too far or not far enough) and forgetting to change IF to ELIF when I add a higher precedence case as the first IF condition above it.

      Neither of these personal problems you have are unique to Python. And I call them personal problems because I don't have them when programming Python, and it's not a complaint I've heard from others as being a python issue. They are errors that can and are made in curly bracket languages too.

      (Aside: Missing breaks for switches in C are far more common causes of logic errors than forgetting to insert and else when prepending to a compound if statement. Again, If indenting were significant in C that wouldn't happen. The outdenting of the label would end the block. Just as is intuitive for a user.)

    32. Re:Broaden your functional horizons, Guido! by Anonymous+Brave+Guy · · Score: 1

      Assuming you're talking about the standard library rather than package management, unfortunately it's not just one problem. I'd estimate that I've found 20-25 significant library issues over the past few years of using Python on various projects.

      Most of these issues aren't really bugs in the sense that the output is objectively wrong, though. It's more things like OS differences not quite being abstracted away completely so that sometimes running another process needs slightly different presentation of arguments on Linux vs. Windows or some minor detail of a library feature only works on one platform or another, or having a compression library that works but takes 6x as long as spawning a dedicated zip tool to do the same job, or the complexity of setting up a download manually when there are libraries like requests today that show how much simpler it could be.

      None of these things are categorically wrong, but they all make the Python standard library less useful than it could be. Sometimes they make it less useful than a popular alternative, at which point there's little reason to have the standard library version around at all other than backward compatibility (hence my comment about if we were starting over).

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    33. Re:Broaden your functional horizons, Guido! by Anonymous Coward · · Score: 0

      If you can't write your own libraries GTFO

  4. He did answer one question by buchner.johannes · · Score: 2, Funny

    He did answer one question once and for all. The smiley closes the bracket.
    https://xkcd.com/541/ All hail the BDFL

    --
    NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
  5. Summary by zepo1a · · Score: 0

    "Guido wasted not time answering your questions and you'll find his responses below."

    Just like editor wasted not time editing/checking the summary before posting.

    Zep--

    1. Re:Summary by M.+Baranczak · · Score: 1

      "Wasted not" is synonymous with "did not waste". It sounds pretentiously archaic, but it is correct. On the other hand, borking up the whitespace in a Python code sample? That ain't OK at all.

    2. Re:Summary by fahrbot-bot · · Score: 1

      On the other hand, borking up the whitespace in a Python code sample? That ain't OK at all.

      Which is borked with respect to the whitespace, the example or Python? Obviously both and I submit that the latter enables the former which is why it's a horrible language "feature." [ Flame me if you want Python fans, but you know in your hearts I'm right. :-) ] [ And, *that*, Randall (https://xkcd.com/541/) is how you terminate a parenthetical with an emoticon :-) ]

      --
      It must have been something you assimilated. . . .
    3. Re:Summary by M.+Baranczak · · Score: 1

      Both, of course.

      My point was that removing indents is never OK, with any language, since it makes the code unreadable. In this case, it also made the code uncompilable, but that's just a secondary offense.

    4. Re:Summary by ebno-10db · · Score: 2

      borking up the whitespace in a Python code sample? That ain't OK at all.

      It may have to do with a sloppy HTML conversion by Slashdot or something, but it is ironic.

      P.S. I'm actually a fan of the Python/Haskell whitespace approach.

    5. Re:Summary by RoccamOccam · · Score: 1

      Flamebait, but I'll bite.

      The thing that got me interested in Python at the very beginning was its use of whitespace. So no, in my heart, I don't think you are right (I was a big fan of Occam). For me, it is clearly the way a programming language should be designed. I understand that it doesn't suit others; but, interestingly, that feature is one of the key (and overlooked) reasons why Python has become so prevalent.

      There is clearly a (sufficiently) large subset of the programming community that strongly prefer whitespace scoping. And for those people, what are the other mainstream choices? Personally, I don't know of any (although, I'm sure that there are a few). And new language designers are less likely to follow Python's lead because of outspoken critics, like you.

      Because of that, I believe that Python has a more loyal core group of supporters that are less likely to abandon it when the latest hotness comes out.

      With a stronger base than most languages, Python is less likely to experience the dramatic momentum losses of more conventional languages. And it will continue to grow its community, as once-reluctant whitespace converts are picked up and other languages are less attractive to them, from then on.

    6. Re:Summary by Anonymous Coward · · Score: 0

      The lambda's name was also lost because it happens to contain angle brackets. Is this the fault of Python?

      What about Perl, where angle brackets are used for reading from a filehandle? Or just the right combination of arithmetic comparison and heredocs and shell redirection to trip an HTML parser? Is it the fault of all those languages for not designing themselves to be easily pasted into a markup language with no escaping?

    7. Re:Summary by rwa2 · · Score: 1

      This. Though I have to admit, I've often been tempted to insert meaningful whitespace in there.

      Maybe someday when I submit to the temptation to play with https://github.com/mame/quine-relay

    8. Re:Summary by mattack2 · · Score: 1

      There is clearly a (sufficiently) large subset of the programming community that strongly prefer whitespace scoping. And for those people, what are the other mainstream choices? Personally, I don't know of any (although, I'm sure that there are a few). And new language designers are less likely to follow Python's lead because of outspoken critics, like you.

      Default to whitespace == scope, fine. But give a #define or option to turn it off/go back to {} or BEGIN/END or whatever instead...

    9. Re:Summary by RoccamOccam · · Score: 1
      The Zen of Python

      by Tim Peters

      Beautiful is better than ugly.
      Explicit is better than implicit.
      Simple is better than complex.
      Complex is better than complicated.
      Flat is better than nested.
      Sparse is better than dense.
      Readability counts.
      Special cases aren't special enough to break the rules.
      Although practicality beats purity.
      Errors should never pass silently.
      Unless explicitly silenced.
      In the face of ambiguity, refuse the temptation to guess.
      There should be one-- and preferably only one --obvious way to do it.
      Although that way may not be obvious at first unless you're Dutch.
      Now is better than never.
      Although never is often better than *right* now.
      If the implementation is hard to explain, it's a bad idea.
      If the implementation is easy to explain, it may be a good idea.
      Namespaces are one honking great idea -- let's do more of those!

    10. Re:Summary by Anonymous Coward · · Score: 0

      Python is one of the uglier languages

      Making obvious things explicit(ie self) makes the language uglier, more verbose and just plain stupid

      There is not one thing on that list that is descriptive of Python.

    11. Re:Summary by Anonymous Coward · · Score: 0

      No. If you don't like it, use something else.

      Certainly we will not make the same language have two different "syntaxes" in the same interpreter (that makes it two different languages, by definition, in computer science. "The same language have two different languages" - see how ridiculous that sounds?). Also, the #define would be inside the source code - so now you have to switch the parser to another language midway (good luck).

      Just use perl if you like that kind of needless inconsistency. Or make a language called Brython or whatever which differs in that little thing if you care so much about it; just don't call it Python.

      I don't like Python becoming popular so much; it was much better when Python was small; there were no people suggesting mangling the language beyond recognition so it looks JUST like what they are used to.

      Learn something new already.

    12. Re:Summary by mattack2 · · Score: 1

      I did learn something new, I learned Python..and for the most part, I like it.. It's more readable (as in sourcecode, not as in indentation) than Perl.

      It's mostly the indent==scope that's so annoying. There's a couple of other things, like seemingly unnecessary colons in a few places, but those are VERY VERY minor compared to the huge issue that is indentation == scope.

      But I still use Python. Can't you see that liking something, despite greatly disliking one of its huge distinguishing features, is actually a positive for Python?

  6. whitespace by photonic · · Score: 2, Interesting

    I know about all the religious arguments pro or against whitespace as syntax. Personally, I am a happy user of python and I actually like the forced indentation, YMMV. But please slashdot, why do you screw up the indentation when the inventor of a whitespace-as-syntax-language gives a code example? This will be too easy for anyone arguing against the use whitespace of syntax.

    --
    karma police: arrest this man, he talks in maths; he buzzes like a fridge, he's like a detuned radio. [radiohead]
    1. Re:whitespace by Anonymous Coward · · Score: 5, Insightful

      What do you mean, too easy? That's exactly what's wrong with making indentation part of the syntax. It's too easy to break. It's only fitting that code given by the head honcho of Python falls victim to reformatting. It is literally his own fault.

    2. Re:whitespace by Anonymous Coward · · Score: 4, Insightful

      I have found that everyone who complains about The Python Whitespace Thing are people who have convinced themselves that they are special little snowflakes and therefore any attempt to limit their creative output on whitespace use must be some kind of crime against humanity. Any time I get code in a free-whitespace language from someone like that, I need to run it through a code formatter before it's readable.

      You are not special. Your unique ideas about how to indent code are not special, so fucking indent your code according to the standard. The fact that Python mandates proper indentation is a feature, not a bug. The fact that C lets you throw the whole program on one line is a bug, not a feature.

    3. Re:whitespace by countach74 · · Score: 4, Insightful

      I do a fair bit of programming in Python and curly-bracket languages (C, C++, JavaScript, PHP, etc.) and interestingly, a forgotten/misplaced curly bracket in any of those various curly-bracket languages seem to break my code vastly more often than indentation issues do. Your code should *always* be indented. Python whitespace should already be there in all of your code (minus an occasional tweak here and there). Why complain about having to write {} less frequently?

    4. Re:whitespace by You're+All+Wrong · · Score: 1

      Because your code is more fragile to misrendering or mistransmission by Slashdot, and MS Exchange, and yahoogroups, and google groups, and ...

      The answer to your question was in your parent post, did you not see it?

      --
      Your head of state is a corrupt weasel, I hope you're happy.
    5. Re:whitespace by Anonymous Coward · · Score: 0

      You shouldn't be using Exchange for code. Or Slashdot.

      Use a Markdown-supporting site if you must post it, otherwise do it right with Git/Mercurial/SVN and friends.

      This is not a downside. It's cleaner and more readable without the curly-brace spam, not to mention less taxing from a repetitive stress standpoint.

    6. Re:whitespace by Anonymous Coward · · Score: 5, Insightful

      You can run my code through a code formatter if you don't like my choice of coding convention. You can not fix the broken code from the story by running it through a code formatter, because the inadvertent reformatting destroyed its meaning.

    7. Re:whitespace by Anonymous Coward · · Score: 1

      See, Guido is wrong again. Shouldn't have used Slashdot.

    8. Re:whitespace by Anonymous Coward · · Score: 0

      I thought "You're holding^Wposting it wrong" was reserved for aloof CEOs of multibillion corporations, not plain old Python-loving ACs.

    9. Re:whitespace by Anonymous Coward · · Score: 0

      Code breaks when parts of it are blindly deleted. News at 11.

      Do you also bitch about shell, Perl, Ruby, et al. for making frequent use of a left angle bracket followed by a word? Because that'll break if you paste it as literal HTML too, and in a much less obvious way.

    10. Re:whitespace by Anonymous Coward · · Score: 0

      Yeah, if only he'd seen this coming! It was so obvious, what with the popularity of HTML back when Python 1.0 was released, in January 1994, almost two years before the first standard spec of HTML was blessed in November 1995.

      Some people just have no foresight whatsoever.

    11. Re:whitespace by countach74 · · Score: 1

      As others have stated, use a proper means of code sharing. It's pretty terrible reading any language when all indentation white space is stripped from it. This is not a problem unique to Python (or other languages with significant white space). Just because the code in question can pass a syntax check does not mean that it is not easily misrendered or mistransmitted.

    12. Re:whitespace by Anonymous Coward · · Score: 0

      Well, duh, it's Slashdot. They also posted a parody news article about Google's self-driving cars as fact. What exactly did you expect? I'm amazed that the site works at all.

    13. Re:whitespace by rwa2 · · Score: 1

      ... also, they're probably butthurt from their python tweaks not compiling because they don't know how to configure their editor to replace tabs with [248] spaces

    14. Re:whitespace by rwa2 · · Score: 1

      Slashdot is fine, though not ideal, for posting code stuff, since you have some HTML tags available, such as <pre> :

      def make_adder(n):
          def adder(x):
              return x + n
          return adder

      def make_adder(n):
          return lambda x: x + n

      The full list of HTML that's not filtered out is supposedly somewhere on the http://slashdot.org/faq , but I can't find it right now.

    15. Re:whitespace by AuMatar · · Score: 1

      Funny- I've lost weeks of my life tracking down python indentation errors, and I've only used it sporadically. I've used C and C like languages for almost 2 decades and I've lost maybe 2-3 days of my life total on missing }. It almost never happens, and never happens with a good IDE. Whereas spacing issues happen whenever you copy paste from a website.

      Guido made 1 major mistake. It actually wasn't using whitespacing- it was in not forcing a specific amount of whitespace. If the language had enforced that every indent must be exactly 4 spaces, it wouldn't be an issue. The fact that 4 spaces or 3 spaces or a tab all work is what causes it to break horribly- to the point where I will no longer ever work on a Python program again. I'll tell my boss to find someone else to do it.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    16. Re:whitespace by 31eq · · Score: 1

      This is a Python article! Of course somebody has to complain about whitespace! When did you ever know a Python article to not start an argument about whitespace?

    17. Re:whitespace by AuMatar · · Score: 1

      A website is a proper means of code sharing. If your language has issues with it, your language is broken and unusable. There is no excuse for not supporting the most popular method of idea exchange in the last 20 years.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    18. Re:whitespace by Anonymous Coward · · Score: 0

      It should *always* be indented, curtesy of your editor, according to your instructions via curly brackets :p

    19. Re:whitespace by tuffy · · Score: 2

      Or you could've saved weeks of your life by running the pep8 tool on your code, which will tell you all the lines that aren't indented by a multiple of 4, or which lines have tab characters in them, or any number of other formatting problems that aren't recommended by the style guide.

      --

      Ita erat quando hic adveni.

    20. Re:whitespace by Anonymous+Brave+Guy · · Score: 1

      You can run my code through a code formatter if you don't like my choice of coding convention.

      Sure you can, as long as you promise to convert it back again perfectly before you commit, so anyone looking at the diffs later doesn't have to wade through 657 whitespace-related changes to spot the one line where you changes some behaviour.

      Languages with syntactic whitespace are vulnerable to misrepresentation, but in practice 99% of that misrepresentation happens under exactly one condition: the code is being presented on a web page by someone who either doesn't know basic HTML or uses a crappy CMS that doesn't render proper HTML.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    21. Re:whitespace by Anonymous Coward · · Score: 0

      It's an article with a code example by Mr. Python himself, and it's broken because of misrendered whitespace. Snark all you want, but Alanis Morissette ought to be working on a rerecording of her biggest hit right about now.

    22. Re:whitespace by BasilBrush · · Score: 1

      The fault here is the misuse of HTML, not the language with significant whitespace. After all, any other language would also lose it's indentation in such a situation, which is still not an acceptable representation of the code, regardless of whether it will compile. Code put on web pages are normally snippets used for learning from, not compiling from, and therefore loss of readability is the major problem, and affects all languages.

      Note that Slashdot is also horrendously broken in many other formatting respects. It breaks HTML code far more than it does Python (in both cases, unless one takes significant effort and care to deal with the issue.)

    23. Re:whitespace by phantomfive · · Score: 1

      I do a fair bit of programming in Python and curly-bracket languages (C, C++, JavaScript, PHP, etc.) and interestingly, a forgotten/misplaced curly bracket in any of those various curly-bracket languages seem to break my code vastly more often than indentation issues do.

      How often does that really happen? Because it's been a long time since I've had a problem with curly brackets. Or with indentation, for that matter. Is either one worth worrying about? Arguing about the topic is silly.

      There are multiple solutions to the problem of 'block delineation,' and both of these work fine.

      --
      "First they came for the slanderers and i said nothing."
    24. Re:whitespace by BasilBrush · · Score: 1

      Funny- I've lost weeks of my life tracking down python indentation errors, and I've only used it sporadically.

      What's your problem? Are you perhaps trying to use a text editor that doesn't understand python for editing python code?

      Whereas spacing issues happen whenever you copy paste from a website.

      No it doesn't. Look at stack overflow for example. Any code there will copy'n'paste to a text editor with the indents intact. Any properly written website will be the same. And any website that specializes in coding should work properly in this respect. It's scandalous that slashdot still doesn't.

      Note Slashdot breaks HTML code even worse than it does Python. (In both cases unless you make efforts to stop it from doing so.)

    25. Re:whitespace by BasilBrush · · Score: 1

      Guido made 1 major mistake. It actually wasn't using whitespacing- it was in not forcing a specific amount of whitespace. If the language had enforced that every indent must be exactly 4 spaces, it wouldn't be an issue. The fact that 4 spaces or 3 spaces or a tab all work is what causes it to break horribly

      That part I agree with.

    26. Re:whitespace by BasilBrush · · Score: 1

      Indeed. It's a bit like the same as people starting iPhone articles with a complaint about the supposed patenting of rounded corners.

    27. Re:whitespace by Dadoo · · Score: 1

      Yeah, I don't really have a problem with whitespace as syntax, either.

      What I don't get is that there aren't more people complaining about the syntax for functions like range(), where the lower limit is inclusive, but the upper limit is exclusive. Can anyone explain to me how that makes sense?

      --
      Sit, Ubuntu, sit. Good dog.
    28. Re:whitespace by vrt3 · · Score: 1

      What I don't get is that there aren't more people complaining about the syntax for functions like range(), where the lower limit is inclusive, but the upper limit is exclusive. Can anyone explain to me how that makes sense?

      See "Why numbering should start at zero" by Edsger W. Dijkstra: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

      --
      This sig under construction. Please check back later.
    29. Re:whitespace by Volguus+Zildrohar · · Score: 1

      It's at the bottom of every reply window.

      Allowed HTML
      <b> <i> <p> <br> <a> <ol> <ul> <li> <dl> <dt> <dd> <em> <strong> <tt> <blockquote> <div> <ecode> <quote>

      <ecode> looks reasonable:

      def make_adder(n):
          def adder(x):
              return x + n
          return adder
       
      def make_adder(n):
          return lambda x: x + n

      --
      When confronted with one problem, some think "I'll use recursion". Now they are confronted with one problem.
    30. Re:whitespace by Half-pint+HAL · · Score: 1

      Run diff -w

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    31. Re:whitespace by mattack2 · · Score: 1

      Sure you can, as long as you promise to convert it back again perfectly before you commit, so anyone looking at the diffs later doesn't have to wade through 657 whitespace-related changes to spot the one line where you changes some behaviour.

      I agree with you, but...

      diff --ignore-space-change

    32. Re:whitespace by Half-pint+HAL · · Score: 3, Interesting

      I do a fair bit of programming in Python and curly-bracket languages (C, C++, JavaScript, PHP, etc.) and interestingly, a forgotten/misplaced curly bracket in any of those various curly-bracket languages seem to break my code vastly more often than indentation issues do.

      Yes, but there's a rather huge difference: when you forget to close a block in C, your compiler completely flakes out as your {s and }s don't match. Your procedures don't close -- syntax error and fall over. However, if I forget to close a block in Python, this results not in a syntax error, but a logical error that the interpreter is not aware of. The block will be closed, even if only when I define my next class or procedure.

      So you've got to weigh up frequency-of-occurrence against cost-of-incident....

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    33. Re:whitespace by rwa2 · · Score: 1

      Huh, strange, I don't get that anymore. Oh well, I guess I'll bookmark your post ;)

    34. Re:whitespace by chrismcb · · Score: 1

      I have found that everyone who complains about The Python Whitespace Thing are people who have convinced themselves that they are special little snowflakes and therefore any attempt to limit their creative output on whitespace use must be some kind of crime against humanity.

      I'm not special, and I don't use whitespace creatively. I can't STAND it when code isn't indented properly. And yet I still think Python's whitespace is awful, and it is what makes Python a toy language. For one thing, I had having to visually see my whitespace, yet if you don't, you might accidentally mix tabs and spaces and Python gets unhappy.

    35. Re:whitespace by Teckla · · Score: 1

      I do a fair bit of programming in Python and curly-bracket languages (C, C++, JavaScript, PHP, etc.) and interestingly, a forgotten/misplaced curly bracket in any of those various curly-bracket languages seem to break my code vastly more often than indentation issues do.

      Your IDE/editor should have an auto-format feature: use it. If your IDE/editor doesn't have that feature, use better tools. This will result in code formatted correctly for virtually no effort (a key press or two).

    36. Re:whitespace by AuMatar · · Score: 1

      It doesn't matter how nicely the website renders it- if it was written with an indent of 3 spaces and you dump it into code with an indent of 4 or tabs, you're going to have problems.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    37. Re:whitespace by AuMatar · · Score: 2

      If you have to follow a style guide to get compiling code, your language is broken. If you have to know of the existence of a one off tool to get compiling code, your language is broken. The fact that tool even needs to exist is proof of my point.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    38. Re:whitespace by Anonymous Coward · · Score: 0

      And that is exactly why there is pep8. 4 spaces and no tabs or you are *wrong*!

    39. Re:whitespace by Anonymous Coward · · Score: 0

      You don't "end block" in Python, you continue the block of the previous indentation level. This is immediately obvious just by the outline of the code without having to hunt or count braces.

    40. Re:whitespace by terryk29 · · Score: 1

      In other languages, I've become accustomed to temporarily inserting debugging statements or sequences (e.g. printf's) at column 0, so they stand out. Not a big deal, but I've missed being able to do this in Python.

    41. Re:whitespace by tuffy · · Score: 1

      I don't have any trouble getting Python code to run without either, and run into problems due to whitespace approximately 0 times per year. Python the language only requires that code blocks be indented consistently. And since you're the one having problems with that, perhaps your development environment is defective since the files you're feeding the interpreter aren't what you think they are. If that's the case, you'll need all the help you can get.

      --

      Ita erat quando hic adveni.

    42. Re:whitespace by Half-pint+HAL · · Score: 1

      That's precisely the problem. Without any conscious action to end multiple blocks, it's far too easy to get confused...

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    43. Re:whitespace by RoccamOccam · · Score: 1
      It winds up making code like this very clean

      >>> x = 'This is a string'
      >>> p = 4
      >>> a, b = x[:p], x[p:]
      >>> a
      'This'
      >>> b
      ' is a string'

    44. Re:whitespace by AuMatar · · Score: 1

      And if this was enforced by the compiler as a rule of the language, I might find it silly but I'd be ok with it. Trying to enforce it by style guides and hoping that the developers know of the existence of a random tool is idiotic.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    45. Re:whitespace by BasilBrush · · Score: 1

      It doesn't matter how nicely the website renders it- if it was written with an indent of 3 spaces and you dump it into code with an indent of 4 or tabs, you're going to have problems.

      Yes. I did a supplementary post to the effect that I agree with this part. And personally I believe the one true indent should have been tabs, such that everyone can have the indent size they want in their text editor, without having to reformat the source. But any single standard for what an indent is would be better than the "anything goes" we have.

    46. Re:whitespace by drissel · · Score: 1

      How can you forget paren, brace, bracket etc.? You press the shift key with your left pinky if needed. With your right ring and pinky, you play a 'chord' that puts in both the opening and closing symbols. On the way back to the rest position, you hit left arrow to put the cursor where it needs to be. Regards, Bill Drissel Grand Prairie, TX

    47. Re:whitespace by Anonymous Coward · · Score: 0

      >Can anyone explain to me how that (range) makes sense?

      To prevent off-by-one errors.

      I can't stand languages that use stuff like substr(start, endInclusive) or substr(start, length) where you end up having a horrible mess of + 1 - 1 + 1 - 1 - 1 + 1 in your entire program.

      Also, in mathematics the length of a line from (0,0) to (2,0) is 2. Likewise, the length of a substring from 0 to 2 is 2. I don't get why you complain about that.

      A rectangle from (0,0) to (2,2) has area 4 (not 9 or whatever).

      If it's 17:58, it's 2 minutes to 18:00, not 3 or 1.

      If I collect one list item per minute and I want the data from the last two minutes, I do data[-2 : ] and not substr(data, data.getLength() - 1, 2) or whatever horrible contraption.

      If I want integer indices into the data list (for some reason), then I can use range(len(data) - 2, len(data)) and not range(len(data) - 1, len(data) + 1) or range(len(data) - 1, 2) (the latter are not made up at all, there are a lot of languages where you have to do it like that).

      >>> range(0, 5) + range(5, 10) == range(0, 10)
      True
      >>> len(range(0, 10))
      10

  7. Re:BAHAHA!!! by Anonymous Coward · · Score: 0

    What makes the one line lambda worse is the fact that in Python, not everything is an expression.

    That one change would clean up so much bullshit in the language.

    Other than the redundant self's everywhere because he was stupid enough to not include lexical scoping early on.

    It is a dumb OO language, at least as dumb as C++

  8. Re:BAHAHA!!! by doti · · Score: 1

    What is not appropriate is for a language to rely on whitespace.

    --
    factor 966971: 966971
  9. Fate by Anonymous Coward · · Score: 0

    It is absolutely essential. Just look at Perl's fate -- Larry Wall is just too clean-shaven. :-)

    What fate? Having multi-line anonymous functions? Being stable? Still being popular? Another language growing in popularity does not threaten that.

    1. Re:Fate by fyngyrz · · Score: 1

      How about being unable to create a 2D array without jumping through hoops (backwards, on fire, and without your pants)?

      --
      I've fallen off your lawn, and I can't get up.
    2. Re:Fate by Anonymous Coward · · Score: 0

      Guido doesn't get it. He wants python to be java or ruby but half its users would prefer MATLAB or lisp. He can mock perl all he likes, but that's where python will be heading if he's not careful.

    3. Re:Fate by MetalliQaZ · · Score: 1

      Create a 2D array, like you would do in C? That's not pythonic. If you want C, then use C.

      In Python you don't have to define memory before you can fill it with stuff. You plan your data structures and the interpreter manages memory. If you need default data then just go straight to writing the initializer function. Otherwise use higher level functions like append() or extend() while creating your data.

      --
      "Here Lies Philip J. Fry, named for his uncle, to carry on his spirit"
    4. Re:Fate by Anonymous Coward · · Score: 0

      So, in which language do you need to do that with your ass on fire? I think I'd have no trouble doing it with my eyes closed in either language.

    5. Re:Fate by Anonymous Coward · · Score: 0

      If you are really operating with matrices where you need a strict restriction that all rows are the same length, then use NumPy. It also has support for sparse multidimensional arrays.
      But even in simple Python you can do something like "a = [[0] * 30 for x in range(0,20)]" to create a 30x20 array.

    6. Re:Fate by fyngyrz · · Score: 1

      it's trivial in python. It's an incredible hoop jump in perl.

      --
      I've fallen off your lawn, and I can't get up.
    7. Re:Fate by fyngyrz · · Score: 1

      perl. Go ahead, show me a reasonable 2d (or more) array in perl, lol. I don't think you can do it.

      in python, there's nothing to it, trivial to do and trivial to access. Not in perl, or at least, it hasn't been.

      --
      I've fallen off your lawn, and I can't get up.
    8. Re:Fate by fyngyrz · · Score: 1

      yes, wasn't talking about python. Was talking about perl.

      --
      I've fallen off your lawn, and I can't get up.
    9. Re:Fate by Anonymous Coward · · Score: 0

      What, in perl, the outermost brackets need to be parens instead of square brackets to make an array? Oooh, I don't know if I can handle that...it sounds so difficult...so use square brackets all around and create a reference to an array if you can't handle it.

    10. Re:Fate by Anonymous Coward · · Score: 0

      Yes, if this is too complicated for python programmers, how do we ever expect them to handle multi-line lambda statements?

    11. Re:Fate by Anonymous Coward · · Score: 0

      In no way is Python anything like Ruby.

      It is much closer to Java than it is to Ruby.

  10. Re:Benevolent Dictator For Life by Anonymous Coward · · Score: 0

    No, you knob: it's a Monty Python reference, like the language itself.

  11. Re:BAHAHA!!! by Anonymous Coward · · Score: 0

    Which is why python is dead to me.
    I only tolerate makefiles because I must.

  12. face it, it *does* cause problems by Anonymous Coward · · Score: 0

    Although on the whole I think using whitespace to define blocks works very well, and I use python quite a lot, I think optional braces would be extremely useful at times. i.e. for copying and pasting code fragments. Python code is absolute pain in the butt to copy and paste to/from browsers, repl, etc.

    But braces are clearly against Guido's religion.

    1. Re:face it, it *does* cause problems by phantomfive · · Score: 1

      It's like the brace war.......it's silly because you should be able to handle braces at the end of a line, or on a new line. It's not like either one is very hard, so just do it.

      Same with space. Personally I don't prefer it, but it's just syntax. There are a hundred other things that are more important about a programming language than block delineation.

      --
      "First they came for the slanderers and i said nothing."
    2. Re:face it, it *does* cause problems by MetalliQaZ · · Score: 1

      With the broken indentation, would braces really have made it any easier to read? Barely.

      Whether it was C code, bash, or Lisp, the editors should have used CODE blocks. That's the problem, not Python.

      --
      "Here Lies Philip J. Fry, named for his uncle, to carry on his spirit"
    3. Re:face it, it *does* cause problems by TopherC · · Score: 1

      I find that copy and paste in Python is very easy to do in any editor that lets you block indent (most do). I've also seen lots of C++ and Java recently that have been cut & pasted with little regard to indentation which makes reading it misleading to say the least. I'm not saying that one syntax (with curly braces or without) is better than another, but curly braces are no panacea. I've uncovered a LOT of bugs in C++ caused by cut & paste with sloppy and wrong attempts to re-balance the braces. I've also found Python bugs caused by wrong indentations, often caused by letting an editor run wild with auto-indent -- you can do that in bracey languages so Python runs a little counter to that habit. Also for Python if sections of code at some indentation level get way too long, then there's probably a more readable way to break that code down.

      I've been working on an Android project for the past couple years, using Python for test automation, C for the kernel and drivers of course, C and C++ for low-level Android OS stuff and native libraries, and Java for upper layers (internals and apps). Whitespace in the C-like languages is inconsistent across the board, sometimes even within a file. Tab widths and tab/space usage are different for each developer (and their "style periods"). We cannot enforce a corporate policy in whitespace because we get so much (99.9%) of the code from open source and other suppliers. But thanks to PEP 8, Python code from multiple sources all looks pretty much the same and you don't have to invest time customizing your editor to use one style for files from one subtree, change formatting on the fly, etc.

      I should mention that where Python has Guido, The Linux kernel has Linus and his style guide. I find even local kernel module code is consistent style-wise. But outside of that, on my project anyway, it's a style free-for-all.

    4. Re:face it, it *does* cause problems by Anonymous Coward · · Score: 0

      not much easier to read, but correct, and easier to fix

      sure, there are ways around it, but it's enough of an obstacle to be annoying, and it means python is useless for one-liners

  13. To answer GvR's question by MetalliQaZ · · Score: 3, Informative

    I asked the Python 3 question and to answer Guido's question of me; I work at a large conglomerate that does a lot of defense contracting. In my area we deal with aerospace applications and so our linux systems are not Internet-facing. They are real-time systems that run simulations and data-acquisition. As you might expect, they only get upgraded when they really need it. We had a PDP-11 down in the lab until 2010.

    I'm not sure why I mentioned my workplace other to demonstrate how distant Py3k can seem to be. My main concern was the apparent lack of 3.x support in the big libraries out there. PIL is a great example. Also PyPy. It seems to me that there are many users that will only upgrade when the 3rd party libraries require it.

    --
    "Here Lies Philip J. Fry, named for his uncle, to carry on his spirit"
    1. Re:To answer GvR's question by Anonymous Coward · · Score: 0

      Do you ever wish that someone made python faster like was done to javascript or even PHP? Or it's not really important?

    2. Re: To answer GvR's question by Anonymous Coward · · Score: 1

      You can use Pillow to replace PIL on python 3. Works on python 2 as well.

    3. Re:To answer GvR's question by MetalliQaZ · · Score: 1

      Is python really that slow? I never do anything with Python that has made me notice a slowdown.

      One of the nice things about Python is the really well supported interface for C. If you have a problem that requires a computationally intensive solution, then you can put the worker code in C and wrap it in Python for the I/O and UI and glue logic.

      --
      "Here Lies Philip J. Fry, named for his uncle, to carry on his spirit"
    4. Re:To answer GvR's question by EvanED · · Score: 3, Informative

      Just to add my input, in the CS department at my university, the Linux that is currently in use is RHEL, the latest version of which (RHEL6) ships with 2.6.6.

      Now that said, we also have several other Python installations available from nonstandard locations, and a [i]python[/i] shell alias for me runs 2.7.3 and [i]python3[/i] runs 3.2. (Huh, 3.3 is available. I should update that.)

      Also, the Python project that I use that it'd be nice to see support Python 3 is SCons, and there's some talk of that going on and they'll get there eventually, but it's not clear when.

    5. Re:To answer GvR's question by EvanED · · Score: 1

      CPython is... really quite slow. You [i]do[/i] have to do something computationally intensive to notice, of course.

      That point and your parent's question are actually related to the PyPy question in the interview actually. PyPy is a JIT for Python that is able to get significant speedups for computationally-bound code. They run 20 benchmarks comparing PyPy and CPython, they are faster on all 20, and see speedups ranging from about a 27% improvement to a ~30x improvement, on average running 6.2 times faster. (Link)

    6. Re:To answer GvR's question by TopherC · · Score: 1

      It all depends on your frame of reference. CPython is a blurry rocket of speed when compared with Jython. And in theory you can write all the compute-expensive routines in C++.

    7. Re:To answer GvR's question by EvanED · · Score: 1

      CPython is a blurry rocket of speed when compared with Jython.

      Is Jython an order of magnitude slower than CPython? Because that's my rule of thumb for CPython vs C. (Actually the programming language shootout's numbers are more like 30-40x slower than C, though that needn't be representative.)

      And in theory you can write all the compute-expensive routines in C++.

      Sure, but then that's not Python being fast, it's C++ being fast. "You could write the expensive parts in C or C++" can be said of nearly any language. :-)

    8. Re:To answer GvR's question by codealot · · Score: 4, Informative

      I was a little surprised by GvR's answer to this. RHEL 6 ships with Python 2.6, last I checked, and we don't normally deviate from Red Hat packages without good reason. Getting the masses off pre-2.7 versions of Python will also entail releasing newer OS distributions and retiring older ones, both of which happen slowly.

      Not everyone can keep up with the latest/greatest versions out there, especially when they have hundreds of servers and big legacy applications to support.

    9. Re:To answer GvR's question by rwa2 · · Score: 1

      Shoot, I did my master's thesis in python. Using the psyco JIT engine (sorry, 32-bit only for old python), my stuff ran ~10 - 100x faster by just including one import statement.

      I'll play with running it under PyPy and see how it does nowadays. But yeah, I find stuff like PyPy essential for a lot of the stuff I like doing.

    10. Re:To answer GvR's question by Anonymous Coward · · Score: 1

      PIL hasn't had a release in years so it has been forked:

      https://pypi.python.org/pypi/Pillow/2.1.0

      Pillow 2.x is the P3K branch, Pillow 2 for older Pythons.

      The PyPy3 2.1 beta that came out the end of July had initial support for Python 3.2.3, haven't tried it yet, but that's pretty cool.

    11. Re:To answer GvR's question by mrvan · · Score: 2

      And in theory you can write all the compute-expensive routines in C++.

      Sure, but then that's not Python being fast, it's C++ being fast. "You could write the expensive parts in C or C++" can be said of nearly any language. :-)

      Not quite. In java and most other languages I know, you would have to make quite some changes to the rest of the code to get it to communicate with something written in C.

      In CPython, you can replace a module and the rest of the code won't notice, e.g. in

      import mymodule
       
      x = mymodule.compute_answer()

      mymodule can be a python module or a c module and you really don't need to know or care. You can build the prototype in python and later replace it with a C module, and unittest and benchmark both. You can even do it conditionally, e.g. replace mymodule by something like

      try:
        from mycmodule import compute_answer
      except ImportError:
        from myfallbackmodule import compute_answer

      And the same original code would use the c module if available, and otherwise the fallback module.

      Even if you don't do any of this, you do get benefits, since the expensive parts of the standard library and 'computational libraries' like numpy are written in C. If you can write your problem with efficient use of these functions, especially turning loops into vector/matrix calculations that are done by numpy, you can get the speedup without writing a single line of C. I've actually sometimes encountered a slowdown after reimplementing in C because all the expensive bits were in library calls that were apparently better written than my rewrite.

      Finally, there are tools like cython which allow you to add type hints to your python code that compile to C code. This will be slower than hand written C code, but require a lot less changes to the module and is less error prone, and in my experience can easily give a 10x speedup with a couple of "int" hints, especially in nested loops.

    12. Re:To answer GvR's question by Anonymous Coward · · Score: 0

      The library support is slowly coming ... PIL has a fork called pillow that supports 3.x (not sure PIL's ever going to see another release). PyPy isn't exactly a library ;)
      Big projects need to start using 3.x too, to spur adoption... Ubuntu is working on it: https://wiki.ubuntu.com/Python/3

      This site 'tracks' 3.x support ... http://python3wos.appspot.com/

    13. Re:To answer GvR's question by sad_ · · Score: 1

      you can get python 2.7 from redhat for RHEL6 now.

      --
      On a long enough timeline, the survival rate for everyone drops to zero.
  14. AMA on reddit by Anonymous Coward · · Score: 0

    Can you do one there?

  15. Re:Benevolent Dictator For Life by Anonymous Coward · · Score: 0

    I think "Benevolent Dictator For Life" is based on his love for the BBC show "Monty Python's Fying circus". Rossum named "python" after that.

    I personally, don't recall any skit about a "Benevolent Dictator For Life". Does any one else?

  16. Functional programming is no harder than OOP by Anonymous Coward · · Score: 0

    Haskell and monads are hard, so functional programming is hard, huh?

    Rubbish.

    OOP is just as full of esoteric, mind-bending weirdness as functional programming is, and for a language that prides itself on readability python sure has it's share of WTF magic. If you think reduce is hard to understand, you might like to try explaining reduce versus some of the following python features to a noob:-

    • super and multiple inheritance (ha ha, good luck with that!)
    • list incomprehensions (they're cool, but you really think they're obvious?
    • using dicts for case/switch-type problems (or even better, using types & overloading)
    • iterators and generators
    • why tuples are more important than arrays
    • in what way the new print function is more intuitive than the old print statement

    OOP is a great way to write crappy, bloated, buggy, unmaintainable code, and ruby does it better than python. As you admit yourself python will never be the language of the web either. But sure, just carry on 'dissing functional programming and alienate some more of your core users.

    1. Re:Functional programming is no harder than OOP by phantomfive · · Score: 2

      But sure, just carry on 'dissing functional programming and alienate some more of your core users.

      After that post, I seriously doubt you are a core user.....

      --
      "First they came for the slanderers and i said nothing."
    2. Re:Functional programming is no harder than OOP by MetalliQaZ · · Score: 2

      Did you read what he said? He wasn't dissing functional programming. His point was that FP features require powerful compilers. Python doesn't have that kind of compiler. Therefore the features don't have much use to Python.

      By the way, I don't believe they made the print function to be intuitive. They made it because print had no reason to be a statement. Also who said that tuples are more important than arrays? Arrays are really a concept for lower-level languages. Tuples, lists, and dictionaries are higher-level concepts that might be implemented with arrays behind the scenes. Lists function similarly to how many people visualize arrays. The beauty of tuples is that they are immutable, which means that they never change and can be thought of as a single, meaningful package with its contents. In contrast, lists have to be thought of as containers that can contain unknown things that may change at any moment.

      --
      "Here Lies Philip J. Fry, named for his uncle, to carry on his spirit"
    3. Re:Functional programming is no harder than OOP by Anonymous Coward · · Score: 0

      It's the libraries that make the difference. I thought it was a clean, pragmatic language in the beginning, but as time goes by I am less and less convinced.

    4. Re:Functional programming is no harder than OOP by Anonymous Coward · · Score: 0

      Yeah, I read his excuse about python's compiler. That's probably why all the functional stuff is in functools, right?

      And my point about tuples (I like the immutability btw) is that by wasting parentheses on tuples, there were no square brackets left for arrays. A list of lists is a poor substitute for a real array.

      A lot of functools and numpy stuff could so easily have been part of the core language. What a waste.

    5. Re:Functional programming is no harder than OOP by Half-pint+HAL · · Score: 1

      Arrays have no place in a high-level language. An array has no intrinsic meaning, and any externally imposed meaning is non-obvious. You're supposed to define an object that makes its meaning and function obvious. I've been developing some code that started in Javascript and was migrated to Python, and every step of the process involved unpicking my own hacked-together array/list datastructures, working out what the hell I'd been thinking of, then impose some order on the whole thing.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    6. Re:Functional programming is no harder than OOP by bensyverson · · Score: 1

      Hmm. An array has no intrinsic meaning? It's a list. I mean if we're going to get deep, nothing has any intrinsic meaning, man, but I don't think that's what you're trying to say. Can you explain?

      As a C developer, I often need to collect a list of things and then iterate over them in a very specific order—whether it's computing a rolling average or just storing a list of items in a table for display. Not to mention the image processing I do, which depends on 1D, 2D and 3D arrays.

      I don't know... I'm scratching my head over here. What am I missing?

    7. Re:Functional programming is no harder than OOP by Half-pint+HAL · · Score: 1

      Let's start with the (obvious) statement that you don't use a high-level language for its efficiency -- as a C developer you's be appalled at how slow my Python program runs! You use arrays of various dimensionalities to represent cartesian cordinates, vectors, and transformation matrices, because it is a computationally cheaper than using custom datatypes.

      The whole point of high-level languages is to abstract things out to make it easier for the designer to express their thoughts more easily, and to reduce the possibility of errors. High-level languages need to be far more semantically meaningful than something like C. If your vector in C is an array [x1,x2,x3] and your point is [x2,y2,z2], you might accidentally mix them up, because if your "type" is simply "array of int". Python wants you to use datatypes so that your vector is a vector and your coordinate is a coordinate, and even if they are internally identical, they're still recognised by the system as different

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    8. Re:Functional programming is no harder than OOP by phantomfive · · Score: 1

      Fascinating. What libraries in particular do you like from Python? Serious question.

      --
      "First they came for the slanderers and i said nothing."
    9. Re:Functional programming is no harder than OOP by Anonymous Coward · · Score: 0

      numpy, scpiy, maplotlib, ipython, pandas, multiprocessing, cython, numba; and all the mundane stuff (you name it, there's pretty much always something in PyPI to hack together a solution)

    10. Re:Functional programming is no harder than OOP by bensyverson · · Score: 1

      Oh, I think execution speed is overrated anyway. In terms of user interaction, 30ms is the same as 150ms: "fast." If you have to do some heavy lifting that will take multiple seconds to compute in Python, you can always dip into C for that section.

      But yes, the ease of typecasting and assignment are double edged swords in C. They can save you a lot of time, but it's easy to cut yourself. That's why, like many C developers, I use typedefs and structs heavily, and avoid using arrays for data types. For example, I would never define a color as:

      double rgb[3];

      But rather:

      typedef struct { double red; double green; double blue; } ColorTriplet;

      Of course this doesn't prevent me from assigning someColor.red = somePoint.z, but hopefully if I didn't mean to do that, it's a little easier to catch than someColor[0] = somePoint[3];.

      But I often need to store a small array of those colors or points, and the C array mechanism is very helpful. And needless to say, when iterating over an image, the pixel buffer is most naturally addressed as an array (for CPU-based processing, anyway).

    11. Re:Functional programming is no harder than OOP by Half-pint+HAL · · Score: 1

      Correct and correct. Never do the compute-intensive stuff in native Python + compute-intensive stuff (eg image manipulation) needs arrays = Python doesn't need arrays.

      Python's lists are a perfectly adequate replacement for a small 1-dimensional array when needed on an ad hoc basis.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    12. Re:Functional programming is no harder than OOP by Anonymous Coward · · Score: 0

      Python's built in libs are atrocious.

  17. Re:The only language designer worse than Guido by Anonymous Coward · · Score: 0

    It must be painful to be as intelligent as you believe you obviously are and yet unable to develop your own programming language

  18. Re:BAHAHA!!! by the_B0fh · · Score: 1

    Someone should consider what a posting to slashdot would look like when they make a new language...?

  19. Whitespace in Python by fyngyrz · · Score: 1

    Luckily, both of your opinions on whitespace were not, and are not, either significant or involved in Python's design.

    And that's why you two don't have to be dead to me. :)

    Plus, you can keep working with whatever it is that you DO like. Imagine that!

    --
    I've fallen off your lawn, and I can't get up.
  20. Re:BAHAHA!!! by h4rr4r · · Score: 1

    Yeah, I was going for funny but I guess no one got that.

    I dislike whitespace having meaning, but was just trying to make a joke. As you noticed the idea was ridiculous, thus the joke.

  21. Smileys and parenthesis by ericcc65 · · Score: 1

    Interesting interview. Surely there were more important topics but if nothing else this interview was useful in that it taught me it's okay to use the parenthesis at the end of a smiley to serve double duty as the end of a parenthetical statement (kind of like this one :-). At least when your smiley is left in plain text, that is.

  22. Re:BAHAHA!!! by Half-pint+HAL · · Score: 1

    What makes the one line lambda worse is the fact that in Python, not everything is an expression. That one change would clean up so much bullshit in the language.

    Or perhaps it makes the one-line lambda better...? As per Guido's own example, lambda's are essentially redundant, as you can achieve the same results with a locally-defined function. The one real difference is that certain things aren't permitted in a lambda, because they're not expressions... which makes a lambda an approximation of a true function, rather than a procedure (Python's "functions" are in reality "procedures")....

    --
    Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
  23. Still no ordered map? by Anonymous Coward · · Score: 0

    I've written an AVL tree implementation for Python, but I really think an ordered map ought to be a standard facility. It's standard in Java and C++, but sorely missed in C and Python.

  24. Re:BAHAHA!!! by Anonymous Coward · · Score: 0

    yeah, the more you use it and think about it, the uglier it gets

  25. Re:BAHAHA!!! by Anonymous Coward · · Score: 0

    The same result with nastier, more verbose syntax.

    Fuck that shit. When I want nasty, verbose syntax I just go straight to Java or C++

  26. Lua by blinking_at · · Score: 1

    Lua is better than Python in every way.

  27. Re:The only language designer worse than Guido by Anonymous Coward · · Score: 0

    Unable or unwilling?

    Two different things.

    The programming world would have been better off if both Guido and Rasmus stayed away and got a job flipping burgers.

  28. CPython is a unclear bomb of speed by fauzsp · · Score: 1

    So no, you can't create a whole program functionally, but if FP was incorporated effectively into multi-paradigm development, it would make simpler debugging no end. What do I mean by properly? FP should be a limited subsystem. No side-effects: no printing, no information, no condition changes or varying claims. This has to be an strong concept (with the possible exemption of debug info). Techniques can contact features, and features can contact other features, but features can't contact procedures. This has to be an strong concept, and I don't beleive most multi-paradigm 'languages' implement it. Why does it have to be unbreakable? Because the whole factor is to decrease debugging attempt. With real FP, bug monitoring is (relatively) easy: if the operate gives the incorrect response, there's a bug in it; if it gives the right response, there's no bug. But as soon as you allow condition changes and other adverse reactions, it's a process, not a operate, and a side-effect bug might only display itself further down the range (eg you unintentionally keep an A in the create shield and the next concept gets an invalid A at the start) and you're remaining on a looooong search. It's regrettable that program control in Python is such a blunder, mostly for traditional reasons. There's quite a bit of good items on PyPI these days, and if we were beginning over, I think we'd do better to restrict the conventional collection to a small set of important fundamentals, and to advertise the best collections from outside resources via the conventional program database and resources. I do a reasonable bit of development in Python and curly-bracket 'languages' (C, C++, JavaScript, PHP, etc.) and remarkably, a forgotten/misplaced wavy segment in any of those various curly-bracket 'languages' seem to crack my rule greatly more often than indent problems do. | Cheap Umrah Packages | Cheap flights To Harare

  29. Funny by Anonymous Coward · · Score: 0

    Ruby has private members as is far more dynamic than Python is.

    At least the idiot admitted the OO system was an hacked-on after-thought.