Python 3.6 Released (python.org) 187
On Friday, more than a year after Python 3.5, core developers Elvis Pranskevichus and Yury Selivanov announced the release of version 3.6. An anonymous reader writes:
InfoWorld describes the changes as async in more places, speed and memory usage improvements, and pluggable support for JITs, tracers, and debuggers. "Python 3.6 also provides support for DTrace and SystemTap, brings a secrets module to the standard library [to generate authentication tokens], introduces new string and number formats, and adds type annotations for variables. It also gives us easier methods to customize the creation of subclasses."
You can read Slashdot's interview with Python creator Guido van Rossum from 2013. I also remember an interview this July where Perl creator Larry Wall called Python "a pretty okay first language, with a tendency towards style enforcement, monoculture, and group-think...more interested in giving you one adequate way to do something than it is in giving you a workshop that you, the programmer, get to choose the best tool from." Anyone want to share their thoughts today about the future of Python?
You can read Slashdot's interview with Python creator Guido van Rossum from 2013. I also remember an interview this July where Perl creator Larry Wall called Python "a pretty okay first language, with a tendency towards style enforcement, monoculture, and group-think...more interested in giving you one adequate way to do something than it is in giving you a workshop that you, the programmer, get to choose the best tool from." Anyone want to share their thoughts today about the future of Python?
Larry is a cunning linguist (Score:5, Interesting)
Perl is great for people who tend to be more "verbal". The total math geeks I know really prefer python, though.
It's wonderful that we have such a joyful abundance of tools to choose from in the FLOSS world, and aren't stuck running VB.net or whatever the craptastic commercial product is these days. Be maximally productive and we can all be happy for that.
Now let's work on getting these things coordinated so I can use a python module in perl6 and the ruby folks can use a perl6 module on rails. That was one of the great dreams of the perl6 project and it doesn't seem to be effective yet.
Re:Larry is a cunning linguist (Score:4, Insightful)
The total math geeks I know really prefer python, though.
That's because of the good math libraries available, it has nothing to do with the language itself. Remember R is popular among mathematicians, and from a language viewpoint, it's a crap language. Sometimes it's the right tool for the job, though.
Re: (Score:2)
R is an... interesting... language. Definitely lots of crappy points, but I think it's the closest that any language with a mainstream C-style syntax has come to being Lisp. In fact, arguably, R has exceeded Lisp in some ways - by making function arguments lazy, and making it possible to get the underlying expression if desired, it did away with the need for macros as a separate facility - it's just functions all the way.
And literally everything in R is a function call. Including things like conditionals an
Re: (Score:2)
Except that python can read almost like pseudocode
Any language can, if you write it correctly, though frankly I think it's easier in COBOL than most modern languages, including Python. So there is more to a language than that.
Speaking as a Perl nerd.. (Score:4)
That summary is pretty inflammatory. "New Python: Also, some people say Python sucks!"
What Larry sees as a virtue of Perl, the fact that it gives you myriad tools to accomplish your tasks, many see as over-complicating the matter. You can certainly do whatever you need to get done in Python (duh), but the Python folks pride themselves on giving you a good way. It's just a different approach to language design.
A (possibly) overwhelming everything-and-the-kitchen sink? Or tools crafted by experts? Personally, I love Perl, but there really doesn't need to be this counter-productive contention between the different approaches.
Re: (Score:3)
That summary is pretty inflammatory.
That was the intent... to start a religious war. Sort of like quoting the Pope as saying "Protestantism is a pretty okay primitive religion, better than being Muslim I guess"
Re: (Score:2)
Considering that the muslimes comsider Islam an more 'evolved' version of judaism and catolizism this is a pretty tough statement :)
Python: better than JS, except for JSON (Score:5, Interesting)
Python 3.5 got async, await key words and has had proper OOP for a decade, things JS is still trying to get into the language. The one downfall of python is JSON object literals aren't as easy as in JS.
If more node devs found out about Python's Tornado, they'd probably pick Tornado.
Before the apologists... (Score:2)
Before the apologists say you can use Babel, admittedly, you can, but, using such a tool is an admission of defeat. To compile something that is not true JS to something that is JS I would argue is not the original language. It's like using macros in assembly. It may seem pedantic, but pragmatically, Python runs _everywhere_ that C runs*. (Meaning your platform has a C compiler). Comparatively, using JSLint as an example, in order for JSLint to support a particular feature, it must be in two runtimes and a
Re: (Score:2)
The one downfall of python is JSON object literals aren't as easy as in JS.
Dunno I don't really like the idea of having my communication protocol interpreted as code.
Re: (Score:2)
JSON can't be a protocol. It is a data format.
On the other hand: every protocoll is code. Code that tells the 'other sode' in which state my side is, what action I expect from 'the other side' and in what state I will switch afterwards.
Considering that, you can ofc. implement/represent the messages for the protocol in JSON, and then: it is code, and no longer data.
Hint: read about a simple protocoll, e.g SMTP.
Re: (Score:2)
With json in python I am going to go:
import json
my_data = json.loads(message_contents)
do_something_with(my_data['part_of_data'])
Which is better than passing message_contents directly into my own interpreter and assuming it doesn't do something it shouldn't be doing.
Re: (Score:2)
So you don't know what your interpret is doing with JSON, even after you wrote it yourself?
And "do_something_with" is not an interpreter?
Hm ...
Re: (Score:2)
So you don't know what your interpret is doing with JSON, even after you wrote it yourself?
Its a message from Dr Evil.
And "do_something_with" is not an interpreter?
It might be print(my_data)
Re: (Score:2)
You mistake eval() for JSON.parse()
Both JS and python can eval(). Yeah, it's really stupid to eval() code. And you can do it in JS and it will usually give you an object (the times it doesn't are very interesting indeed!) But JSON.parse() is not eval. JSON.parse decodes a string into an object, which is data only.
Similarly json.loads() takes a string and converts it to a dict.
What I was getting at is really a minor quibble but it comes up a lot. var o = { this:1 that: 2} is much more friendly to write tha
Re: (Score:2)
Then in python you want a namespace object. Yes, python makes you declare a class for that, maybe not as convenient but you can do a lot more with a class than just put data in it.
Dump Python 3.x (Score:2)
Python will continue to do fine - it's readable (Score:5, Insightful)
First, I know Javascript is wildly more popular as the language that runs everywhere, but it's not what most people use when they're writing a system / glue script - though some people do, they've got a hammer.
Python's the utility / glue scripting language of choice precisely because it's READABLE - it doesn't have nine different ways to do everything like Perl does which makes it less expressive but more comprehensible and maintainable. You can definitely bang stuff out faster in Perl, but you can come back to the Python four years later and easily figure out what it's doing (just did that recently, fixed a large four year old 2.x script for new requirements and features and upgraded it to Python 3.x in a day, most of that testing), or grab someone else's Python and maintain it with reasonable effort unless they were seriously defective. Terrible programmers can write Perl in Python, and great programmers can write very maintainable code in Perl, but the language heavily skews the odds.
Remember when Ruby briefly seemed like a contender for Python? Well, it was neat, and decent enough (I used it), but it had too many perlisms (punctuation vomit syntax) which made it similarly not so readable, and then all the magpies flew away to the next hotness and I went back to Python as more maintainable - and more capable because of the strong library support. And now Ruby is just 'That language you use for Rails'.
Similarly, people like to bitch about the whitespace, but it forces readability. Perl people considered cramming 5 or more lines worth of Python on a single line a bragging point, and it was when vertical space was limited, but it's hell for readability and maintainability and we've got big monitors now. And if you have any code skills at all the whitespace is not a problem - I do Python, C#, C++, bash, Haskell, ASM, and VHDL - all wildly different, and the biggest problem is remembering how each does '# of items in a collection' (Count? count? Count()? Length? length? sizeof()?) - whitespace is not even on the radar.
A more valid complaint is that Python has relentlessly marched towards cleaning itself up even if that breaks compatibility - it is not afraid to clean up terrible mistakes it has made (usually on new features) rather than leaving them in forever for compatibility reasons like bash has to. I know that's a big sticking point - it can be jarring when old code breaks, but locking old code you don't have the time to maintain to a specific version has worked pretty well for us. Mostly that's just segregating things as 2.x or 3.x. Code we have kept up to latest version has improved as a result as the language improves.
Biggest weakness - the lack of compile time checks due to strong but dynamic typing continues to be an Achilles heel for any large project. Python (and other scripting languages) just aren't suited for that and we don't use it for that. Use something with static compile-time checking like C# or C++ - yes, after all my kvetching about readability we still use C++ for some things because nothing else fills its niche.
Re:Have they added curly braces yet? (Score:5, Insightful)
Python enforces a single form and this is its strength. It makes everyone write readable code. I know this vexes the special snowflakes but it is for the greater good.
Re: (Score:2)
What the christ does Python's "one clear way to do any given thing" philosophy have to do with using indentation to denote blocks?
Re: (Score:3)
With sufficient motivation, I can write unreadable code in any language no matter how it's indented.
Re: Have they added curly braces yet? (Score:3)
The point is that most languages don't need motivation, let alone sufficient amounts of it to do what say.
Re:Have they added curly braces yet? (Score:5, Insightful)
Enforced indentation enhances readability. Perhaps you've never run into any godawful code where the programmer decided to follow his own arbitrary indentation system.
You don't have to do everything on a single line in Python. Where'd you get that idea? You can split statements across lines just fine. Most Python programmers do so.
Re: (Score:2)
It also applies to people that think what they learned 30 years ago makes them completely competitive in a modern workforce.
You'll often find them complaining about H1Bs and ageism.
Re: (Score:2)
If you just assume that the US Government, from the highest levels on down, is absolutely determined to fragment and destroy American culture while running its economy into the ground, then the behavior of its agencies suddenly makes a lot of sense. In fact it becomes predictable.
This has been demonstrably true for the last 8 years. Come back in a few more to see if it continues.
Re: (Score:3)
Python will immediately complain about mixing tabs and space. Other languages won't, but your code just became unreadable. I know all about that because my coworkers do it constantly. I realized tabs were a bad idea 25 years, and the company I work at now is the only place I've ever worked that uses tabs, and it's been nothing but trouble, but no one wants to change anything.
Re:Have they added curly braces yet? (Score:5, Insightful)
Syntactic whitespace makes me twitch, too; but it neatly resolves many of the codestyle hubbub issues you see in other language environments.
If your editor helps you do the right thing, it's just an aesthetic whine, and shouldn't be worth arguing about.
Re: (Score:2)
Syntactic whitespace makes me twitch, too; but it neatly resolves many of the codestyle hubbub issues you see in other language environments.
Well, it could have, by being more strict, but no [stackoverflow.com].
Re: (Score:2)
Syntactic whitespace makes me twitch, too; but it neatly resolves many of the codestyle hubbub issues you see in other language environments.
If your editor helps you do the right thing, it's just an aesthetic whine, and shouldn't be worth arguing about.
...and there's my big problem with semantic whitespace: if it all comes down to needing the right editor, why bother with semantic whitespace in the first place?
Any decent code editor can match parentheses no problem at all, so why not have the editor parse the structure and handle the indentation automatically? That way everybody in the team can have the code set in the way that is most readable to them taking into account their screen size, coding style, visual impairments etc.
Re: (Score:2)
Derp!
Der took er berces!!
Derp!!!
Re:Have they added curly braces yet? (Score:5, Insightful)
Re: (Score:3)
Why are these pointless, subjective arguments over syntactic sugar still happening? Why the hell is human readable plaintext the target medium of exchange here? It's not like a this would be incompatible with plaintext; conversion both ways would be easy enough. The guy who insists on using nothing but notepad could kee
Re: (Score:2)
Re: (Score:2)
I completely agree. The K&R braces argument has always come down to the fact that people who disagree can just use an editor which shows them what they want to see. Code is a sequence of tokens so why not store it as a sequence of tokens, rather than a sequence of characters.
Re:Have they added curly braces yet? (Score:4, Insightful)
Because human readability of code is much more important than machine readability of code. With a suitable parser, the machine will be able to read the code. The art is in creating a language in which the program is obvious to many humans, not just the person who wrote it.
IMHO Python is on the right track for that. The best way to ensure all programs written in a programming language are readable by many people is to have the language enforce a uniform style, with a take-it-or-leave-it attitude. People who don't like the language-author's enforced style conventions can use another language. Programs written in the language will be reliably readable and maintainable, and that's way more important than giving freedom of artistic impression to the program writer.
Re: (Score:2)
Sorry, but there's more to readability than consistent indentation. I'm pretty sure I'm not the only one who has seen truly horrible python code. Running in production, of course.
Re: (Score:2)
Because human readability of code is much more important than machine readability of code... The art is in creating a language in which the program is obvious to many humans, not just the person who wrote it.
That's an argument for my stance, not yours. Create an intermediate layer consisting of symbols and scopes that are mostly free of ambiguity and an IDE that convert to or from that format. Presto, you get your whitespace scope delimiters and the brace people get theirs. (For maximum transparency, there's no reason why this intermediate layer couldn't be human readable as well. It would necessarily be a very explicit and even Lisp-y syntax with lots of parentheses and brackets. And whitespace would be ignore
Re: (Score:2)
Well played, TeknoHog, well played.
Re: (Score:2)
I have programmed in Perl for over 20 years... recently been learning Python and rather like the whitespace and newlines as part of the syntax... economy of expression. Also the OO syntax is less bolt on as it is in Perl and a breeze to implement and remember.
What I don't like about Python is the v2 and v3 scism....
Re: (Score:2)
Larry Wall critiquing someone else's programming language? ROFL.
Given that he blessed us with:
Pre-
Encyphered
Rune
Language
Re:Have they added curly braces yet? (Score:5, Insightful)
Most written languages do exactly that, why not Python?
It works just fine as long as you're not silly enough to use a word processor as a text editor.
And if you're sensible enough to use tabs, you can even change the spacing to suit personal preferences and visual acuity.
Re: (Score:3, Informative)
Using tabs for indentation is a mental disease. Also, PEP 8. Tabs are not Pythonic and should not be used. You're free to torture your programming language however you please, but if you expect others to respect your work, you are advised to adhere to the rules.
Re:Have they added curly braces yet? (Score:5, Insightful)
Using tabs for indentation is a mental disease.
Um, why? Tab exists solely to provide indentation.
Re: (Score:2)
They exist solely to provide invisible errors in the editor and text processing system of your choice. Tabs are nothing but a really primitive text compression system that should've died 50 years ago.
No, tabs are tabs and nothing else. "Invisible errors" come from handling indentation with spacing, in fact.
Grow up and use tabs, then set the display spacing to whatever floats your boat.
Re: (Score:2)
Tabs work great if everyone uses them consistently. Which *never* happens.
No shit. Too bad the same is true about spaces.
Re: (Score:2)
The ASCII tab _character_ is a form of text compression which was useful when disks were 20Megabytes or less.
What a moron. How many spaces a tab is supposed to "uncompress"?
You're mixing up tabulation with spacing. These are two different enough concepts that, lo and behod, we have dedicated keys for each.
Re: (Score:2)
Re:Have they added curly braces yet? (Score:4, Informative)
Have you actually read PEP 8 or are you just throwing it out there?The intro to that PEP goes to great lengths to explain that it is the preferredstyle guide for the Python Standard Library, thatother coding standards are OK, and that you should always adhere to the coding standards any given project uses. It is not some sort of dictatorial manifesto that ALL PYTHON SHOULD BE 4 SPACES.
Re: (Score:2)
"It doesn't say'tabs are OK'."
While I admire your attempt to try to steer the argument to yourlimited comprehension of PEP 8 and yourinsular viewthat tab using people are "idiots", your strawman attempt was quite awful.All one has to do is read the parent post to which you are replying to see that youmade up a fake quote and tried topass it off as something I wrote.
Go read PEP 8 again, please. It is quite clearly denoted as the style guide that should be adhered toif you are contributing to the Python Stand
Re: (Score:2)
Jesus, does anybody have to work with this guy? I've met some self righteous ass-clowns, but sheesh.
Re: (Score:2)
PEP 8 says that Guido prefers spaces. It doesn't say tabs are bad, and it certainly doesn't say they're wrong. It DOES say mixing tabs and spaces is bad, Python 3 doesn't allow it, and you're recommended to run Python 2 in such a way that it doesn't allow it either.
Re: (Score:2)
Wrong. That's not what the PEP 8 I'm reading says. As noted.
BTW, I'm nowhere near as diplomatic as Guido. IMO, anyone who uses tab characters for indentation is a moron. I also much prefer 2 spaces to 4.
Re: (Score:2)
Which PEP 8 are you reading, as you areclearly not reading the correct one. In the entirety of PEP 8 the word 'tabs' only appearsseven times. Hereis all the PEPhas to say on that subject,
Tabs or Spaces?
Spaces are the preferred indentation method.
Tabs should be used solely to remain consistent with code that is already indented with tabs.
Python 3 disallows mixing the use of tabs and spaces for indentation.
Python 2 code indented with a mixture of tabs and spaces should be converted to using spaces exclusively
Re: (Score:2)
You are the very definition of a logic failure. As you yourself just quoted, PEP 8 says "Tabs or Spaces? Spaces are the preferred indentation method." And yet you think that it means tabs are just fine.
Re: (Score:2)
Unfortunately, getting that right requires a functioning brain. fnj doesn't seem to have one.
Re: (Score:2)
That just breaks things even if you're trying to get it right.
Consider, I see well so I set tabstops at 2 chars on my editor. Except when my eyes are tired and I set it to 4. The next guy to read my code has limited vision and so he sets it to 8 chars (there are many vision problems that make it hard to tell if one letter is directly above another or not).
Re: (Score:2)
Re: (Score:2)
And if you're sensible enough to use tabs
"tabs vs spaces" is one of the oldest arguments in programming since we moved off punch cards.
And now one programmer immediately alienated half the programming world by enshrining his opinion into the programming language. Nicely done.
Re: (Score:2)
Actually, he didn't. Python accepts either one as long as you don't mix them.
Re: (Score:2)
Re: (Score:2)
Agreed, that is the proper way to use tab.
Re: (Score:2)
Re: (Score:2)
A thousand times this.
Re: (Score:2)
Another one of the enlightened. People in my lab get a look when I tell them that they will use tabs as indentation. Then they come back and thank me.
Re: (Score:2)
You realize paragraphs introduce white space, don't you?
Re: (Score:2)
Nobody cares about HO's. Best keep your personal hangups to yourself. It's like emacs vs vi. Just be happy with what you like.
Re: (Score:3)
If you don't like it, it's easy enough to fix. You can use an editor macro to "compile" your Python-with-braces to Python, and de-compile other peoples' Python to your Python-with-braces. that would correct what you see as "wrong" with the language but maintaining full access to and compatibility with the entire Python software ecosystem.
In my view the braces/whitespace thing simply isn't such a big deal. It's just a lexical convention. It's an interesting gimmick; what C programmer hasn't encountered som
Re: (Score:2)
The big deal about indentation is actually in C. :)
Or more precisely: the question where to place the { and } and how to indent them!
I think the five or six most common (which means the lesser common ones of those share perhaps 10% of all C code base) even have names!! Like K&R, Awho, etc.
The lack of {/} in Python at least relieves us from that war
My next project involves me maintaining and developing a build system in Python (github, see BoB), I'm looking forward to get my hands on it.
Re: (Score:2)
In pretty much any other language, you already indent your code to represent blocks. If you don't, it because very hard to read whether there are curly braces or not.
When I first started learning python I also had a knee jerk reaction to the indentation thing, especially because I had used fortran before and I hated it. But after writing a few lines of code, you quickly realize that the indentation is not an issue at all. I was already going through the trouble of properly indenting all my code in C
Re: (Score:2)
I agree, not an issue. Refactoring and getting the wrong indent level for last statement in "for" loop. Ouch. Many times I 've scooched the last line the wrong indent level on refactor. ha
Re: (Score:2)
My biggest issue is sometimes when tracking down a problem you want to comment out blocks of code. Easiest is an "if(0){....}", that isn't really practical with Python.
Re: (Score:2)
I think three single quotes above and below is easier than that.
Re: (Score:2)
Not if there is triple quotes inside the block you want to remove.
Re: (Score:2)
Don't get me wrong, I love Python. But IMHO using whitespace to define blocks was a stupid move. And yeah, I'm well aware of the arguments for and against for the last 15 years.
Almost 24 hours after I made my snarky first post, the discussion rages on. Sez I hit a nerve
Re: (Score:2)
Then learn how to use your source code control tool. ... easily!
Delete the offending code instead of commenting it out.
If you are forced to use a certain one and are not allowed to do single commits, install a local one of a different kind, e.g. if you use SVN you can locally use Git or even RCS just fine.
Commit your code locally. Delete the stuff you usually would uncomment, commit if you want, continue your work.
Everything can later be retrieved from the central or local repository
Re: (Score:2)
if expression: action()
- that's perfect valid python.
Yes, but in order to use that to "comment out" multiple lines of code, you've got to indent each and every line of code that you're commenting out, which defeats the purpose of the exercise.
Re: (Score:2)
I kind of thought so too, until I tried it. Now I like it. It forces you do to do something you should be doing to make the code readable, and it's something I always do anyway. It's not brain-dead, it's just different. You might not prefer it, and if not, I think that's understandable, but it's definitely not a bad idea.
Re: Have they added curly braces yet? (Score:5, Interesting)
Indentation improves readability. but the problem with using it to directly delimit logical blocks is that humans don't actually directly read whitespace, there can be something syntactically wrong with a program that is not visible to humans reading it because of a line that had a tab character in it instead of spaces, or vice versa, for example. While you can always convert tabs to spaces or vice versa in certain editors, this constrains what editing environments one should develop in, and ideally, languages should be designed to be agnostic to what features should necessarily exist in the editing environment that the programmer chooses.
And related to this, doing python development, I cannot count the number of times I have accidentally had the wrong number of spaces on a line following an indented block, and at best the python environment complains about indentation levels right away, and at worst the mistake is not realized until I find that the program is not behaving as I intended it to behave.
And while I do maintain that practical programming language should not depend on the features of the editing environment to be practical, at least it is *FEASIBLE* for an editing environment to enforce strict indentation policies when the programmer has explicitly specified where each logical block begins and ends, so the claimed advantage that python has of having whitespace be significant to the syntax of the program somehow actually improving legibility is not that important in the long run, since source code that uses explicit delimiters on blocks can easily be run through a pretty-print filter, so python mandates that programmers do something for themselves that a computer is far more capable of doing reliably and consistently. Even at best this is a waste of a programmer's time.
While the intent behind it was laudable, in practice it's just not a very good idea in a modern language. It kinda reminds me of COBOL, to be perfectly honest.
Re: (Score:2)
> because of a line that had a tab character in it instead of spaces,
This is exactly why you should configure the editor to visibly show tab characters (in colour for example) and to replace tabs with spaces. If it can't do that then get a better editor.
> Even at best this is a waste of a programmer's time.
Then don't use Python, nobody will care that you use Perl or Ruby instead.
Re: (Score:2)
Sure, but you seem to have ignored the point I was actually driving at that a modern programming language should not constrain what editing environment(s) a programmer can or should choose from. "Better" is inherently a subjective term that has no discernab
Re: (Score:2)
Re: (Score:2)
Enforced indentation in Python is great, but I have to agree: allowing the use of tabs or spaces was a horrible idea. I assume supporting spaces was a bad habit held over from C.
Re: (Score:2)
IIUC, there is a rule against mixing tabs and spaces at the beginning of lines. I think that's a syntax error. This was a problem with Python 2.?.
That said, as I always use tabs at the beginning of lines I've never encountered the error, at least not within the last couple of years. I prefer tabs over spaces because if I start getting deeply indented lines it's easy to reduce the amount of horizontal indentation without editing the lines. (Just change how the editor displays tabs.)
OTOH, I follow this ru
Re: (Score:2)
Be that as it may, it is still not possible to distinguish between them when simply looking at source code. Counting characters and telling the difference between characters that are not visibly distinguishable in how they are rendered on screen is something that a computer is good at, but humans aren't. Ironically, because most people don't ordinarily actually even *read* whitespace, the indenta
Re: (Score:2)
You don't have to distinguish between them while reading the code. Any Python 3 program that mixes the two is not a valid program, and won't even parse. So you can safely assume that whitespace "behaves" exactly how it looks, and disregard tab size issues etc.
Re: (Score:2)
Well, at the time COBOL was common, the only editor was a *I* had was a keypunch machine. But I never knew that COBOL was sensitive to indentation. Fortran was, as the first 5 columns were reserved for numeric labels, and the 6th column was reserved for a continuation marker, and columns 73-80 were reserved for non-code uses (often sequence numbers), but I never heard any rule like that for COBOL.
So back then I couldn't, and didn't, use tabs. (I *did* use special formatting cards in the keypunch...but I
Re: (Score:2)
You're right, my acquaintance with COBOL was always at a distance. I did see some code, but it was in printout, and I think I once wrote a 5 line routine, but someone else keypunched it. But I would have expected to know if it was picky about line columns. Perhaps it was a matter of which implementation was being used, or compiler options or some such. (Certainly modern Fortrans aren't picky about columns used, unless you pick certain compiler options.)
Re: (Score:2)
Indentation is visible, but the actual characters are not... ironically, the very thing that python advocates claim improves readability is, without using a custom font, invisible.
Also, the actual amount of whitespace will mean dick-all to a programmer that is visually handicapped, rather than improving any legibility, it will only amount to a whole lot of extra noise to its syntax, possibly literally as well as figuratively.
The legibility of any program written in a language that uses explicit block s
Re: (Score:2)
I cannot count the number of times I have accidentally
And I can't count the number of times I've flipped back to C from Matlab/Python and it doesn't do anything because I forgot a semi-colon.
Python's strength is in its brevity.
Re: (Score:2)
lol it does do that.
Re: (Score:2)
Any word on how Trump is going make Python great, finally? Maybe by adding curly braces?
Programming was great when we had GOTO so that's how Trump will save Python from being a LOSER and make it win, win, win until we're tired of it winning
Re: (Score:2)
I use python about once every two years when I have to patch something written in it. Same problem, especially because the function/method names make no sense whatsoever.
Re: (Score:2)
To start it would be helpful if functions were consistently verbs when that is a natural choice: in python you have "filter", which is a verb, but then you have "sorted" and "reversed", and then to add to the crazy you have sort(..., [reverse]) which, if you were heart set on using an adjective form, that parameter would be the place to actually use "reversed".
array.extend to me would imply more a memory management tweak allocating more slots. If you're appending elements "push" or "append" makes more sens
Re: (Score:2)
Why the hell is that? As a Python newbie I never know what to install and configure a new project in. I start with say v3 only to find that some module or framework I need down the road isn't available in 3 or visa versa. Really annoying.
Because Programmers Make Bad Decisions (Score:2, Informative)
The language changed for virtually no reason/benefit in Python 3 and they broke backward compatibility. Worst of all, no automated means of reliably porting 2.7 code to 3 was provided, and even today, there is no reliable means.
Developers stuck with 2.7 to maintain compatibility and then continued further development in 2.7. Thus creating an even larger body of work that doesn't run under Python 3.
It was a massively stupid decision. But, I expect nothing less from those that build a language whose code can
Re: (Score:2)
The language changed for one big reason, that being making strings work properly - i.e. without magic encoding and decoding, silently losing characters or worse. This was a much needed change for anyone except for those assholes who 1) use a language for which ASCII is good enough, and 2) don't care about anyone else, and don't care if their code breaks on non-ASCII locales.
Unfortunately, it was also a breaking change, but there was no way around it. And since they already had one breaking change, they figu
Re: (Score:2)
Sorry, no. They broke strings entirely in Python 3.0 and that is why people cannot port to them.
Here is how to do strings correctly: use UTF-8 and DO NOT BARF ON ENCODING ERRORS!
It is absolutely 100% a requirement that a program be able to read a random byte stream into a "string", then write it out again, and get the same byte stream.
In Python 2.0 this only barfed if you tried to convert that string to "Unicode" (it would have been nice if it did not barf, but at least you could store, read, and write stri
Re: (Score:2)
Here is how to do strings correctly: use UTF-8 and DO NOT BARF ON ENCODING ERRORS!
Let's just say that this is your opinion, and that it is not shared by the majority of developers out there. Which is why most mainstream languages today do not use this model (and some of them did, but migrated from it).
The simple reason why it's impractical is that many important platforms (Windows, OS X) don't use UTF-8 to encode Unicode for most of their stuff - so you need to re-encode, and for that you need valid UTF-8 input anyway. On top of that, it's pretty common to have non-Unicode file contents,
Re: (Score:2)
Because large-scale infrastructure resists change by sheer inertia. It's the same reason the US hasn't gone metric. Even if the "new" is arguably better, no one likes to fix problems caused by deliberately designed incompatibility.
One of the great strengths of C++ is that nearly any ancient code from decades ago can still compile today on a C++14-compliant compiler. The language committee went to great lengths to avoid making incompatible changes over the years. When there are billions of lines of C++ c
Re: (Score:2)
I use python3 as well but there is a lot of important stuff out there which doesn't, like google oauth libraries.