[Sugar-devel] [PATCH Help v3] Migrated to Gtk3 and WebKit.WebView SL #3466

Martin Dengler martin at martindengler.com
Wed Apr 25 21:05:03 EDT 2012


On Wed, Apr 25, 2012 at 03:15:22PM -0300, Manuel Quiñones wrote:
> El día 25 de abril de 2012 12:43, Manuel Kaufmann <humitos at gmail.com> escribió:
> > 2012/4/25 Manuel Quiñones <manuq at laptop.org>:
> >> Both forms pass PEP8, but we use one import per line in Sugar.  Is a
> >> matter of style, that's all.
> >
> > Do you have the reasons of this decision? (link to a discussion or
> > something like that)
> 
> Main reason: consistency (as already said).

Another reason: readability of the import list.  If you're pulling a
binding in with a "from" import, you are gaining readability of the
code at the cost of tracability of the name bindings.  This makes it
easier to forget where that binding came from.  Putting the "from x
import y" imports separate to the "import x" highlights to the reader
that they need to remember where that name came from when they read
the code, and putting all the "from" imports on one line diminishes
this effect.

Given the code already did one from import per line and most of Sugar
is written this way (or to avoid "from" imports, as usual with python
code), I see even less reason to change it than to do multiple "from"
imports in the first place.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120426/c98b903a/attachment.pgp>


More information about the Sugar-devel mailing list