kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #16265
Re: more pythonic scripting API for pcbnew
I have to stop responding to this thread, but it's official Python policy
that spaces are preferred over tabs, and has been for a while.
https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces
In other news, is anyone else from the KiCad community going to Pycon this
year?
Adam Wolf
Cofounder and Engineer
W&L
On Wed, Jan 7, 2015 at 1:45 PM, LordBlick <lordblick@xxxxxxxxx> wrote:
> In response to a message written on 07.01.2015, 19:29, from Adam Wolf:
>
>> Hi folks,
>>
>> Good work!
>>
>> I dunno, LordBlick, it looks pretty Pythonic to me!
>>
>> Also, I do not think
>>
>> dict(map(lambda lname: lname, layers_tuple.index(lname), layers_tuple))
>>
>> is clearer than using a dictionary called layer_dict :)
>>
> Some tip: count chars… :P
> This dictionary is not necessary for this code since it is used only for
> the one function. Code below makes the same without dict:
> def get_layer(s):
> "Get layer id from layer name\n If it is already an int just
> return it."
> if hasattr(pcbnew, s):
> return getattr(pcbnew, s)
> elif isinstance(s, int) \
> and(s in range(pcbnew.LAYER_ID_COUNT):
> return s
> return None
>
> BTW. I love Tabs in python code, which syntax is based on Tab counting and
> I don't intend to change that… Setting tab length is not so advanced and
> hard activity.
>
> --
> Best Regards,
> LordBlick
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References