r/PythonLearning • • Jan 10 '25

Getting back into it after 20 years

Post image

I picked up Python VERY briefly back in college to modify custom windows and automate various actions in "Alias/Autodesk" Maya 20 years ago and remember it being fairly easy to do. I was recently asked to help a friend with a project involving Python because I'd once mentioned I've used it and I instantly realized I have no clue what I'm doing outside of Maya lol. Dug through my text book collection and found this, been going through it and taking notes. (Can't remember when I got it or why....) Seems fairly useful. Am I learning out of date information?

225 Upvotes

31 comments sorted by

5

u/FoolsSeldom Jan 10 '25

The foundations haven't changed much, even in the move from Python 2 to Python 3, but there have been a lot of enhancements and some significant additions.

For example, from Python 2 to 3,

  • input was dropped in favour of raw_input which was renamed to input

  • print became a function

  • / is now used for floating division and // for integer division

  • exception handling syntax changed

  • Unicode is now used for all strings by default

  • range now returns an iterable object rather than a list, xrange no longer used

  • no variable leakage from comprehensions, and they've become more flexible

  • new iteration tools added

  • lots of performance improvements, bug fixes

  • PEP8 guidance now widely followed

In Python 3's evolution, there have been many changes,

  • string iterpolation, f-strings, for example, so print("name: {}".format(user_name) becomes `print(f"name: {user_name}") and complex and nested expressions can be used

  • async and wait for parallel working

  • removal of GIL if desired

  • preserved insertion order for dictionaries

  • dataclasses - saves a lot of boilerplate code

  • assignment expressions with the := operator, so can assign an object to be referenced by a variable within an expression, e.g. while (i := j * 2) < k: compares j * 2 with k but also assigns the result of j * 2 to i

  • positional only params

  • additional string methods

  • many enhnacements to annotations and type hints

  • structural pattern matching (match, case)

  • unpacking allowed in for statements

1

u/crashsculpts Jan 10 '25

That feels like a LOT! I only really understand half of that but I'll certainly bookmark this to reference when I run into related material in the book. The author of this book seems to be using Python 3 (2010) but my memories of it all are certainly from an earlier version. Good to know what's changed!

1

u/cgoldberg Jan 10 '25

Python 3 shipped in 2008 but nobody was really using it in 2010. I doubt the book uses Python 3. You should just order a better and more modern book to learn from.

2

u/crashsculpts Jan 10 '25

It says in the first few pages to make sure python3 is installed.

2

u/cgoldberg Jan 10 '25

I'd still get a better and more modern book.

1

u/crashsculpts Jan 10 '25

For reference, I'm a 3d modeler/ animator for games and primarily used Python to create custom windows in Maya. Have never really done much more coding than that (unless you count basic html, CSS, and a bit of "Linden Scripting Language" lol)

1

u/FoolsSeldom Jan 10 '25

Ah, you probably need to go back to basics in that case. Lots of learning guidance in the wiki for the learnpython subreddit.

Are you also a big Blender user? That seems very popular for modelling and animation these days and producing video fx etc as well as 2d/anime content. Python is very popular tool with Blender.

1

u/crashsculpts Jan 10 '25

I tried Blender when it FIRST came out and it was so horrifyingly bad that I've been scared away from it all these years lol. I tell new modelers to use it all the time though! I'm just too entrenched in Maya after over 20 years that I can't afford the time/sacrifice to speed to make the switch just yet. They've done great stuff with the software over the years though! I CAN use it in an emergency but I'm magnitudes more productive in Maya.

2

u/OrangeJuiceIsGood4u Jan 10 '25

Best of luck ;)

1

u/crashsculpts Jan 10 '25

Inside cover says 2010, not too outdated?

2

u/[deleted] Jan 10 '25

[removed] — view removed comment

1

u/crashsculpts Jan 10 '25

I have a day job where I can have a book out but reading documentation on a website or phone doesn't go over very well so I can't even run IDLE to test code. (Lobby security) I need a bit of extra handholding as well that I don't think the standard documentation will have. This book feels like a classroom.

1

u/Far-Upstairs8318 Jan 10 '25

Python for dummies may be at your local library wish I could send you the pdf!

1

u/Ill-Car-769 Jan 10 '25

Python has been included with new features in recent times so try to learn from YT & keep the book & ChatGPT as an instant guide.

I can't even run IDLE to test code. (Lobby security) I need a bit of extra handholding as well

You can use code editor either VS Code or Py charm to boost your productivity.

2

u/SobekIMF Jan 10 '25

I am back in the game after 33 years of leaving it... imagine I was a Fortran Program, but I find python is the closest to Fortran...

1

u/crashsculpts Jan 11 '25

I'm only 40! The earliest "coding" I ever played with was on a commodore 64 and that was just typing in instruction to get a game to run lol.

1

u/WoodyTheWorker Jan 11 '25

Closest perhaps in ease to use, but otherwise it's as far as it can be.

Years ago there was a list who's a "real programmer" (tongue in cheek). One line was "A real programmer can write FORTRAN in any language". Try not to write FORTRAN in Python. I worked with a guy who did just that - used globals without even thinking. It was terrible.

2

u/[deleted] Jan 11 '25

The question is: are you having fun?

1

u/crashsculpts Jan 11 '25

The classroom style instruction of this book is pretty easy to read through. Looking forward to having time to actually code and not just read/take notes.

2

u/twopi Jan 11 '25

I was the series editor for that book! I wrote several books in that series, and I worked with Michael on the first edition if that book. (I wrote a python book for a different series about that time, so I didn't do that one.)

It's still a decent book, but python has changed a lot, for the better.

1

u/crashsculpts Jan 11 '25

Very cool! Didn't occur to me I'd run into anyone who worked on it. I figured at the very least I'd gain a decent start if I read through this. I don't have much time lately to actually type/test code, so I needed a book that wasn't too reliant on having access to a computer. I'm enjoying the way it's written, the graphic design is well done. I've read some books recently that rapidly became step by step technical manuals and didn't have much classroom style instruction. I've been hand writing the code examples in my notebook to try and get more used to it.

1

u/crashsculpts Jan 11 '25

Would you say this book is too outdated to be learning Python with?

2

u/twopi Jan 11 '25

I don't remember off the top of my head which version of Python that edition was using, but I'd definitely recommend you use a book that covers python 3.8 or later. If it's any form of Python 2, it's frustratingly out of date (the print and input statements both changed, and they're pretty important in a beginner book.) If it's any form of Python3, it's probably fine, but the later versions of Python have some very nice features (f-strings, simplified debugging) that were not in earlier versions.

I do like the style of that book (as I helped to create the series) Every chapter starts by introducing a simple example (often a game), teaches some new skills to get to that game, and then goes back to that game and shows how the new skills are added to previously learned skills to build the game.

I have stopped writing for now (doing youtube instead) so DM me and I can send you stuff from my own classes, that are a bit more up-to-date.

1

u/crashsculpts Jan 12 '25

So cool! And yeah it says I need python3 installed. I'm actually getting excited to finally learn programming again, I've made weak attempts every so often since I was a kid in the 90's messing around with my dad's commodore 64....I tried my hand at "Linden Scripting Language"for a few years and did ok kinda.... mostly just assigning attributes to game objects or pointing to an external library etc....so I THINK once I get past the "tutorial" stage I should be able get moving pretty good.

I'd love to check out your channel!

1

u/Select-Yard-6769 Jan 11 '25

Buena madrugada, alguna persona que me pueda ayudar, se que está mal lo que quiero hacer pero necesito tener pruebas

2

u/Select-Yard-6769 Jan 12 '25

I understand and I appreciate the clarification, I'm just new to this.