mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Blogorrhea > Dylan14

Reply
 
Thread Tools
Old 2019-11-03, 17:30   #1
Dylan14
 
Dylan14's Avatar
 
"Dylan"
Mar 2017

7608 Posts
Default Python guide comments

Use this thread to post feedback/comments to the Python guide that I have created.
Dylan14 is offline   Reply With Quote
Old 2019-11-04, 16:11   #2
Nick
 
Nick's Avatar
 
Dec 2012
The Netherlands

3×11×43 Posts
Default

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.
Nick is offline   Reply With Quote
Old 2019-11-04, 16:34   #3
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

216358 Posts
Default

Quote:
Originally Posted by Nick View Post
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.
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...

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.
chalsall is online now   Reply With Quote
Old 2019-11-04, 22:00   #4
Dylan14
 
Dylan14's Avatar
 
"Dylan"
Mar 2017

1F016 Posts
Default

Quote:
Originally Posted by Nick View Post
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.

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:
Originally Posted by chalsall View Post
Indeed. There are many excellent languages out there, and it is good to know many.

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


Quote:
Originally Posted by chalsall View Post
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.

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:
Originally Posted by chalsall View Post
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.

Sounds like that would be another good guide...
But I don't think I would be the right choice to write that.
Dylan14 is offline   Reply With Quote
Old 2019-12-21, 10:42   #5
pinhodecarlos
 
pinhodecarlos's Avatar
 
"Carlos Pinho"
Oct 2011
Milton Keynes, UK

110208 Posts
Default

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.
pinhodecarlos is online now   Reply With Quote
Old 2019-12-21, 16:50   #6
Dylan14
 
Dylan14's Avatar
 
"Dylan"
Mar 2017

24×31 Posts
Default

@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 (https://www.amazon.com/Numerical-Met.../dp/1107033853). There is also Numerical Recipes in C++ (https://www.amazon.com/Numerical-Rec.../dp/0521750334, code is in C++ but you might find some utility in translating it over to Python).
Dylan14 is offline   Reply With Quote
Old 2019-12-22, 21:57   #7
VBCurtis
 
VBCurtis's Avatar
 
"Curtis"
Feb 2005
Riverside, CA

19×223 Posts
Default

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!
VBCurtis is online now   Reply With Quote
Old 2020-05-11, 06:00   #8
walshmergak
 
May 2020

1 Posts
Default

Check this....Python Tutorial
walshmergak is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Guide for Python Dylan14 Dylan14 18 2020-07-19 21:46
Request for comments ET_ FermatSearch 5 2016-07-03 10:58
No Comments? R.D. Silverman GMP-ECM 11 2013-06-29 20:34
How do you look at previous comments on Youtube? jasong jasong 0 2012-08-19 20:02
low-value comments cleared out of FFT thread Maximus Math 15 2011-11-08 19:38

All times are UTC. The time now is 19:42.

Wed Aug 5 19:42:09 UTC 2020 up 19 days, 15:28, 2 users, load averages: 1.29, 1.61, 1.67

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.