DEV Community

Discussion on: I want to learn Python, where should I start?

Collapse
 
courier10pt profile image
Bob van Hoove • Edited

In addition to the tutorials that are mentioned (which may give you this same advice):

Once you've learned some basics the CLI is a great environment to experiment with the language. There a variety of ways to inspect objects, see for example this Stack Overflow post.

Here's an example:

> python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> x = [0, 1, 2]
>>> dir(x)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']

The functions that are not surrounded by __ tell you about the 'public' methods.
The ones that are indicate capabilities.

I also find the CLI very helpful when I want to write a script quickly and just verify some assumptions about the syntax.