Skip to content

Commit

Permalink
docs: add faq
Browse files Browse the repository at this point in the history
  • Loading branch information
lazka committed Sep 22, 2016
1 parent f92edc9 commit 4a972f9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Frequently Asked Questions
==========================

.. currentmodule:: senf

Are there any existing users of Senf?
It is currently used in `Quod Libet <https://quodlibet.readthedocs.io>`__
and `mutagen <https://mutagen.readthedocs.io>`__.

Why not use bytes for paths on Python 3 + Unix?
Downsides of using str: str can not be pickled as it depends on the locale
encoding. You have to use something like `fsn2bytes` first, or you have to
make sure that the encoding doesn't change across program invocations.

Upsides of using str: str has more support in the stdlib (pathlib for
example) and it can be used in combination with the string literal
``"foo"``. The later makes ``some_fsnative + "foo"`` work for all Python
versions and platforms as long as it contains ASCII only.

Why the weird "foo2bar" function naming?
As the real types depend on the platform anything like "decode"/"encode"
is confusing. So you end up with "a_to_b" or "a_from_b". And imo having
things always go one direction, being fast to parse visually and not being
too long makes this a good choice. But ymmv.

How can it be that `fsnative()` can't fail, even with an ASCII encoding?
It falls back to utf-8 if encoding fails. Raising there would make
everything complicated and there is no good way to handle that error case
anyway.

Why not replace ``sys.stdout`` instead of providing a new :func:`print`?
No monkey patching. Allows us to do our own error handling so print will
never fail. Printing some question marks is better than a stack trace
if the target is a user.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
changelog
tutorial
api
faq

.. title:: Overview

Expand Down

0 comments on commit 4a972f9

Please sign in to comment.