Sorry if this is a double post, because I thought I posted this before, but I came back to see if anyone replied and the thread isn't here so I think I was just hallucinating ;)
Anyway, a nice addition to DrPython would be if Ctrl+F4 closed tabs. This is fairly standard in tabbed environments.
The bug has to do with spacing. DrPython asked if I wanted to convert a file to unix spacing/newlines as opposed to windows spacing. So I said yes. Then my program kept giving me mysterious errors and I couldn't figure out what was wrong. Thinking it might be a bug I opened the file in IDLE -- and noticed that the spacing was different. DrPython was not displaying the spacing that the file actually had (at least not how the interpreter saw it).
Here's the python file:
The difference in how IDLE and DrPython display the file is in the class constructor:
# Define synonyms
self.depart = self.leave = self.walk = self.run = self.exit = self.enter = self.og = self.go
for x in DirectionList: # You can just type in a direction to go there
exec "self." + x + " = self.go"
self.take = self.grab = self.get
self.dump = self.throw = self.drop
self.lookat = self.study = self.examine
self.fight = self.punch = self.kick = self.hurt = self.attack
self.Inventory = self.Items = self.ListAllItems
self.SaveGame = self.save
In IDLE, only the exec line is in the for loop (as it should be) while in DrPython all the self assignments are also in the loop. I'm pretty sure this is a DrPython bug and not an IDLE bug because I opened the file in a few other text editors and firefox and they all show the self assignments correctly being outside the loop.
You always know you are in for a good post when it starts with a reference to hallucinating ;)
You can set the shortcut for "Close" to "Ctrl + F4".
So onto the spacing and the file:
This is not a drpython bug.
You have mixed spacing. The for loop is indented with a tab. The exec statement has a single tab, then 4 spaces. The next line is indented with 8 spaces.
This is screwy.
You will note that the file has mixed indentation.
DrPython shows this in the statusbar by default.
It also provides mechanisms for switching the file to space or tab indentation (You can also set this in preferences).
I think this must be due to me using Kate to edit the .py files on my laptop and IDLE on my desktop. Is there any easy way to go through and make it uniform?
P.S. Are you sure you don't want to classify this as a bug? I would think that above all you would want DrPython's display of the spacing to correlate to the way the interpreter is going to look at it (as IDLE seems to in this case).
I am not inclined to classify this as a bug.
If you set tab size to 8 in prefs, you will find the file looks exactly the same as it does in idle.
This is why mixed indentation is not a good mix with python code.
I could make tab size 8 by default, and spaces the default indentation type. I will post this to the open discussion, and let people weigh in.
Actually I prefer the 4 size lol ;)
I'll just clean up my files.
BTW, on Ctrl+F4 thing. I've set the hotkey and it works great, but I still think it's strange that this isn't a default. It is in every other tabbed app I've worked with (firefox, eclipse, etc.)
This could easily be made a default for the next version.
(I don't think it is currently used for anything else).
I wam not going to make it default.
On linux, this is used for workspace switching.
People can change it easily enough.
Log in to post a comment.