proj-plbook-plChPythonLang

Table of Contents for Programming Languages: a survey

Python

Because it is so well-known and well-liked, Python gets its own chapter.

Pros:

Cons:

Features:

Tours and tutorials:

Best practices and style guides:

Respected exemplar code:

Gotchas:

Popularity:

Retrospectives:

Tools:

Opinions:

Python Opinionated comparisons

    class Foo:
      def __init__(self, *args, **kwargs):
        self.__dict__.update(**kwargs)

And it will automatically assign any keyword arguments you use as attributes to the object. For example `foo = Foo(name='Bob', age=99)`. If you still want to keep a strict list of allowed attributes, you can define them as parameters, and use a shortcut to assign all local variables to attributes.

    class Foo:
      def __init__(self, name, age):
        self.__dict__.update(locals())
        del self.self" [45]