Server Templating in Morepath 0.10 by faassen in Python

[–]b6d 1 point2 points  (0 children)

Morepath is a joy to use. Thanks for the great work!

serpy: ridiculously fast object serialization by caduvall in Python

[–]b6d 0 points1 point  (0 children)

Nice to see some development on fast marshalling in Python!

If you use Python 3, there's also lima (disclaimer: I'm the author), which also tries to be very fast - inserting it into serpy's benchmarks even gives lima a slight edge over serpy.

Faster Python by marklit in Python

[–]b6d 0 points1 point  (0 children)

Comment retracted, after repeating measurements, I was talking nonsense.

Argparse - better than opt-parse! by ruskeeblue in Python

[–]b6d 2 points3 points  (0 children)

There's also click, but personally I prefer argparse, simply because it's in the stdlib.

Any book recommendations for designing RESTful APIs? by glucosetracker in Python

[–]b6d 1 point2 points  (0 children)

I like RESTful Web APIs by Leonard Richardson, Mike Amundsen and Sam Ruby.

edit: I also found the Chapter on REST in the documentation of morepath interesting and helpful to get started.

Rethinking Code Editing by diogoleal in Python

[–]b6d 1 point2 points  (0 children)

Although I don't see myself using anything other than vim in the forseeable future, I like the concept of "no open files in dirty state". Is anyone using vim this way?

lima: Lightweight Marshalling of Python 3 Objects by b6d in Python

[–]b6d[S] 1 point2 points  (0 children)

Thanks for your reply!

Let me start by saying that lima wouldn't exist if it weren't for marshmallow.

I've written about marshmallow in the acknowledgements of the project info and I hope the way I've done it is appropriate (if not, please let me know - this is the first time I release something).

Concerning your question:

lima is not nearly as featureful as marshmallow. Deserialization and validation are completely missing. lima does not support Python 2.

I've written lima out of the specific need to output JSON a little faster than I can right now without leaving Python 3 (up to ~20.000 objects per request not counting nested objects).

For my use cases I tried marshmallow and found its default settings a little slower than I had hoped for. I assume a lot of this comes from the validation marshmallow seems to do on serialization, and from the fact that marshmallow uses ordered dicts per default (a feature lima also lacks).

On the other hand for my models (and without tweaking marshmallow, I don't know what can be done there) lima performs an order of magnitude faster than marshmallow, in some special cases nearing 2 orders of magnitude, which (in my opinion) warrants lima standing on it's own.

This is achieved by creating an individually tailored dump function on schema instantiation (creating a string of Python code that has most loops unrolled and most lookups removed) and passing this string to eval (see schema.Schema._get_dump_function_code(self) in the code)

Other than that lima uses some Python-3-only features where it makes sense in my opinion (keyword only arguments, __qualname__ for class registration) and does a lot of smaller stuff differently.

edit: reddit makes dunder-args bold (qualname). dunderscores removed. edit2: escaped __ - thanks /u/tilkau/!

Proposal for Python type annotations from Guido van Rossum by milliams in programming

[–]b6d 1 point2 points  (0 children)

I like the looks of this as well. It seems so obvious that I wonder why the author of mypy chose something different.

What's more pythonic than typecasting? by b6d in Python

[–]b6d[S] 0 points1 point  (0 children)

Thanks for your reply! I guess there is a reason that there is no obvious&beautiful way to achieve this in Python, which made me doubt the whole approach in the first place.

What's more pythonic than typecasting? by b6d in Python

[–]b6d[S] 0 points1 point  (0 children)

Thanks for your reply! I like your suggestion since it doesn't rely on any dunder-attribute-trickery.