zerovm / zerocloud

Swift middleware for Zerocloud
Apache License 2.0
53 stars 14 forks source link

zerocloud, all modules: one import per line #156

Closed larsbutler closed 9 years ago

larsbutler commented 9 years ago

Instead of using commas and backslashes for line continuation, having just one import per line improves readability.

It's also easier to edit imports this way; you can just add or remove lines. When changes like this are made, the diffs are more readable as well.

pkit commented 9 years ago

Hmm, Swift uses commas, the import style was stolen from there. I have no strong opinion though, but would like to hear somebody who did a lot of python, regarding this one.

mgeisler commented 9 years ago

I don't think I've seen an "import one symbol per line" style in the wild before, probably because people prefer importing the entire module when they find that they need more than one or two symbols from it.

Infact, the style guides I know all recommend importing modules instead of classes/functions. That simplifies the import statements a lot.

pkit commented 9 years ago

I simplifies import statements but complicates the code. You need to use module.func instead of func which is too long in the current situation of descriptive module and function names.

larsbutler commented 9 years ago

I'm not trying to alter the import conventions drastically. All this does is split multi-item imports to separate lines. That's it. For me, this is a lot easier to read and edit.

Hmm, Swift uses commas, the import style was stolen from there.

Yeah, and they're also breaking their own style guidelines by doing that. =)

pkit commented 9 years ago

It's an Openstack style guide. I consider Openstack code a horrible mess, compared to Swift code. So... I suppose we do not need to drag it too much, I have no objection to reorganizing imports this way.