mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Dylan14 (https://www.mersenneforum.org/forumdisplay.php?f=164)
-   -   Python guide comments (https://www.mersenneforum.org/showthread.php?t=24906)

Dylan14 2019-11-03 17:30

Python guide comments
 
Use this thread to post feedback/comments to the Python guide that I have created.

Nick 2019-11-04 16:11

The reasons you have given so far for using python apply to most interpreted languages.
It would be more interesting if you contrast python with other popular languages too.

chalsall 2019-11-04 16:34

[QUOTE=Nick;529625]The reasons you have given so far for using python apply to most interpreted languages. It would be more interesting if you contrast python with other popular languages too.[/QUOTE]

Indeed. There are many excellent languages out there, and it is good to know many.

Most of the more modern ones are interpreted (or JIT-compiled) because, frankly, computers have become so fast that human time is now more valuable than the computer's (wasn't the case early on). Except for rarified cases (such as George's hand-crafted assembly, running on hundreds of thousands of computers), its OK if compute is "wasted" interpreting code.

With regards to contrasting languages, that /can/ quickly degrade into (sometimes heated) language wars... :smile:

I, personally, don't like Python because it uses whitespace for code blocking. As an old-school C / Perl et al guy, I take some exception being told how I'm allowed to format my own code. That should be up to me, in my opinion.

I also disagree that Python is always "easy to read". Not always -- it depends on the author, and their use of whitespace and comments to make the code readable. Dylan has shown some excellent examples of fairly readable Python.

The truth, though, is for most people being introduced to computer programming for the first time, Python isn't the worst choice. Lots of support out there, and as Colab and Kaggle demonstrate, easily available "in the cloud".

Just to share, I know a certain university near me that is still teaching their undergraduates C as their introductory language.

Now, I love C, and serious programmers should be comfortable with it. But, as the saying goes, C has "all the power, and all the safety features, of a chainsaw"...

Even the most basic string-filtering with sorting exercise quickly gets into pointers, which then leads to the "human" dealing with memory and garbage collection, etc.

IMO, an excellent way to scare the hell out of a student...

And, if I may please lastly say, I really do encourage people to at least be also familar with Perl. It really is the "Internet's Duct-tape", used to glue software components together.

Not that difficult to read, and it does strings in its sleep.

FWTW.

Dylan14 2019-11-04 22:00

[QUOTE=Nick;529625]The reasons you have given so far for using python apply to most interpreted languages.
It would be more interesting if you contrast python with other popular languages too.[/QUOTE]


Good point Nick. I'll need to add a new post in this preliminary section to compare Python to, say, C, C++, Fortran, Java, Pari/GP (I think those are the main languages nowadays?)
Now question: how do I insert a post between posts that have already been posted, if it is possible?



[QUOTE=chalsall;529627]Indeed. There are many excellent languages out there, and it is good to know many.
[/QUOTE]


Indeed. I mentioned this in point 4 in post 2 in the guide.


[QUOTE=chalsall;529627]The truth, though, is for most people being introduced to computer programming for the first time, Python isn't the worst choice. Lots of support out there, and as Colab and Kaggle demonstrate, easily available "in the cloud".

Just to share, I know a certain university near me that is still teaching their undergraduates C as their introductory language.

Now, I love C, and serious programmers should be comfortable with it. But, as the saying goes, C has "all the power, and all the safety features, of a chainsaw"...

Even the most basic string-filtering with sorting exercise quickly gets into pointers, which then leads to the "human" dealing with memory and garbage collection, etc.[/QUOTE]


Python is not a bad choice. I like it because it's "logical" to me. Take that as you will.
And I don't deny that C is important as well. But, it can be a true pain sometimes. Especially when you have to deal with classes...
On your comment on a local university teaching C as the first language: interesting. Now at the university that I go to (University at Buffalo) for the longest time the introductory computer science course used Java as the language of choice. I can't really comment much on that since I never took that course (although I have seen a lot of students working on that). Not sure what they use now. In my education I took a course in the math department (MTH 337) with Python, and then one in computational physics (PHY 505) which used C and python.


[QUOTE=chalsall;529627]And, if I may please lastly say, I really do encourage people to at least be also familar with Perl. It really is the "Internet's Duct-tape", used to glue software components together.

Not that difficult to read, and it does strings in its sleep.
[/QUOTE]


Sounds like that would be another good guide...
But I don't think I would be the right choice to write that.

pinhodecarlos 2019-12-21 10:42

As a mechanical engineer I learnt how to code at university in several languages like fortran, Visual Basic, CNC and autolisp however I ended up not using them, more like using excel..lolI I need to get back to coding therefore Dylan can I request if you can give me a list of books about Python. If you can link them to amazon is much appreciated. My interest is on data analysis, data processing but I need to review all algorithms from scratch to revived my memories.

Dylan14 2019-12-21 16:50

@pinhodecarlos: I didn't really use books when learning Python, but if you are looking for a book, try looking at Numerical Methods in Engineering with Python 3 ([URL]https://www.amazon.com/Numerical-Methods-Engineering-Python-3/dp/1107033853[/URL]). There is also Numerical Recipes in C++ ([URL]https://www.amazon.com/Numerical-Recipes-Art-Scientific-Computing/dp/0521750334[/URL], code is in C++ but you might find some utility in translating it over to Python).

VBCurtis 2019-12-22 21:57

I'm enjoying your guide, and getting close to feeling like I could do something useful with python, such as adding functionality to the factmsieve.py script.

Thanks!

walshmergak 2020-05-11 06:00

Check this....[URL="http://net-informations.com/python/default.htm"]Python Tutorial[/URL]


All times are UTC. The time now is 23:49.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.