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

Canonical Patches Four Linux Kernel Vulnerabilities in Ubuntu 15.04 and Ubuntu 14.04

Today, July 28, Canonical published details about new Linux kernel updates for its Ubuntu 15.04 (Vivid Vervet) and Ubuntu 14.04 LTS (Trusty Tahr) operating systems, urging users to update the installations as soon as possible. Read more

Ubuntu Software Center Is Really Hated by the Community, but Why?

Ubuntu MATE recently decided to drop the Ubuntu Software Center and it will not longer be available with the upcoming 15.10 Alpha 2 release. This is interesting in itself, but this editorial is about another aspect. From the looks of it, a very large part of the Ubuntu and Linux community really hates the Ubuntu Software Center. Read more

Wine Announcement

The Wine development release 1.7.48 is now available. What's new in this release (see below for details): - Fleshed out OpenMP implementation. - I/O stream support in the MSVCIRT C++ runtime. - Support for pixel snapping in DirectWrite. - More support for OpenGL core contexts. - Various bug fixes. Read more

Canonical Closes QEMU Vulnerabilities in Ubuntu 15.04 and Ubuntu 14.04 LTS

Three QEMU vulnerabilities have been found and corrected in Ubuntu 15.04 and Ubuntu 14.04 LTS operating systems by Canonical. Read more