Today an important thing happened in my professional life. I was told to take a break from The Top Priority Project, so that I could deal with a more important project. The evaluation of the expression max_priority+1 caused my wetware registers to overflow. Therefore, you should consider the following piece of whining as an attempt of a brain to recover from deadline damage. That is, you won't get the kind of deep discussions and intellectual insights you've come to expect from yosefk.com. Instead, you'll get shallow, plain, simple and happy Python hate. That's the kind of thing we have in stock right now.
It has been known for quite some time that a specie called the Idiot is out there, and its revolting specimens will mercilessly prey on your belief in the future of the human race. The time has come for me to share with you some of the shocking experience from my encounters with idiots. Believe it or not, there exists a kind of Idiot who sincerely thinks that a Person should not complain about Technology or Tools he or she gets to use, and that such complains are deeply wrong on this or other level, depending on the exact idiot in question. Well, I hereby inform the idiots, at least the ones who can use a browser and read text, that I (1) have a bad attitude, (2) am not a good workman, so (3) I'll complain about any technology I use as I damn please and (4) I don't give a flying fuck about your moronic opinion, so don't bother to share it with me.
So, Python hate. I don't really hate Python; it's a figure of speech. You know what I really hate? Of course you do. I hate C++. C++ is the hate of my life. I don't think I'll ever be able to hate another programming language. For me, to hate means to recognize that something is inherently evil and should be exterminated. Reaching that status is outstanding achievement for any technology. Your typical piece of software never gets that far. All it does is it does something you need most of the time, and then does something extremely brain-damaged some of the time. So you kinda like it, but sometimes it just pisses you off. It's gotta piss you off. It's a machine. It's doesn't have a pigeon crapload worth of common sense. Of course it pisses you off. Don't lie to me! A person who was exposed to machines and doesn't hate them is either an idiot or is completely devoid of soul! Step back, the child of Satan!
You know what really pisses me off about Python? It's the combination of being BDFL-managed and having roots in the noble idea of being The Language for Teaching. Sure, having lexical scoping wouldn't hurt, and having name errors 5 minutes down the road in a program that happily parses already hurts, and Python shells aren't a picnic, blah blah blah. But nothing is perfect, you know, and people adapt to anything. I learned to live in tcsh and vim as my IDE. So I know how adaptability can bring you quite far, sometimes much farther than you wish to get. But this BDFL+teaching combo really bugs the hell out of me. Allow me to elaborate.
Ever heard about programming languages with an ANSI standard? Sure you did. Well, the other kind of languages have a BDFL standard. It's when a Benevolent Dictator For Life, typically the Punk Compiler Writer (PCW) who invented the language and threw together the initial (and frequently still the only practical) implementation, decides what happens with the language. I plan to blog about PCWs at some point, but this isn't about PCWs in general, this is about PCWs who've been elevated to the BDFL rank. So they bend the language as they damn please. Sometimes it splits the user community (as in Perl 5 vs Perl 6) and sometimes it doesn't (as in Python 2 and Python 3, or so it seems). I'd say that it's totally stupid to use a BDFL-governed language, but I can't, because that would offend C++, The Hate Of My Life, who does have an ANSI standard. Relax, darling. It's you, and only you, that I truly hate. The others mean nothing to me.
So that's what the "BDFL" part means. The "teaching" part is about Python being supposed to be a good (the best? of course, the best) language for teaching kids how to program. While I'm not sure whether the BDFL part is inherently wrong, the teaching part is sure as hell wrong, in two ways:
- Why the fuck should kids program?
- Why the fuck should I program in a language for kids?
I didn't program till the age of 17, and I have absolutely no regrets about it. I know quite some other programmers-who're-really-into-software-someone-call-for-help who didn't hack in their diapers, either. I also know a bunch of people who did program since they were 10 to 12 years old. They are all burnt out. They're trying to look for some other occupation. Theater, psychology, physics, philosophy, you name it. I haven't gathered that many data points, just a couple dozens. Some people won't fit the pattern I see. But it's enough for me to assume that kids could have better things to do than programming. Watching cartoons is one thing that sounds like fun. That I always liked.
I'm not sure kids shouldn't program. We need scientific data on that one. I'm no specialist, but locking a large enough set of kids in the basement and have them implement progressive radiosity sounds like a good start. Anyway, as you probably noticed, while I'm curious about the scientific truth, I don't care much about kids. I care about me.
Me. I'm a professional programmer. By which I mean to say, I shovel through piles of virtual shit for a living. And to shovel quickly and happily, I need a big shovel. Python is one of my shovels. Core dumps are one of my piles of shit. Python, meet the core dumps. Core dumps, meet the Python.
Core dumps are spelled in hexadecimal. I mean "core dumps", "spelled" and "hexadecimal" in the broadest sense, as in "things having to do with machine encoding and that sort of low-level crud are viewed and edited in tools that tend to emit and consume integers in hexadecimal notation". Or "core dumps are spelled in hexadecimal" for short.
To deal with hexadecimal, Python has a hex() function and a '%s' format string like it should. Well, almost. Python thinks that hexadecimal is like decimal, except in base 16 instead of 10. Integers are naturally spelled in sign magnitude format: 1, 10, -1, -10
. In hexadecimal, that's 0x1, 0xa, -0x1, -0xa
. "-0x1"
? "-0x1"
?!! FUCK YOU, PYTHON!!
You see, all computers that have been out there since the year 19-something store integers in 2's complement format. There used to be 1's complement and sign magnitude machines, but they are all dead, which is a good thing, because 2's complement is a good thing. In 2's complement, -1 in hexadecimal is 0xffffffff. If you use 32-bit integers. And twice the number of f's on 64-bit machines. Do I give a flying fuck about 64-bit machines? I think you know the answer. If I cared, I'd run Python on a 64-bit host. An old version of Python.
In old versions of Python, hex() worked about right. Python has ints and longs (that's fixnum and bignum in Lisp, and it would be int and BigInteger in Java if ints didn't overflow but would instead turn into BigIntegers when int wouldn't have enough bits). hex() assumed that if you're using ints, you're a bit biter, and you want to get 0xffffffff
for -1, and you should get your non-portable, but handy result. If, on the other hand, you used longs, you probably were a mathematician, so you'd get -0x1
. And this was juuuust riiiight.
However, starting from version 2.something, hex() was "fixed" to always do "The Right Thing" – return the portable sign magnitude string. That, my friends, is what a kid would expect. You should know – you were a kid yourself, didn't you expect just that?! Naturally, breaking the frigging backwards compatibility is perfectly OK with the PCW BDFL, who sure as hell doesn't want to add another function, sex() for "sexadecimal". That function could (preferably) do the new thing, and hex would do the old thing to not break the existing programs. Or it could (passably) do the old thing so that people could at least get the old functionality easily, even though hex() would no longer work. But noooo, we need just one hex function doing the one right thing. Too bad we only found out what that right thing was after all those years went by, but in retrospect, it's obvious that nobody needs what we've been doing.
Now, could anybody explain me the value of hexadecimal notation outside of the exciting world of low-level bit fucking? Why on Earth would you want to convert your numbers to a different base? One particular case of this base brain rot is teaching kids to convert between bases. As Richard Feynman has pointed out, and he had the authority to say so and I don't and hence the reference, converting between numbers is completely pointless, and teaching kids how to do this is a waste of time. So what you do is you give me, the adult programmer with my adult core dump problems, a toy that a kid wouldn't need or want to play with. Thank you! You've found the perfect time, because I have a DEADLINE and this fucking shit CRASHES and I couldn't possibly have BETTER THINGS TO DO than WASTING TIME ON CONVERTING BASES!!
I know that I can implement the right (yes, THE RIGHT, damn it) hex and put it into my .pythonrc and that would solve the interactive shell annoyances and I could carry it around and import it and that would solve the non-interactive annoyances, thanks again. Until now I've done it in a cheaper way though – I had a Python 2.3.5 binary handy, and that did the trick. 2 Pythons, one with new libraries and shiny metaprogramming crap and stuff, and one with a working hex(). I like snakes.
Why do I attribute this business to kid-teaching, of all things? I don't lurk on Python forums, so I'm basing this on rumors I heard from die-hard Python weenies. Another, TOTALLY INFURIATING thing: a/b and a//b. int/int yields a frigging FLOAT in Python 3!! This has all the features of hex(-1) == '-0×1':
- "Kids" get the wrong answer: 3/2 should give 1 (honest-to-God integer division) or it should give the ratio 3/2 (honest-to-God rational/real number division). Floating point is reeeaaally too complicated. I've seen a teacher saying online something along the lines of "if you ask how much is 3/2 times 2, how do you grade the answer 2.99999"? Bonus points if your reply managed to take the identity "2.999… = 3" into account (hordes of grown-ups fail to get that one).
- "Programmers" get the wrong answer: chunks=len(arr)/n; rem=len(arr)%n. 'nuff said.
- "Mathematicians" get the wrong answer: I mean, if you're doing numeric work in Python (what's the matter, can't pay for a Matlab license?), you probably know about integer division versus floating point division, but you've never heard about an operation called // (no, it's not a BCPL comment). 3/2=1.5? How am I supposed to do integer division? int(3/2)? Argh!
You know, I'm actually more willing to upgrade to C++0x, whenever that materializes, than I am willing to upgrade to Python 3. At least it would be "for(auto p=m.begin()…" instead of "for(std::map<std::string,std::string>::const_iterator p=FUCK OFF AND DIE YOU EVIL PROGRAMMING LANGUAGE FROM HELL!!".
What's that? Who said I liked C++0x more than I liked Python 3?! Upgrade, I said, "willing to upgrade"! Don't you see it's relative to the previous version? In absolute terms, who can beat C++?! Come back, C++! I still hate you!!
144 comments ↓
That, sir, was inspired.
I wanted to flame you and tell you that you should have used "%08x" % -1, which would obviously do the right thing, but funnily it doesn't, printing lame "-0000001" instead.
What kinda made me agree with your point, as sprintf("%08x", -1) definitely works in Ruby, doing exactly what it looks like it's doing, and is also portable.
Yep, in Ruby 1.8.6, '%x'%-1 returns '..f', which is probably the best thing you can do – 2's complement, and doesn't depend on any particular data type size.
The thing that gets me in Python is that it worked passably. That they broke it is annoying, that they did it for the completely wrong reasons doesn't make it any better.
hiffy is right. An inspired rant!
And as long as we're on the subject of teaching kids to program (though I fully agree with you about it not being necessary, as about teaching 'em to convert between bases), the (in)famous Rubyist _why is working on a cute programming environment for beginners called Hackety Hack, which is worth looking at, I think.
Also, thanks for the C++ FQA! It's great to finally have a good site to link to when I want to save my breath explaining the evils of C++ to some benighted colleagues.
Regarding the "inspired" bit – um, thanks, it was primarily inspired by overtime…
As to C++ FQA – I hope it's any good as persuasion ammunition. It turns out I can't test it myself very much, because when someone asks you, "what's wrong with constructors?", and you say, "read this page I wrote about it", most of their attention gets occupied by the thought: "hey, this guy really IS a nerd". Oh well. Maybe it works better when I'm an anonymous third party in the argument.
Interesting rant, and given that you picked up only on minor warts, I am tempted to say that you like Python. :-)
However, I think you are overemphasizing a bit the "teaching language" roots of Python. It is true that ABC (Python's direct ascendant) was originally for teaching, but this link between the two languages was cut long ago. I never yet seen the addition of a language feature being refused (or accepted) on the basis it would make the language harder (or easier) to learn for the kids.
And about the "true division" thingy, I can't tell whether this was a good thing or not. The only thing I can said it that changing the division operator was controversial and not an easy decision to take.
I do like Python, in the sense that I think it does much less harm than good. Basically the quality scale for programming languages is:
1. So bad that you must rewrite your legacy code in something else ASAP (COBOL? Assembly? Maybe not. Maybe there are no languages which are that bad.)
2. Too bad for new code, not bad enough to justify rewriting existing code (C++)
3. Good enough to write new code in, and good enough to be chosen as the language for new projects for availability reasons (for example, if everybody around speaks Python, it's a good enough reason to use it and not Ruby, even though the latter is apparently somewhat better linguistically).
4. So wonderful/easy to learn that you want to use it for new code even though it isn't widely spoken in your environment and has other availability problems (Lisp? D?)
Most popular languages happen to fall between 2 and 3, and Python gets a solid 3 in my book, and 3.5 in a 3GL environment when you want to advocate a 4GL. So yeah, I like Python.
Personally, I haven't done much programming in C++ to judge it (although, I do find your rants and FQA about it much entertaining). One thing I find funny though, is that almost every year it's a C++ team that wins the ICFP programming contest. For example, last year Team Smartass (a team of Googlers) won the first prize and made the organizers declare:
And, the second prize was won by another team of C++ coders (United Coding Team), but they made the organizers declare:
That is pretty ironic given that the contest's main goal is to raise awareness in functional programming languages. The write-up of the contest is quite interesting, too. Hopefully, this year contest will be more challenging than "code a VM".
I don't know why people always compare Ruby to Python, and vice versa. Ruby's design philosophy is much closer to Perl's than Python's. Rubyists, just like Perl hackers, aim for a syntactically powerful language at the cost of ambiguity. Pythonistas, on the other hand, aim for readability at the cost of some rigidness in the grammar (e.g. Python will probably never move beyond the current extended LL(1) parser, where Ruby needs a quite complex LALR(1) parser). That's where perhaps your analogy with kids language is somehow true.
I agree that Lisp is a nice and powerful language. However, I think the community has severe problems (especially when they come to marketing the language), which makes the language a bad choice for larger projects. However for small project done with friends who knows the languages well, Lisp is certainly a great choice (a fun one, too).
Anyway, I am really intrigued about D. I have heard many clever people advocating it as an alternative to C++, but I had never yet tried it. So, I took a few hours today, installed both DMD and GDC and read some of documentation posted on D website.
So far, I like it! It is an interesting blend between simple C and high-level scripting languages. Although the libraries seems a bit immature (yet quite complete for a young language). I will probably try give it a better "test-drive" next weekend (I am thinking implementing a small interpreter with it).
P.S. I remarked that you're using an old version of WordPress. In my humble opinion, that is a bad idea. About a month ago, some attacker successfully exploited a PHP injection vulnerability in WordPress 2.3 and gained shell access to my server account. Thankfully, the attacked didn't do much damage — i.e., he simply appended some spam junk to all my HTML pages, which I cleaned easily with one
sed
command."Team Smartass": damn, I really envy those people. Winning a competition as a member of Team Smartass. Is that awesome or what?
I don't follow these competitions, because of not liking programming competitions and because of not caring that much about FP. The reason that mainstream non-FP languages frequently win those competitions is IMO that the users of those languages have more practice. A C++ loop iterating over a map is ugly, but I've typed it a gazillion times and I can do it again really fast, because I use it all the time. A professional prehistorical warrior with a club has a good chance to take out an amateur shotgun enthusiast. Miss a few times and you'll be clubbed to death.
I don't think Ruby is that close to Perl, except for the occasional dollar sign. I think Ruby and Python are the 2 top 4GLs if your metric is popularity * cleanliness, and they use very similar dynamic hashtable-based REPL models, so it's natural to compare them. I think Perl 5 is way more complex syntactically than either of them. Regarding parsing – I don't care whether it's LL or LR, as long as it's context free (C++ has significantly lowered my standards for "ease of parsing"). I don't think Ruby tries to do any "DWIM" parsing similarly to Perl – or does it? Which ambiguities are you talking about?
D rules.
Finally surrendered to my growing paranoia and upgraded to WP 2.5.1, surprisingly painlessly.
1. Why the fuck should kids program?
Because programming can be a fun, creative task that at the same time teaches them disciplined logical reasoning skills. And some kids will like making their own Tetris clone.
2. Why the fuck should I program in a language for kids?
Python is great because it has a gentle learning curve (making it a great first language) while at the same time scales up to be a professional language in most software domains.
I really advocate Python, as a language for kids, non-programmers, and programmers. It has the things I like about Perl without the things I don't like about Perl (mostly). In fact, I wrote a book (Invent Your Own Computer Games with Python) specifically to teach kids programming in Python (can we agree that it's the best real-world language for that task at least?)
I'll take on the two flaws you bring up about Python. I think the hex() function should behave the way it does. It simply has the job of converting integers to hexadecimal. Two's complement is an idea that is beyond a mere base conversion. It would bring up all sorts of overflow problems and architecture-specific concerns (32-bit two's complement or 64-bit?)
I understand your gripe, but it seems that you are upset that a design trade off was made against your favor. I don't think that's a fatal flaw for a language.
The division thing has always been a clusterfuck. I forget which video, but I recall Guido van Rosem saying he regretted the whole integer division thing, which is probably why in int/int = float in Python 3000.
But I still don't think it is too complicated. Explain it as such: if you divide 13 by 5, you get 2 with a remainder of 3. Integer division gives you the 2 part, mod gives you the 3 part. To get real division, convert an operand to a float. Sure, that's dumb (hence the fix in Python 3), but again, I don't see that as a fatal flaw in the language.
Let's put it this way: I sincerely like Python, I think kids should program if they wanna, and the whole thing about hex and division isn't a big deal.
I still say that base conversion is a useless operation while 2's complement hex is useful. And if base conversion is considered interesting, add a base() function for it, but why break hex() that did the useful thing for lots of time?
Let's agree that Python does have an annoying vibe of teaching you the right thing. Consider the interactive behavior of exit or quit. The damn things aren't strings anymore; they are objects with overridden __repr__ telling you that you should type Ctrl-D!! WTF? Why not sys.exit(0) instead of fucking my brain?
On the other hand, it doesn't matter. For example, I like the attitude behind Perl more than the attitude behind Python (of course I refer to those attitudes as I perceive them). But I prefer to use Python rather than Perl. Creators and creations aren't trivially "similar".
> chunks=len(arr)/n; rem=len(arr)%n
Ugh. Why not
chunks, rem = divmod(len(arr), n)
?
I think that still does int division in python 3.
Thing is we have a language for kids. It's called BASIC. It's what I learned on when I was 8, got tired of when I was 12 and moved on to scarier languages derived from C. Now I'm moving on to LISP derived languages.
To paraphrase,
knowledge of the intricacies of C++ (and similar) should be treated like a martial art. First try to run away. Failing that, call the authorities. Your last resort should be to stand your ground and code.
I think the old Dartmouth BASIC number is a really good starting point, as is learning assembler on a simple, old architecture like 6502. It's all about totally understanding all there is to know about an environment, then using those tools to analyze a problem, and experimenting with finding the solution that is verifiable, unlike your English or social science paper.
If they like it, most kids will move on to other languages, but they will have a basic understanding that is hard to gain from more sophisticated languages with large libraries. Sort of like doing math problems in your head and long hand versus a calculator.
I think assembly is a bad way to model computation, whether you're a beginner or not, both because of its verbosity (as in function calls/definitions or intermediate results of arithmetic expressions) and its fixed-size limits (as in the number and to a lesser extent size of registers.) IMO many a beginner would take away a feeling that programs are verbose legalese. A group of beginners would love assembler as their first language because they're into making watches out of a thousand tiny moving parts; but those people will find their way to assembly or similar anyway.
i'm just starting to learn py, so i can still clearly remember that my brain rejected -0×1. the int div scared the hell out of me, & half the hell when i knew about //
to the writer of "Invent your own computer games with python", i don't give a fuck about whether they're complicated / not, what i complain is they made my brain created new connections between my brain cells, instead of reinforced existing ones. so as neuroscience goes, using them weakens the network that let me know that -1 is 0x(f) in hex
'Why the fuck should I program in a language for kids?'. this shakes my pride & stomach
Loved the rant.
Are you this hauptmech? Interesting stuff.
I want to like python. I had hoped to use it for all my new cgi scripts but it took me forever to get used to the indentation.
I was and still am used to curly braces. I still prefer plain old C to any of the new so called "easy" languages.
Well, if you prefer plain old C for CGI scripts (or should I say programs), this leaves me speechless (I've seen people who did everything including "scripting" in C++, also people who did everything in C+bash+grep+awk+…; everything in C I hadn't seen).
I am currently teaching a middle school child to program in Palo Alto, CA. The standard progression of languages in our area for children is MIT Scratch, CMU Alice, then Java or Python. Many children are learning Java for historical reasons. For the children learning Python, many take advantage of Pygame, which provides 2D graphics based on SDL.
My general view is that technology and art are merging. I don't think we are teaching children programming for them to be professional programmers. I believe we are teaching them programming so that they are better prepared to express their creativity in a world that is becoming increasingly influenced by technology.
Let's say that my students grow up to be environmental scientists or pastry chefs. I believe that an understanding of programming will help them in both of these jobs. Waiting to 17 years old is too late. By this age, the children are too busy preparing for college and may not have time to experiment with learning things on their own. I want the children to be quite proficient in programming by this age so that they can then go back to studies such as literature or art.
For now, I teach the creation of simple arcade-style games, trying to unlock the creative potential of children with sound, music, 2D graphics, lists, for loops, and coordinate arithmetic.
In the same way that we teach math without any expectation that the child will become a professional math professor, we should not teach programming to children with the intent of training professional computer programmers.
Our goal here is to simply provide children the opportunity to make their own choices. Without the tools of knowledge, opportunities may close on them.
@Craig: it's definitely an inspiring approach. A bit sadly though, as a professional programmer who occasionally does some painting and sculpting, I was never able to interestingly "merge" programming and art; nor was programming useful for anything other than earning a salary, for that matter.
Personally, I explain this partly by my own interest in meta-programming/platforms/etc. rather than end-user programming, which obviously isn't applicable outside of a development context – and partly on programs being a bit like movies: theoretically, you're just making a bit string with readily available tools, but in practice, it's not at all easy to produce a notable result on a small budget (both in terms of time and money).
So if anyone successfully applies programming in the context of any sort of art, I think it's rare and notable.
P.S. As to my rant – it was, well, a rant… So this is my answer to you – but your comment wasn't "an answer to me" in the sense that your comment was serious, this comment of mine is serious, too, but whatever claims I made in the original rant probably aren't…
Started out inspired but it rants on. I could not agree more however. The best language ever, and I really mean "Ever" was Pascal.
The compiler was unforgiving and did a magnificent job of protecting the end consumers from (well you know…) IDIOTS. The final code was elegant, efficient, fast and above all: Reliable. (Idiot programmers need not apply)
There was absolutely nothing that Pascal could not do that "C" could, but "C" was far more egalitarian and IDIOT tolerant, ergo its popularity. C was also much less readable.
Then came the stupidest idea ever conceived since G.W.B. called Object Oriented Programming, giving rise to C++ and Delphi Object Pascal. Unfortunately, because OOP is necessary under GUI OS's such as Windows, C++ became king and Delphi still has a following amongst Pascal lovers such as my self.
The touted benefits of OOP = Code reuse, encapsulation and inheritance are greatly over-rated.
1) Code re-use is available in all languages … its called cut-paste-and-tweek.
The problem with OOP, is that in order to make computer code re-use friendly, you have to bloat its complexity. I just love searching through a 1047 layer class hiearchy in pursuit of the proverbial "beef"
2) Object inheritance: Ditto.
3) Encapsulation = PASCAL units and ADT's do this exceptionally well, with far superior rules of scope, compared to C/C++
Unlike objects which are dynamic, pascal records and ADT procedures/functions can be statically implemented
i.e. faster, more efficient and less likely to crash and burn at run time due to buffer overflows, memory corruption, leaks and fragmentation.
4) Poly morphism = no problem with PASCAL procedure/function OverLoad.
5) Sophisticated and custom data types = No problem in pascal with strong type checking, unless you specifically and deliberately re-cast it.
6) Recursion = no Problem
7) Dynamic structures, no problem, without the dangerous pointer arithmetic often abused by C
programmers.
8) Much more platform independent.
etc….
Like I said, there is absolutely nothing that Object Pascal/Delphi cannot do, that C++ can, but the Pascal code is much more likely to be stable.
—
Then came JAVA, which I call C++++++ for idiots.
And finally PYTHON ??!!!
Named after the proverbially stupid and maladjusted SULTAN of RIDICULOUS … Monty???!
—-
Python is a BASIC/LIKE Object Oriented kids' toy on steroids:
0) 100% OOP
1) Dynamically typed (only)
2) Indenting instead of {} or begin/end statements ?!
that may save a few chars, it it can really byte you
the ass later.
3) No type checking
4) Interpreted, no compiler ergo no compiler time checking.
5) No variable or type declarations !!!
6) Inefficient, slow, Buggy
Just because the code does NOT crash as often as C++ (because of internal memory management) does not mean that the program actually doing what is supposed to do in the first place.
Python, encourages the kind of mindless careless, goal oriented programming typical of teenagers without methodology or formal education. IT's great for writing phone-apps I suppose.
Now, to my horror, they are teaching this crap to my kid in first year engineering.
The ratio of IDIOTS to HUMANS is fixed, but the damage
done by IDIOTS is exponential. Since the population is increasing, we are doomed.
I agree that the current funcionality of bin() and hex() functions are quite strange and useless. But this is only a really tiny minor aspect of the language, so do not judge the entire thing based only on this. There are third party library to deals with low-level data, so bitching about that be in the python-core is just a waste of time.
About the integer division, dude, that is another minor change: now you must use // for emphatizing floor division. No need for casting! And I think is great, so that floor division is now a real operation, most consistent than have to do tricks like 5/2. to get "correct" 2.5 float answer.
I believe that programming is a really useful skill to have, like or even more than math. And to make more brain-functional human beings, is not bad at all to learn it early in life. But Python certainly isn't just about that. It was, of course, designed to be clean and easy to learn, but things evolved to something much bigger than that.
You people should realize that judging the whole language based only in one or two minor aspects its like to defaming a person based on his big nose.
I like Python; it was just a rant.
That said, Python 3 is IMO a train wreck, kind of, precisely because of wishing to "do things right" where it isn't even that clear that the new way is right.
Martin:
>The best language ever, and I really mean "Ever" was Pascal.
For 1990, it was great, yes (Delphi, too) :-)
>C was also much less readable.
Agreed. When I first saw C I thought it was some kind of a joke or historical artifact. Turns out people still use it and it's not that bad once you develop some habits in order to taper over (the many) problems of the language.
>Unlike objects which are dynamic
Objects in C++ or Delphi are not dynamic. Objects in Smalltalk, LISP, Python, Ruby, … are.
The original idea of objects was (ask Alan Kay) that an object is something you can pass a message (a string) to and it does what you told it to. That's all.
Dynamic languages actually do it that way and you can actually write a procedure that gets a string as argument which contains the message passed (this procedure "is" the object). When you write obj.foo it will call getattr(obj, "foo") automatically. When you write obj.bar it will call getattr(obj, "bar").
C++ (somewhat on purpose) didn't do that (they wanted raw performance, so there it's an integer offset, not a string) and so an object in C++ and Delphi looks like a struct with "private variables in the interface/header file" (not very private, is it?) which is the one thing it wasn't meant to be (it's supposed to be a procedure, not a struct).
About Python:
>0) 100% OOP
Yeah, and the weird struct kind, mostly. At least the REPL doesn't print the member variables when you print the object, that would have shown total ignorance.
In defense of Python, in Python 3 you can actually write dynamic objects (i.e. procedures), too.
>1) Dynamically typed (only)
> 2) Indenting instead of {} or begin/end statements ?!
that may save a few chars, it it can really byte you
the ass later.
In the uncountable years I use it indentation didn't bite me in the ass even once. This is a complaint of people who didn't try it. Seriously, you are indenting anyway, in any language. Might as well skip the braces.
(alternative: skip the indentation and keep the braces, i.e. write the entire program in one line – not good)
(redundancy is not an alternative)
> 3) No type checking
I don't know where that myth comes from. If you were in the Python REPL for 1 minute, you'd see it does type check. Python is strongly typed.
>>> 1 + "hello"
TypeError: unsupported operand type(s) for +: 'int' and 'str'
> 4) Interpreted, no compiler ergo no compiler time checking.
There are compilers (Shedskin etc) and they do check at compile time (try it, it has very annoying error messages, almost as annoying as Pascal compilers').
> 5) No variable or type declarations !!!
Thank god. What are they for?
This is really an assembler mindset. I don't care how it stores the values. Don't make me write int v = 5 like an idiot. What is 5? An integer. So what is v? Yep. No need for boilerplate stating the obvious.
That said, there are and always have been two schools of thinking and dynamic language users are just different in that they can't abide boilerplate for any reason.
If you want to write a formal proof, though, you need the boilerplate – otherwise because of Gödel's Incompleteness Theorem it's impossible to prove what your program does without running it.
(I don't know a single programmer who writes a formal proof for all his programs, though)
yosefk:
>"Kids" get the wrong answer: 3/2 should give 1 (honest-to-God integer division)
That would be wrong (as in: different from any class in school I ever had in my life).
>or it should give the ratio 3/2 (honest-to-God rational/real number division).
I agree, that would be sensible.
>Floating point is reeeaaally too complicated.
It's fine as a compromise.
>"Programmers" get the wrong answer: chunks=len(arr)/n; rem=len(arr)%n. 'nuff said.
chunks, rem = divmod(len(arr), n)
This is not C. You are allowed to have "multiple return values" (*cough*).
Otherwise chunks=len(arr)//n; rem=len(arr)%n if you want to be verbose (ugh).
>"Mathematicians" get the wrong answer: I mean, if you're doing numeric work in Python (what's the matter, can't pay for a Matlab license?),
I don't know your background but we physicists and mathematicians use Python all the time (it's in the damn curriculum of the university!). Half the push comes from us to make a computer actually compute, you know, mathematical formulae without making mistakes like 1/2 == 0 (give me a break…).
Projects like sympy (for symbolic computation) had to have weird prolog initialisation which unbreaks things like this.
So it's (partly) our fault that you were angry. Hate us :-)
Though if you are programming a computer and not doing it for maths, what exactly are you using it for?
>you probably know about integer division versus floating point division
Know, yes. If any language ever bothers me with silent truncation, it gets a black mark.
input()/input()
1
2
0
It better be kidding me…
>How am I supposed to do integer division? int(3/2)?
Yes. If you want to destroy information, state that you want to destroy information. This is not PHP.
How you are supposed to do integer division: 3//2
Also, Python has one of the nicest upgrade paths I've ever seen in any software product:
For any new feature, they wait for the next major version (it's a new major version, all bets are off) in order to make it standard.
But they introduce it in the __future__ module some years (!) before it becomes standard.
As for hex(), how did it know how many bits it should use for your two's complement in the first place? Did it guess?
I didn't even know that Python uses two's complement for storing integers (does it?).
Nitpick: typed into the Python 3 shell 3/2*2 does give the response of 3.
I think the best programming language is forth. it only has one syntax, the reverse polish notation. so no one is confused about how to code for new version. there is no need for new version anyway. it's one data type, the integer is a plus
check top [url=http://i-online-casino.org]online casino[/url] games, [url=http://ii-online-casino.com/craps-online.html]play craps[/url]]
[url=https://addvertize.com/]mobile advertising platform[/url] – mobile top ad networks, android protection
Looking for [url=http://ii-online-casino.com]irish online casinos[/url]?Check out top free [url=http://www.i-online-casino.org/]casino online[/url] bonus offers at [url=http://www.i-online-casino.org/Slotocash-Casino.html]SlotoCash[/url]
I see you don't monetize yosefk.com, don't waste your traffic, you can earn extra bucks every month.
There is one good method that brings decent money,
you can google it: money making by bucksflooder
check this top [url=http://i-online-casino.org/]best online casinos us players[/url]
[url=https://www.cialisgeneriekbelgie.nu]cialis generiek[/url]
Color your skin layer and aid minimize skin pores and relieve bad acne with a spray of rose h2o and fresh lemon juice. This can be used right after using a normal residence-created masque for more improving characteristics. Just squirt the mixture on your face and give it time to stay for half an hour, then always rinse lightly with great drinking water. This mixture must be maintained refrigerated in order to avoid spoiling and improve its stimulating attributes.
[url=https://www.cialisgeneriekbelgie.nu]cialis kopen[/url]
Home institution may be great! Ideally, this educational article assisted you are aware of several of the subtleties involved.Now you must some ideas to help you out with your determination. Start using these ways to create the finest condition for your family. Your kids will probably be grateful you have devoted some time.Reliable Internet Marketing Advice For Any Individual!
[url=https://www.cheapkamagraaustralia.nu]kamagra australia[/url]
A vital idea to take into account in terms of parenting is to make sure that you typically keep in mind how significant your young ones are and that they are some of the most critical things in this particular existence. Suggest to them your gratitude regardless how distressed or agitated you may be at them.
[url=https://www.xn--cialisnetist-rcb.nu]cialis hinta[/url]
[url=http://buycvvfullz.com]CVV shoping[/url] – buy dumps, Dumps shoping
[url=https://www.viagragenericosvizzera.nu]viagra svizzera[/url]
After you've figured out a little bit about juicing, you'll realize that you're able to make fantastic drinks without problems. Becoming a juicing specialist can make you much healthier, enable you to shed weight and provides you a lot of scrumptious beverages to enjoy. If you keep to the assistance in this post, you'll find yourself perfecting juicing, right away.Environmentally friendly Vitality Techniques And Strategies Through The Benefits
[url=https://www.viagragenerikaonline.de]Viagra generika[/url]
If you happen to drip your iphone 4 in normal water, steer clear of turning it with this could short circuit your mobile phone. You are able to free of moisture it out by carefully towel drying out it or placing it inside a Ziploc case filled with free of moisture, white-colored rice overnight. Stay away from a your hair clothes dryer on it as well, since this could cause normal water to leak deeper in the telephone.
[url=https://www.kamagrasverige.nu]kamagra gel[/url]
In the event you very own an apple ipad tablet, it is a great idea to create a back up. You may force iTunes to create a back so your information is properly protected. Check out iTunes and correct-simply click units list and select back up. You can even take advantage of the very same feature in iCloud to backup also.
[url=https://www.superkamagrabelgique.nu]kamagra belgique[/url]
[url=https://www.originalcialis.de]cialis lilly[/url]
There is no have to go through nighttime after night of loud snoring loudly from your rest partner. As we discussed out of this write-up, there are several stuff you the two is capable of doing to handle this issue.
[url=https://www.propeciaprixbelgique.nu]propecia belgique[/url]
Nutrition is actually a extensive and often exhausting subject. Nevertheless, you may make researching nutrients fun by keeping your 'lessons' small and concise. Literature like short information posts, website blurbs, and other factoids can act as guides to your nutritious requirements. When your facts result from dependable options, there is no doubt that you'll discover your new information helpful!Greatest Techniques For Choosing The Best Jewellery
[url=https://www.viagrakaufenrezeptfrei.de]viagra rezeptfrei[/url]
If you happen to request a manager in a payday loan company, make sure they are in fact a supervisor. Payday loan companies, like other organizations, often just have yet another colleague come above to be a refreshing encounter to clean across a scenario. Request when they have the power to write down up the original staff. Or even, they are possibly not just a manager, or supervisors there do not have much potential. Specifically requesting a director, is generally a better thought.
[url=https://www.propeciaprixbelgique.nu]propecia prix[/url]
[url=https://www.taxform.io/]TaxForm.io[/url]
- Utah State Tax Calculator, Idaho State Tax Calculator
I have interest in this, cheers.
[url=https://www.kamagrajellyemportugal.nu]kamagra porto[/url]
A great idea to think about in relation to growing plants is to purchase premium quality resources as opposed to less expensive ones. This is important because you by no means need to have to terminate a day or spend your time going to the retail store if you bust a shovel or realize that your hose includes a drip inside.
[url=https://www.priligybelgique.nu]priligy belgique[/url]
The stock market can often be difficult to have success in when you initially get started, so don't turn out to be frustrated in the event you don't make any earnings right away. When you initially start off you're continue to figuring information out and discovering the ropes as to ways to become successful, so maintain at it and before you realize it you'll be happy with the outcomes while you consistently spend.
[url=https://www.levitragenerikakaufen.de]levitra kaufen[/url]
Do your own personal arithmetic. The rate of caffeine to normal water you make use of is essential. Even so, not every coffee pots are alike. Pay attention to simply how much your gourmet coffee pot holds. Don't just rely on the instructions on the back of your coffee's packing. Do your personal arithmetic to find the percentage perfect.
[url=https://www.viagrapris.nu]Viagra pris[/url]
Great read to check out, glad that google led me here, Keep Up good job
Intresting, will come back here more often.
I’m impressed, I have to admit. Genuinely rarely should i encounter a weblog that’s both educative and entertaining, and let me tell you, you may have hit the nail about the head. Your idea is outstanding; the problem is an element that insufficient persons are speaking intelligently about. I am delighted we came across this during my look for something with this.
I'm gratified with the way that yosefk.com covers this sort of subject matter. Usually to the point, often controversial, always thoughtful as well as stimulating.
Hello, here from yanex, me enjoyng this, will come back soon.
Respect to website author , some wonderful entropy.
Ha, here from yahoo, this is what i was browsing for.
check this top [url=http://i-online-casino.org/]casinos online[/url] ,[url=http://ii-casino.com/bitcoin-casino.html]usa online casinos bitcoin[/url],[url=https://online-real-casino-free-play.com/casino/games-that-pay-cash-usa.html]new online casinos accepting usa[/url]
You got yourself a new rader.
Appreciate it for this howling post, I am glad I observed this internet site on yahoo.
bing took me here. Cheers!
Appreciate it for this howling post, I am glad I observed this internet site on yahoo.
I like this website its a master peace ! Glad I found this on google .
[url=https://fraud-life.cc]carder team[/url] – frauds forum, buy cc
Great read to check out, glad that duckduck took me here, Keep Up awsome job
I conceive you have mentioned some very interesting details , appreciate it for the post.
I am glad to be one of the visitors on this great website (:, appreciate it for posting .
Respect to website author , some wonderful entropy.
Respect to website author , some wonderful entropy.
very Great post, i actually like this web site, carry on it
I conceive this web site holds some real superb information for everyone : D.
Enjoyed reading through this, very good stuff, thankyou .
very interesting post, i actually like this web site, carry on it
Great stuff to check out, glad that bing took me here, Keep Up nice job
Found this on google and I’m happy I did. Well written article.
Your post has proven useful to me.
Just wanna input on few general things, The website layout is perfect, the articles is very superb : D.
I love reading through and I believe this website got some genuinely utilitarian stuff on it! .
I feel this is one of the so much vital information for me.
And i am satisfied reading your article. But wanna
commentary on few normal things, The site taste is perfect, the
articles is in point of fact excellent : D. Excellent activity, cheers
I kinda got into this article. I found it to be interesting and loaded with unique points of view.
I dugg some of you post as I thought they were very beneficial invaluable
I love reading through and I believe this website got some genuinely utilitarian stuff on it! .
I like this website its a master peace ! Glad I found this on google .
Great, yahoo took me stright here. thanks btw for this. Cheers!
Cheers, great stuff, I like.
I like the valuable info you provide in your articles.
I'll bookmark your weblog and check again here regularly.
I am quite sure I will learn plenty of new stuff right here!
Good luck for the next!
Hello! Would you mind if I share your blog with my twitter group?
There's a lot of people that I think would really appreciate
your content. Please let me know. Cheers
I am glad to be one of the visitors on this great website (:, appreciate it for posting .
Good Day, glad that i stumble on this in google. Thanks!
Hi i am kavin, its my first time to commenting anywhere, when i read this paragraph i thought
i could also make comment due to this brilliant post.
Appreciate it for this howling post, I am glad I observed this internet site on yahoo.
Hi there, You have done an incredible job. I'll certainly digg it and personally recommend to my friends.
I'm sure they will be benefited from this website.
Why people still use to read news papers when in this technological world
all is existing on web?
Thanks for finally writing about > Python: teaching kids and biting
bits don't mix < Liked it!
6/7/2019 Love yosefk.com– extremely informative and a lot of stuff to explore!
I go to see daily some web sites and websites to read articles, except this web site provides quality based articles.
Hi, this weekend is pleasant for me, for the reason that this
occasion i am reading this wonderful educational post here at my residence.
[url=https://arcticboost.net/]esea boosting[/url] – cs go boost, cs go boosting
We're a bunch of volunteers and starting a new scheme in our community.
Your web site offered us with valuable info to work on. You've done an impressive task and our entire neighborhood will be grateful to you.
Gel Kamagra Francia [url=http://viaapill.com]viagra[/url] Amoxicillin Side Effect Spasm
Hmm is anyone else having problems with the images on this
blog loading? I'm trying to find out if its a problem on my end or if
it's the blog. Any suggestions would be greatly appreciated.
I am glad to be one of the visitors on this great website (:, appreciate it for posting .
Pretty! This was an incredibly wonderful post. Thanks for providing this info.
Enjoyed reading through this, very good stuff, thankyou .
Very interesting points you have remarked, appreciate it for putting up.
stays on topic and states valid points. Thank you.
My brother recommended I might like this web site. He was entirely right.
This post actually made my day. You can not imagine simply how much time I had spent for this information!
Thanks!
Greetings from Los angeles! I'm bored to tears at work so
I decided to browse your website on my iphone during lunch
break. I love the info you present here and can't
wait to take a look when I get home. I'm shocked at how quick
your blog loaded on my mobile .. I'm not even using WIFI, just 3G ..
Anyways, great blog!
Precio De Kamagra Con Receta [url=http://zgdkdz.com]buy viagra[/url] Levitra Orosolubile Bayer Prezzo
I conceive this web site holds some real superb information for everyone : D.
bing bring me here. Cheers!
You got yourself a new rader.
I am glad to be one of the visitors on this great website (:, appreciate it for posting .
Very interesting points you have remarked, appreciate it for putting up.
This i like. Thanks!
Ha, here from bing, this is what i was searching for.
hi!,I like your writing very a lot! proportion we keep in touch extra
about your article on AOL? I require an expert on this space to solve my
problem. May be that's you! Having a look forward
to see you.
Great article to see, glad that bing took me here, Keep Up nice Work
PharmaEurope.net sеlls real legit anabolic steroids.
All tһeikr ѕtuff is authentic аnd of very high quality –
hеre yoᥙ can buy testosterone, anadrol, trenbolone, human growt hormone,
cytomeⅼ, Ꭲ3, and more without prescription
Thank You for this.
Respect to website author , some wonderful entropy.
Good way of explaining, and fastidious paragraph to get information regarding
my presentation subject matter, which i am going to present in institution of higher education.
I dugg some of you post as I thought they were very beneficial invaluable
Me enjoying, will read more. Thanks!
Very interesting points you have remarked, appreciate it for putting up.
I kinda got into this article. I found it to be interesting and loaded with unique points of interest.
Viagra Discount Sales Best Online Site For Genuine Cialis [url=http://cialicheap.com]where to buy cialis online safely[/url] Priligy Dosierung Propecia Veneno
Appreciate it for this howling post, I am glad I observed this internet site on yahoo.
Parasite backlink SEO works well :)
Enjoyed reading through this, very good stuff, thankyou .
very Great post, i actually enjoyed this web site, carry on it
I conceive you have mentioned some very interesting details , appreciate it for the post.
Hey, glad that i stumble on this in bing. Thanks!
I like this page, useful stuff on here : D.
I like this site because so much useful stuff on here : D.
I’m impressed, I have to admit. Genuinely rarely should i encounter a weblog that’s both educative and entertaining, and let me tell you, you may have hit the nail about the head. Your idea is outstanding; the problem is an element that insufficient persons are speaking intelligently about. I am delighted we came across this during my look for something with this.
stays on topic and states valid points. Thank you.
I was looking at some of your articles on this site and I believe this internet site is really instructive! Keep on posting .
Good post. I learn something new and challenging on blogs I stumbleupon everyday.
It's always interesting to read content from other authors and use a little something from other sites.
Exceptional post however I was wondering if you could write a litte more on this subject?
I'd be very thankful if you could elaborate a little bit more.
Bless you!
hey there and thank you for your info –
I have certainly picked up anything new from right here.
I did however expertise some technical issues using this
web site, as I experienced to reload the site
many times previous to I could get it to load correctly. I had been wondering if your web host is OK?
Not that I am complaining, but sluggish loading instances times will
very frequently affect your placement in google and can damage your high-quality score if ads and marketing with Adwords.
Well I'm adding this RSS to my email and can look out
for much more of your respective intriguing content. Ensure that you update this again very soon.
Alex9, this code is your next bit of info. Immediately transceive the agency at your earliest convenience. No further information until next transmission. This is broadcast #3431. Do not delete.
If you would like to grow your knowledge simply keep visiting this website and
be updated with the newest news posted here.
Have you ever thought about adding a little bit more than just your articles?
I mean, what you say is important and all. Nevertheless think about if you
added some great graphics or videos to give your posts more, "pop"!
Your content is excellent but with images and videos, this site could definitely be one of
the greatest in its niche. Terrific blog!
I am glad to be one of the visitors on this great website (:, appreciate it for posting .
This i like. Thanks!
It's not my first time to go to see this website, i am browsing this web page dailly
and get nice facts from here daily. pof natalielise
I consider something really special in this site.
Awesome! Its in fact amazing paragraph, I have got much clear idea on the topic of from this piece of writing.
Great writing to check out, glad that bing led me here, Keep Up good Work
It's truly very complex in this active life to listen news on Television, thus I simply use the web for
that purpose, and take the hottest news. natalielise pof
I've been surfing online more than three hours
today, yet I never found any interesting article like yours.
It is pretty worth enough for me. In my opinion, if all web owners
and bloggers made good content as you did, the internet will be a lot more useful than ever before.
I really got into this website. I found it to be interesting and loaded with unique points of view.
It is a high-level programming language designed to be easy to read and simple to implement. It is open-source, which means it is free to use, even for commercial applications.