I was rewatching Star Wars recently (kids are now interested) and it reminded me of (tenuous link warning!) when I decided to explore __copy__() in Python and dive a bit deeper

Anyway, here’s the article for those interested - note the image with Lego storm troopers has been there since I published this article!

thepythoncodingbook.com/2022/0

Some more tree behaviours.

Clicking a node to move the cursor now works.

Labels can now have a 'icon' used to show expand state. You call set allow_expand=False for leaf nodes.

This core functionality will for the base of a tree control to browse a directory.

A (lengthy) Mastodon #introduction.

I'm Thomas, a Python Core Developer and Googler from Amsterdam (NL). I'm on the Python Steering Council and the #PSF Board of Directors, and I'm the 3.12/3.13 Release Manager. I hang out on #python on libera (IRC) as well. I also have #cats (#Savannah and #Bengal).

I usually toot/boost about #python, especially #governance and non-profit support of #python. A little thread with examples (and cat pictures at the end)👇

Why is Python the ideal language for beginners to learn?

Let's look at the main reasons:

• It's more accessible for a beginner, allowing you to focus on programming concepts and not language detail. Too many give up coding early on–Python makes this less likely

• It's very powerful–which means you can write any program you'll need and it scales well as you deal with more complex programs and larger data sets

• It's very broad–it has applications in very many fields and not just a narrow scope. It also has libraries for very many fields!

• As it's very popular, it has a large user-base which is very helpful, so you'll find a lot of resources (not just mine!) and a lot of help from the community

• It's a language that's still improving and progressing rapidly. Latest speed improvements is just one example

--

The main thing you're learning is programming, and not a programming language. The language itself is "just" a tool, but you don't want the tool to get in the way of learning, as would happen with some other languages.

Once you become proficient in programming in one language, it's easier to switch to/learn other languages

So my advice is, yes, start with Python and stick with it until you feel you're very proficient. If and when you need other languages, they'll be easier to learn then…

Thinking about where to set up the Teaching Python podcast on Mastodon. Any servers focused on education?

Hello everybody,

This is the page of the pandas project. There's a chance we may migrate to a purpose-built Scientific Python instance later, but for now we're here

Follow for news on releases, meetings, and on how to contribute!

#introduction

Duck typing for #Python programmers is like air for humans or water for fish. It's so ubiquitous that it's sometimes hard to identify.

pym.dev/duck-typing

When overloading binary operators in #Python, also remember to implement right-hand methods (e.g. __radd__) for your operations where appropriate (float needs this one for extending int also):

>>> x + y
4.0
NotImplemented
4.0

A while ago, my son asked me how to draw using the two-point perspective technique…

“I haven’t got the slightest idea”, was my honest answer (kids need to know we don’t know everything, after all)

Could have left it at that. Instead we went on YouTube, one thing led to another, and…

…anyway, here’s the answer, using a program which uses Python’s turtle

thepythoncodingbook.com/2022/0

Hi everyone! I'm Marlene and here's my introductory toot❤️ 👋🏾

I'm software engineer and Pythonista, currently working remotely for Voltron Data. I was on the board of the PSF and just joined as the vice chair of the ACM Practitioner board. I'm also an organizer for PyCon Africa 🌍

I love computers, open source and learning. I'm also a big fan of creating coding and experiment with AI and ML a lot! I'd love to connect with other #python people here❤️ ✨

Implemented scroll tracking the cursor.

Also added a hover effect that highlights the sub-tree under the cursor.

What do you think?

How often have you used the function range() in Python? It’s often something you use early on as you learn about the for loop…

But… did you know it’s not really a function, after all?!

Have a look at the docs or use help() to check…

range is a class. And therefore range() creates an instance of the class as is always the case with a class.

So, my question is: “Does it matter?”

Technically, it does. A function is not a class – they’re different things

But in practice, what matters is how it behaves and not what it is!

This is a key principle in Python when thinking about data types. What they do and how they behave matters more that what they are!

So you can use range() like a function, even though it’s not!

When you learn to code, in Python or other languages,, you start by learning about the tools you’ll need and the rules for each one of those tools. You learn the syntax of the for loop and what it does, for example. With time, you also learn when to use this tool and when not to use it.

What’s more challenging in the early and not-so-early days when you learn Python coding is to join the dots between the various topics you learn and to view them as a coherent set of tools all working together.

Making the transition from knowing how to use lots of separate programming tools to seeing those tools as aspects of the same story is one of the rites of passage to move from beginner to intermediate, whichever way you define beginner and intermediate.

What has helped me get this type of understanding is good analogies. Here’s the one that works for me:

thepythoncodingbook.com/2021/0

Just started reading this bad boy! Turns out there are tons of stuff I didn’t know about #pytest .

Great job @brianokken.

I wrote some #python code today to integrate Mastodon into my stream deck. Now we can announce new @talkpython and @pythonbytes episode in the click of a button, see image.

You've possible heard the quote which says that "Debugging is like being the detective in a crime movie where you are also the murderer”

A while ago, I decided to take this quote a bit more literally, but no, not "fully literally" (if you know what I mean - I didn't commit any crimes, just to be clear!)

–> Debugging Python Code Is Like Detective Work — Let’s Investigate

thepythoncodingbook.com/2022/0

@hynek suspicion correct. This is an issue - same with markdown which I can use here but most servers will strip out. As a poster you cannot guarantee how your post will be viewed across the network. But I guess that’s just the way it is

This is a QT (although I suspect only those on qoto server will see it as such?
@hynek

Hynek Schlawack
Since being wrong in public is fun, here’s predictions re tech criticism towards Mastodon: perf: top ops/sre folks are making it work. #skinInThe...

Here’s a “from-the-archives” post

I’ve been recently having more and more conversations – some privately and some publicly – on using the turtle module for more than just drawing circles and patterns!

Some of you may know this is one of my favourite topics – in this example, we’re using it to visualise how sines and cosines are linked to the motion in a circle

How many children (and adults) learn about sines and cosines but don’t know what they really are?

thepythoncodingbook.com/2022/0

Are you comfortable with the difference between positional arguments and keyword (or named) arguments when calling a Python function?

And which order to use them in?

Here’s the second article in the Intermediate Python Function series, hot off the press, so to speak

thepythoncodingbook.com/2022/1