Language Selection

English French German Italian Portuguese Spanish

Semantics of Python variable names from a C++ perspective

Filed under
HowTos

If you are going to start programming in Python and come from languages like C or C++, there are a couple of things you should know about variable names. In Python, variable names do not have the same behaviour as in C++. Part of this is clarified in the Python documentation, but I’ll try to give specific examples of things that work and don’t work as you may expect, and why.

All variables are references

Yes, that’s right. In Python, all variables are references. In C++, a reference is a type of data that behaves like a pointer but that has “normal” variable syntax. Other languages coined the name alias for this type of data. In other words:

int foo = 3;
int &bar = foo;

When creating the reference to int named bar, both foo and bar are names for the same variable or object.

Full Story.

More in Tux Machines

F2FS Feature Work For The Linux 4.11 Kernel

The Flash-Friendly File-System (F2FS) will see new features introduced with the Linux 4.11 kernel. F2FS for Linux 4.11 is making use of a separate thread for discards to avoid latency problems during checkpoints and fstrim, some prep work for open-channel SSD support, on-disk bitmaps are being introduced, and various other changes. Read more

Q4OS 1.8.3, Orion

New update of stable Q4OS 'Orion' desktop is available. Bunch of important packages updates and security patches has been delivered, as well as improvements of the native Q4OS update manager application. All the changes are available for existing Q4OS users via the automatic update process. Work on the next major version, Q4OS 2.3 'Scorpion' continues as the Debian Project also nears end of development cycle for the Debian GNU/Linux 9 'Strech' operating system, upon which Q4OS 2.3 will be based. The release date is preliminarily scheduled at about the turn of April and May 2017. Q4OS 'Scorpion' will be supported at least five years from the official release date. Read more

Games for GNU/Linux

today's howtos