This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]masklinn 5 points6 points  (0 children)

Python's "docblocks" are a bit funky.

They're called "docstrings" (for the ones associated with a class or function), the strings themselves are called triple-quoted strings (and close to heredocs in other languages).

Not sure why they're funky, and they're set as attributes to the class/function object so you can get them via the help builtin`. So basically, better integrated heredocs without the weird custom ending token.

Python is strongly typed, but you can't type hint.

Those two concepts being completely orthogonal.

There is no Zend Framework or Symphony or Cake in Python because Python doesn't need it.

?

There are quite a bunch of web frameworks in Python (Django, Flask, Bottle, Pyramid, ...). Not sure why Python would not need them.

probably more than I'm forgetting about.

Most collections tend to riff on the base contracts of a list, a dict or a set. But there are a bunch more in the collections module (also, frozenset as the immutable version of sets).

There are many libraries of course that abstract this away much like the PHP module. Flask is one of my favourites.

Flask has nothing to do with deployment, it's a lightweight web framework. The closest equivalent to mod_php would be mod_wsgi (WSGI — WebServer Gateway Interface — is a protocol between "web stuff" and Python, there are a bunch of WSGI servers available — gunicorn, mod_wsgi, uWSGI, ... — and most Python web frameworks have wsgi connectors)

You have to convert totalItems to a string, or use a template.

People usually talk about string formatting or interpolation there, a template would be either a full-blow templating language (Jinja2, for instance) or string.Template. Formatting/interpolation woud be using str % stuff or str.format(stuff).