-2
\$\begingroup\$

This is a follow up to Log probe requests of WiFi devices focussing on a specific element of the code.

I have this line of code:

airport_path = "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport"

It seems to be too long for Python style standard. Can I shorten it or make it multiline?

\$\endgroup\$
  • 5
    \$\begingroup\$ What's there to review here? This is a single string assignment instruction. [LEFT] [=] [RIGHT] ...what do you want to shorten? \$\endgroup\$ – Mathieu Guindon Mar 13 '15 at 15:00
7
\$\begingroup\$

Constants should be named in ALL_CAPS, by convention.

You could put multiple constants together, such as

AIRPORT_PATH = "/System/Library/PrivateFrameworks/Apple80211.framework/" \
    "Versions/Current/Resources/airport"

But PEP 8 also says that its own rules should not be applied dogmatically, and this is one place where I think a violation of the line-length limit is justified. It's not that much longer than 80 columns, and breaking up the string makes it less readable and searchable.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Ok, thanks! I'll leave it without splitting. \$\endgroup\$ – 0x2b3bfa0 Mar 13 '15 at 15:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.