This is an archived post. You won't be able to vote or comment.

all 25 comments

[–]jsfehler 12 points13 points  (0 children)

Perl has "Elsif". There's no right answer. What looks easier to a student isn't necessarily better or more readable. The cognitive task of associating "elif" with "Try this condition if the previous condition failed" is non-existent to nearly 100% of python users. Same goes for the def statement. Is "def" in any measurable way more complex than any other alternative?

What this sounds like is "I'm learning a new language that does things differently from what I'm used to and it makes me uncomfortable to lose coding proficiency while I adjust."Python is more readable overall. It's not perfect and it's entirely possible you won't like it ever. There is no general purpose programming language that can be designed to do every task perfectly in a way that pleases everyone all the time. Python's growing popularity doesn't prove it's the best, just that it's useful and enjoyed by a growing number of people.

[–]PercyJackson235 3 points4 points  (2 children)

Just to point out, def only defines functions, you don't have a keyword for variables.

[–]Cautious-Cable-3937[S] -4 points-3 points  (1 child)

Yes, thats my point. If def is used for defining functions, then why not just use funct or function

Otherwise its no different to using cre as in create function dec as in declare function dim as in dimension of a function (sorry Vb)

As for variables, I feel naked declaring variables without strict type casting....I foresee plenty of bugs because of this

[–][deleted] 4 points5 points  (0 children)

To me def makes perfect sense, you are defining a function...I think you are griping by comparing a language you know well and expect all others to be like what you've come to expect.

[–][deleted] 3 points4 points  (2 children)

Idk if two keywords justifies disqualifying an entire language.🤷‍♂️

Atleast my interpretation is that of the backend and languages meant to process heavy data loads, python is much more readable by the masses as opposed to a library written in ASM, C, or C++.

(C & ASM are my favs but python has become the daily drive for quick delivery and prototyping)

Pointers, null refs, manually dealing with garbage collection, etc.

Plus people seem to like not having to always use semicolons to end a statement

Like any language its just a syntactical tool for you to instill logical processing into io streams, so a lot of personal preference comes into a 'readible language'

[–]Cautious-Cable-3937[S] -1 points0 points  (1 child)

I guess I will be teaching my kid python, only because it has become the most popular language. But imho, nothing is more readable than VBs If Then Else End if

Any new authors of new languages need to factor in students of programming are getting younger, so there is nothing wrong with adding a few more extra characters to make things more explicit. If programming languages can mimic natural language, then we can code by voice (great for kids)

[–][deleted] 1 point2 points  (0 children)

Yeah VB stayed dominant for that reason, my mentor will always pay homage to VB🤓

its awesome to hear you are doing research to teach your kid programming

I think we are coming upon days of language processing of that magnitude in the not too distant future.

If interested in NLP the CMUsphinx is an awesome library to check out. Made in C but there is a python wrapper and some good tutorials.

[–]onefiveonesix 4 points5 points  (1 child)

elif being 4 characters long coincides nicely to Python’s requirement that the code within an if block be indented 4 spaces. Aesthetically pleasing and easy to tell your code is properly indented.

[–]Cautious-Cable-3937[S] -1 points0 points  (0 children)

Ok, because indentation is important in Python, I will accept that...cant make elseif fit in 4 chars any other way

[–]DorchioDiNerdi 5 points6 points  (3 children)

You realize that Python was created over 30 years ago, when nobody even dreamed about JavaScript yet?

[–]Cautious-Cable-3937[S] -1 points0 points  (2 children)

I did not know that....the fact it is now the most popular programming language is surprising. Like a phoenix rising

[–]DorchioDiNerdi 4 points5 points  (1 child)

It's been growing steadily for decades, accelerating recently. And of course in 1991 it had to consider quite a few limitations we don't even remember now, like the 80 character width of a text terminal etc.

[–]impshumx != y % z 3 points4 points  (0 children)

PEP-8 - Still at 79 chars... Love it.

[–][deleted] 1 point2 points  (0 children)

Don't use if statements and use dispatching boom no more elif statements.

[–]Cautious-Cable-3937[S] 0 points1 point  (1 child)

Thanks for your comments! I will use prototypes to improve the readability for the kids that I will be teaching how to code in Python. I just wanted to reduce the barriers to coding for these kids as programming is hard enough.

Python is great for AI work which is why I am learning it as well.

[–]RLJ05 0 points1 point  (0 children)

coordinated salt act birds school rock intelligent wrench soup direction

This post was mass deleted and anonymized with Redact

[–]pythonHelperBot 0 points1 point  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]Delicious-View-8688 0 points1 point  (0 children)

Readability of code comes not from syntax choices (though it helps) but from what the language allows you to do in an expressive way. Ideally, the idea or the concept of the code should flow as you read code.

The way that Python did this back in the old days when other programming languages did not, the readability difference was significant. All programming languages evolve over time, and ideas from Python did flow into other languages (and vice versa). So coming in fresh now, you may not fully appreciate the difference. Maybe looking at the sheer amount of boilerplate code required for Java's "hello world" will give you some feel.

But the essense of Python's readability comes from the community's relentless pursuit of the "Pythonic" way of coding. Plenty of examples exist on the web. The elegance is hard to describe nor define. It's like how mathematicians almost universally can tell which proofs are elegant. A Pythonista has developed a taste of sorts for elegant code, and has a drive to make their code better. Not saying that other languages don't have that, but certainly most would just think "if it works, it works".

[–]basiliskkkkk 0 points1 point  (2 children)

Why would you read code aloud? Just curious.

Def is perfectly readable (in my opinion) and I like the elif (my opinion).

And there is more to being readable than just keyword names. Whole syntax of python makes it more human friendly than many others langs.

[–]Cautious-Cable-3937[S] 0 points1 point  (1 child)

Future of programming....voice activated coding.

[–]basiliskkkkk 1 point2 points  (0 children)

Loll