bittercode / pyrrhic-ree

pyrrhic regular expression editor
GNU General Public License v2.0
9 stars 1 forks source link

[Possible Bug] Using the unicode function #5

Closed bahostetterlewis closed 11 years ago

bahostetterlewis commented 11 years ago

There are a few places in your code that have the following type of logic

try:
    someStr = str(getValueFromSomeWhere)
except UnicodeError:
    someStr = unicode(getValueFromSomeWhere)

I understand what is going on here but this shouldn't work in Python 3.x as all strings are now considered unicode (a big change from 2.x).

As far as I know, and from the tests I have done, unicode will throw an error if it is attempted to be run on 3.x (I am currently using 3.3.) Is this an artifact from the old kodos system? I could just be missing something so I wanted to make sure we really needed it.

bittercode commented 11 years ago

It's code from the original. A lot of times I just pasted stuff straight across and then dealt with errors until it ran.

As I was working through it I started reading up on Python 3 and unicode and just haven't gone pack to fix it.

You have no idea how much I appreciate the knowledgeable help you are bringing to this.

bahostetterlewis commented 11 years ago

No problem, I think its a really cool project so I am glad I can help! I figured it was something left over from the 2.x days as I have run into code like that in the past. Luckily this is an easy fix and actually makes the code smaller (which is always a good thing). Also as a side note if you ever want clarification on anything I've done I would be more than happy to explain exactly what is going on, I'm not always 100% correct on the right way to do things but I could at least explain my thoughts :P

bittercode commented 11 years ago

Cool. Right now Kodos is packaged for Fedora (maybe other distros too). Once it's in pretty good shape, then I'd like to work on having it be availabe in the repos in place of Kodos. I just want to do that because I think it will be fun, but for you I'd imagine it will be a nice project as a part of your portfolio/cv.

I had matched most Kodos functionality. I was going to work on the part where it rolls back to the last match. Can't remember just what he called it right now - but it was if you had gotten lost it would edit the regex to a simpler state where it matched something if I remember right.

Though Kodos would let you step through multiple matches one at a time, which I did not do. But I don't know how necessary that was. I guess with decoupling the gui it could be up to whoever implements the ui how they wanted to handle that.

Very cool.

bahostetterlewis commented 11 years ago

Yeah and if we wanted to get really fancy we could even implement a regex history that would give you say a drop down of the last 10 regex you had entered (it would be trivial to implement with some of the changes I made so far in the refactor). It would definitely be cool to see this get maybe supported on launchpad as well for ubuntu systems. Your last point of stepping through could also use the API I am extracting from your code to get a list of matches and display them one at a time, I have some ideas on that but we could probably add it fairly easily.