# Formatting a long filesystem path in Python [closed]

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?

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

## 1 Answer

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.

• Ok, thanks! I'll leave it without splitting. – 0x2b3bfa0 Mar 13 '15 at 15:04