Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Phantom Errors
#17
(Nov-02-2019, 02:23 AM)prospero Wrote: I've always been very particular in my coding style and always use a single tab for indentation.
[ ... ]
It's Python 2 all the way [ ... ]

Hi!

I'm just a newbie, so I'm not sure if this could help you.

I saw this in PEP8:

Tabs or Spaces?
Spaces are the preferred indentation method.
Tabs should be used solely to remain consistent with code that is already indented with tabs.
Python 3 disallows mixing the use of tabs and spaces for indentation.
Python 2 code indented with a mixture of tabs and spaces should be converted to using spaces exclusively.
When invoking the Python 2 command line interpreter with the -t option, it issues warnings about code that illegally mixes tabs and spaces. When using -tt these warnings become errors. These options are highly recommended!


Source:

https://www.python.org/dev/peps/pep-0008...-or-spaces

Depending on your version of Python, maybe you could import and use the module tabnanny and the following function to detect ambiguous indentation in a file:

tabnanny.check(file_or_dir)

https://docs.python.org/2/library/tabnan...e-tabnanny

https://docs.python.org/3.3/library/tabn...e-tabnanny

for instance, for both Python 2.7.17 and Python 3.3.7. (Changing the version on the top of the page, you can look for your specific version). The tabnanny.check() function checks the file or directory that you pass to as an argument, and detects ambiguous indentation.

All the best,
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply


Messages In This Thread
Phantom Errors - by prospero - Oct-29-2019, 12:59 AM
RE: Phantom Errors - by buran - Oct-29-2019, 02:18 AM
RE: Phantom Errors - by prospero - Oct-29-2019, 04:02 AM
RE: Phantom Errors - by buran - Oct-29-2019, 04:50 AM
RE: Phantom Errors - by prospero - Oct-29-2019, 05:20 PM
RE: Phantom Errors - by prospero - Oct-30-2019, 05:16 PM
RE: Phantom Errors - by snippsat - Oct-30-2019, 05:42 PM
RE: Phantom Errors - by nilamo - Oct-30-2019, 06:55 PM
RE: Phantom Errors - by prospero - Oct-31-2019, 08:34 PM
RE: Phantom Errors - by ichabod801 - Oct-31-2019, 08:44 PM
RE: Phantom Errors - by prospero - Oct-31-2019, 09:40 PM
RE: Phantom Errors - by ichabod801 - Oct-31-2019, 10:01 PM
RE: Phantom Errors - by prospero - Oct-31-2019, 11:59 PM
RE: Phantom Errors - by prospero - Nov-01-2019, 02:27 AM
RE: Phantom Errors - by nilamo - Nov-01-2019, 03:24 PM
RE: Phantom Errors - by prospero - Nov-02-2019, 02:23 AM
RE: Phantom Errors - by newbieAuggie2019 - Nov-02-2019, 03:18 AM
RE: Phantom Errors - by prospero - Nov-02-2019, 05:32 PM
RE: Phantom Errors - by prospero - Nov-02-2019, 06:42 PM
RE: Phantom Errors - by ichabod801 - Nov-02-2019, 09:40 PM
RE: Phantom Errors - by prospero - Nov-03-2019, 03:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Attibute Error: Two methods in a class, one I can reach, the other not (phantom file? GaryKuipers 4 3,247 Aug-28-2018, 02:32 PM
Last Post: GaryKuipers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020