From: Waylan L. <wa...@gm...> - 2008-10-22 15:44:09
|
Apparently Treap wasn't tested in Python 2.3 as the builtin function ``sorted`` (as well as ``operator.itemgetter`` which sorted needs) are not available until 2.4. We get errors on import. Can't even try running the code. Yuri, are we now dropping support for 2.3 or was this an oversite? Personally, I'd prefer dropping Treap for an OrderedDict. odict [1] seems like a reasonable solution and it's licensed under BSD so there's no reason we couldn't include it. Interestingly, PEP 372 [2] was recently introduced proposing an order dict for inclusion in the standard library. That PEP points to a number of other implementations, including one written by the pep author as well as a much faster C clone of odict. [1]: http://www.voidspace.org.uk/python/odict.html [2]: http://www.python.org/dev/peps/pep-0372/ -- ---- Waylan Limberg wa...@gm... |
From: Yuri T. <qar...@gm...> - 2008-10-22 16:53:43
|
> Apparently Treap wasn't tested in Python 2.3 as the builtin function > ``sorted`` (as well as ``operator.itemgetter`` which sorted needs) are > not available until 2.4. We get errors on import. Can't even try > running the code. I did test it with 2.3, discovered that it wasn't working, but thought that this would be fixable, so this has been on my todo list. > Personally, I'd prefer dropping Treap for an OrderedDict. odict [1] We can definitely think about this. I'll have to read up on odict to see if it does everything that we need. Of top of my head, though, odict 1400 lines, too big to just include in our code, so we would have to worry about an extra dependency. But let's think about this. Perhaps we should look at more options too. - yuri -- http://sputnik.freewisdom.org/ |
From: Waylan L. <wa...@gm...> - 2008-10-22 18:37:50
|
On Wed, Oct 22, 2008 at 12:53 PM, Yuri Takhteyev <qar...@gm...> wrote: >> Personally, I'd prefer dropping Treap for an OrderedDict. odict [1] > > We can definitely think about this. I'll have to read up on odict to > see if it does everything that we need. Of top of my head, though, > odict 1400 lines, too big to just include in our code, so we would > have to worry about an extra dependency. But let's think about this. > Perhaps we should look at more options too. > Actually that file has more than one implementation. We'd only need the one which we could include and modify within markdown.py. Or we could do the same with Django's, or any other BSD licensed implementation. On Wed, Oct 22, 2008 at 1:22 PM, <ne...@gm...> wrote: > We can extend it to do insert not only by index but by keynames too. That's exactly what I had in mind, regardless of which implementation we start with. -- ---- Waylan Limberg wa...@gm... |
From: <ne...@gm...> - 2008-10-22 17:22:37
|
2008/10/22 Yuri Takhteyev <qar...@gm...> > > > Personally, I'd prefer dropping Treap for an OrderedDict. odict [1] > > We can definitely think about this. I'll have to read up on odict to > see if it does everything that we need. Of top of my head, though, > odict 1400 lines, too big to just include in our code, so we would > have to worry about an extra dependency. But let's think about this. > Perhaps we should look at more options too. > I think another one extra dependency is not very good. As an alternative we can look at SortedDict in Django [1]. We can extend it to do insert not only by index but by keynames too. [1]: http://code.djangoproject.com/browser/django/trunk/django/utils/datastructures.py#L53 |
From: <ne...@gm...> - 2008-10-22 17:34:57
|
2008/10/22 <ne...@gm...> > > > 2008/10/22 Yuri Takhteyev <qar...@gm...> > >> >> > Personally, I'd prefer dropping Treap for an OrderedDict. odict [1] >> >> We can definitely think about this. I'll have to read up on odict to >> see if it does everything that we need. Of top of my head, though, >> odict 1400 lines, too big to just include in our code, so we would >> have to worry about an extra dependency. But let's think about this. >> Perhaps we should look at more options too. >> > > I think another one extra dependency is not very good. As an alternative we > can look at SortedDict in Django [1]. We can extend it to do insert not only > by index but by keynames too. > > [1]: > http://code.djangoproject.com/browser/django/trunk/django/utils/datastructures.py#L53 > Just noticed that in PEP 372, that Waylan referred, SortedDict listed as one of the implementations, and there are few others, I think we can find something suitable here [1] [1]: http://www.python.org/dev/peps/pep-0372/#example-implementation |
From: Waylan L. <wa...@gm...> - 2008-10-23 04:01:54
|
I just pushed a new branch "dj-odict" [1] that implements a working OrderedDict. You should see the last 2 commits in that branch. The first of the 2 was an incomplete (it works but there is more work to do) implementation of voidspace's OrderedDict with a few additional methods. However, as that implementation included a lot of features we'll never need (like comparison operators), I switched to the much simpler Django implementation and improved the added methods. I've reimplemented the ``add`` and ``link`` methods and they work with the ``_begin``, ``_end``, ``<key``, and ``>key`` syntax. While they are not necessary, it does make the code in the extension shorter and to the point. The tests in regression_tests.py cover the features we need pretty well. I still need to write documentation, but that can wait until I know we're going to go with this. I didn't do any real performance/memory usage testing, but the regression_tests consistently run a little faster with more tests so I'm thinking we have a minimal speed increase with this. Personally, I like it. As an aside, note the change in the tables.py extension in that last commit. I had to do that to get the test to pass. Thing is, is was passing with Treap and it shouldn't have been because Treap was getting the order wrong (I think - I haven't actually checked this). I know it was getting the order wrong on footnotes for sure, but that ext doesn't have tests so it didn't show up. There are still some other, unrelated problems with footnotes though, so they aren't working right now (I think I broke them when I refactored the processors/patterns this past weekend). But there wasn't much point in working on that when things weren't in the right order so I did this first. [1]: http://gitorious.org/projects/python-markdown/repos/mainline/logs/dj-odict On Wed, Oct 22, 2008 at 12:53 PM, Yuri Takhteyev <qar...@gm...> wrote: >> Apparently Treap wasn't tested in Python 2.3 as the builtin function >> ``sorted`` (as well as ``operator.itemgetter`` which sorted needs) are >> not available until 2.4. We get errors on import. Can't even try >> running the code. > > I did test it with 2.3, discovered that it wasn't working, but thought > that this would be fixable, so this has been on my todo list. > >> Personally, I'd prefer dropping Treap for an OrderedDict. odict [1] > > We can definitely think about this. I'll have to read up on odict to > see if it does everything that we need. Of top of my head, though, > odict 1400 lines, too big to just include in our code, so we would > have to worry about an extra dependency. But let's think about this. > Perhaps we should look at more options too. > > - yuri > > -- > http://sputnik.freewisdom.org/ > -- ---- Waylan Limberg wa...@gm... |
From: Yuri T. <qar...@gm...> - 2008-10-28 08:13:08
|
I haven't had a chance to play with this, but in principle this looks reasonable. I suggest that you merge this into mainline and let's assume that this is our solution for now. I'll try to think a little more about it next week. No offense to Ben - his library looked great. But it probably does makes more sense to go with a more standard solution. Ben: if you think we are making a mistake here, please speak up. :) - yuri On Wed, Oct 22, 2008 at 9:01 PM, Waylan Limberg <wa...@gm...> wrote: > I just pushed a new branch "dj-odict" [1] that implements a working > OrderedDict. You should see the last 2 commits in that branch. The > first of the 2 was an incomplete (it works but there is more work to > do) implementation of voidspace's OrderedDict with a few additional > methods. However, as that implementation included a lot of features > we'll never need (like comparison operators), I switched to the much > simpler Django implementation and improved the added methods. I've > reimplemented the ``add`` and ``link`` methods and they work with the > ``_begin``, ``_end``, ``<key``, and ``>key`` syntax. While they are > not necessary, it does make the code in the extension shorter and to > the point. The tests in regression_tests.py cover the features we need > pretty well. I still need to write documentation, but that can wait > until I know we're going to go with this. > > I didn't do any real performance/memory usage testing, but the > regression_tests consistently run a little faster with more tests so > I'm thinking we have a minimal speed increase with this. > > Personally, I like it. > > As an aside, note the change in the tables.py extension in that last > commit. I had to do that to get the test to pass. Thing is, is was > passing with Treap and it shouldn't have been because Treap was > getting the order wrong (I think - I haven't actually checked this). I > know it was getting the order wrong on footnotes for sure, but that > ext doesn't have tests so it didn't show up. There are still some > other, unrelated problems with footnotes though, so they aren't > working right now (I think I broke them when I refactored the > processors/patterns this past weekend). But there wasn't much point in > working on that when things weren't in the right order so I did this > first. > > [1]: http://gitorious.org/projects/python-markdown/repos/mainline/logs/dj-odict > > On Wed, Oct 22, 2008 at 12:53 PM, Yuri Takhteyev <qar...@gm...> wrote: >>> Apparently Treap wasn't tested in Python 2.3 as the builtin function >>> ``sorted`` (as well as ``operator.itemgetter`` which sorted needs) are >>> not available until 2.4. We get errors on import. Can't even try >>> running the code. >> >> I did test it with 2.3, discovered that it wasn't working, but thought >> that this would be fixable, so this has been on my todo list. >> >>> Personally, I'd prefer dropping Treap for an OrderedDict. odict [1] >> >> We can definitely think about this. I'll have to read up on odict to >> see if it does everything that we need. Of top of my head, though, >> odict 1400 lines, too big to just include in our code, so we would >> have to worry about an extra dependency. But let's think about this. >> Perhaps we should look at more options too. >> >> - yuri >> >> -- >> http://sputnik.freewisdom.org/ >> > > > > -- > ---- > Waylan Limberg > wa...@gm... > -- http://sputnik.freewisdom.org/ |
From: Ben W. <da...@gm...> - 2008-11-06 15:57:40
|
I'll have to check what I did with this last. I vaguely remember running into a 2.3 problem, and thought I had it solved. :-) Can you tell I've been out of the loop again? However, I would say that my primary goal was to offer an elegant way to add new markups. I care less about Treap being the implementation than an elegant, pythonic solution. :) So, no bruised ego here. At least the conversation has started. That said, let me check when I get home on what I did on this. I remember there being a problem, but not if it's the same as encountered with 2.3 incompatibility. Entirely possible that I made a personal decision not to care. I've not been able to visit the issue in quite some time. However, OrderedDict looks very familiar. I should say (I think I did once before) that my original inspiration was from PmWiki, which is PHP-based. The author of that tool created a wiki framework where everything could be overridden. The markup was very flexible. Having grown accustomed to that flexibility, I'd wanted to see it here. Regards, Ben On Tue, Oct 28, 2008 at 3:13 AM, Yuri Takhteyev <qar...@gm...> wrote: > I haven't had a chance to play with this, but in principle this looks > reasonable. I suggest that you merge this into mainline and let's > assume that this is our solution for now. I'll try to think a little > more about it next week. > > No offense to Ben - his library looked great. But it probably does > makes more sense to go with a more standard solution. Ben: if you > think we are making a mistake here, please speak up. :) > > - yuri > > On Wed, Oct 22, 2008 at 9:01 PM, Waylan Limberg <wa...@gm...> wrote: >> I just pushed a new branch "dj-odict" [1] that implements a working >> OrderedDict. You should see the last 2 commits in that branch. The >> first of the 2 was an incomplete (it works but there is more work to >> do) implementation of voidspace's OrderedDict with a few additional >> methods. However, as that implementation included a lot of features >> we'll never need (like comparison operators), I switched to the much >> simpler Django implementation and improved the added methods. I've >> reimplemented the ``add`` and ``link`` methods and they work with the >> ``_begin``, ``_end``, ``<key``, and ``>key`` syntax. While they are >> not necessary, it does make the code in the extension shorter and to >> the point. The tests in regression_tests.py cover the features we need >> pretty well. I still need to write documentation, but that can wait >> until I know we're going to go with this. >> >> I didn't do any real performance/memory usage testing, but the >> regression_tests consistently run a little faster with more tests so >> I'm thinking we have a minimal speed increase with this. >> >> Personally, I like it. >> >> As an aside, note the change in the tables.py extension in that last >> commit. I had to do that to get the test to pass. Thing is, is was >> passing with Treap and it shouldn't have been because Treap was >> getting the order wrong (I think - I haven't actually checked this). I >> know it was getting the order wrong on footnotes for sure, but that >> ext doesn't have tests so it didn't show up. There are still some >> other, unrelated problems with footnotes though, so they aren't >> working right now (I think I broke them when I refactored the >> processors/patterns this past weekend). But there wasn't much point in >> working on that when things weren't in the right order so I did this >> first. >> >> [1]: http://gitorious.org/projects/python-markdown/repos/mainline/logs/dj-odict >> >> On Wed, Oct 22, 2008 at 12:53 PM, Yuri Takhteyev <qar...@gm...> wrote: >>>> Apparently Treap wasn't tested in Python 2.3 as the builtin function >>>> ``sorted`` (as well as ``operator.itemgetter`` which sorted needs) are >>>> not available until 2.4. We get errors on import. Can't even try >>>> running the code. >>> >>> I did test it with 2.3, discovered that it wasn't working, but thought >>> that this would be fixable, so this has been on my todo list. >>> >>>> Personally, I'd prefer dropping Treap for an OrderedDict. odict [1] >>> >>> We can definitely think about this. I'll have to read up on odict to >>> see if it does everything that we need. Of top of my head, though, >>> odict 1400 lines, too big to just include in our code, so we would >>> have to worry about an extra dependency. But let's think about this. >>> Perhaps we should look at more options too. >>> >>> - yuri >>> >>> -- >>> http://sputnik.freewisdom.org/ >>> >> >> >> >> -- >> ---- >> Waylan Limberg >> wa...@gm... >> > > > > -- > http://sputnik.freewisdom.org/ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > -- Ben Wilson "Words are the only thing which will last forever" Churchill |
From: Waylan L. <wa...@gm...> - 2008-10-29 03:04:54
|
FYI, I pushed the merge earlier this evening. On Tue, Oct 28, 2008 at 4:13 AM, Yuri Takhteyev <qar...@gm...> wrote: > I haven't had a chance to play with this, but in principle this looks > reasonable. I suggest that you merge this into mainline and let's > assume that this is our solution for now. I'll try to think a little > more about it next week. > > No offense to Ben - his library looked great. But it probably does > makes more sense to go with a more standard solution. Ben: if you > think we are making a mistake here, please speak up. :) > > - yuri > > On Wed, Oct 22, 2008 at 9:01 PM, Waylan Limberg <wa...@gm...> wrote: >> I just pushed a new branch "dj-odict" [1] that implements a working >> OrderedDict. You should see the last 2 commits in that branch. The >> first of the 2 was an incomplete (it works but there is more work to >> do) implementation of voidspace's OrderedDict with a few additional >> methods. However, as that implementation included a lot of features >> we'll never need (like comparison operators), I switched to the much >> simpler Django implementation and improved the added methods. I've >> reimplemented the ``add`` and ``link`` methods and they work with the >> ``_begin``, ``_end``, ``<key``, and ``>key`` syntax. While they are >> not necessary, it does make the code in the extension shorter and to >> the point. The tests in regression_tests.py cover the features we need >> pretty well. I still need to write documentation, but that can wait >> until I know we're going to go with this. >> >> I didn't do any real performance/memory usage testing, but the >> regression_tests consistently run a little faster with more tests so >> I'm thinking we have a minimal speed increase with this. >> >> Personally, I like it. >> >> As an aside, note the change in the tables.py extension in that last >> commit. I had to do that to get the test to pass. Thing is, is was >> passing with Treap and it shouldn't have been because Treap was >> getting the order wrong (I think - I haven't actually checked this). I >> know it was getting the order wrong on footnotes for sure, but that >> ext doesn't have tests so it didn't show up. There are still some >> other, unrelated problems with footnotes though, so they aren't >> working right now (I think I broke them when I refactored the >> processors/patterns this past weekend). But there wasn't much point in >> working on that when things weren't in the right order so I did this >> first. >> >> [1]: http://gitorious.org/projects/python-markdown/repos/mainline/logs/dj-odict >> >> On Wed, Oct 22, 2008 at 12:53 PM, Yuri Takhteyev <qar...@gm...> wrote: >>>> Apparently Treap wasn't tested in Python 2.3 as the builtin function >>>> ``sorted`` (as well as ``operator.itemgetter`` which sorted needs) are >>>> not available until 2.4. We get errors on import. Can't even try >>>> running the code. >>> >>> I did test it with 2.3, discovered that it wasn't working, but thought >>> that this would be fixable, so this has been on my todo list. >>> >>>> Personally, I'd prefer dropping Treap for an OrderedDict. odict [1] >>> >>> We can definitely think about this. I'll have to read up on odict to >>> see if it does everything that we need. Of top of my head, though, >>> odict 1400 lines, too big to just include in our code, so we would >>> have to worry about an extra dependency. But let's think about this. >>> Perhaps we should look at more options too. >>> >>> - yuri >>> >>> -- >>> http://sputnik.freewisdom.org/ >>> >> >> >> >> -- >> ---- >> Waylan Limberg >> wa...@gm... >> > > > > -- > http://sputnik.freewisdom.org/ > -- ---- Waylan Limberg wa...@gm... |
From: John S. <jo...@sz...> - 2008-10-29 09:41:21
Attachments:
em-test.patch
|
On Tue, Oct 28, 2008 at 11:04 PM, Waylan Limberg <wa...@gm...> wrote: > FYI, I pushed the merge earlier this evening. I actually had a test lying around in my working copy testing *...* around a link (the old markdown code didn't work and neither did the treap implementation). The new baseline actually worked though! I've attached the test case. -John |
From: John S. <jo...@sz...> - 2008-11-04 09:30:03
|
On Wed, Oct 29, 2008 at 4:41 AM, John Szakmeister <jo...@sz...> wrote: > On Tue, Oct 28, 2008 at 11:04 PM, Waylan Limberg <wa...@gm...> wrote: >> FYI, I pushed the merge earlier this evening. > > I actually had a test lying around in my working copy testing *...* > around a link (the old markdown code didn't work and neither did the > treap implementation). The new baseline actually worked though! > > I've attached the test case. BTW, is this sort of thing of any use to the project? I've tripped over several other edges that don't work, but I won't waste anyone's time (mine included) if it's not useful. -John |
From: Yuri T. <qar...@gm...> - 2008-11-04 10:08:51
|
Sorry about not getting back to you about this earlier, it's been a crazy few days. Yes, test cases are good. I will integrate yours the next time I boot my brain into python markdown. Probably later this week. - yuri On Tue, Nov 4, 2008 at 1:29 AM, John Szakmeister <jo...@sz...> wrote: > On Wed, Oct 29, 2008 at 4:41 AM, John Szakmeister <jo...@sz...> wrote: >> On Tue, Oct 28, 2008 at 11:04 PM, Waylan Limberg <wa...@gm...> wrote: >>> FYI, I pushed the merge earlier this evening. >> >> I actually had a test lying around in my working copy testing *...* >> around a link (the old markdown code didn't work and neither did the >> treap implementation). The new baseline actually worked though! >> >> I've attached the test case. > > BTW, is this sort of thing of any use to the project? I've tripped > over several other edges that don't work, but I won't waste anyone's > time (mine included) if it's not useful. > > -John > -- http://sputnik.freewisdom.org/ |
From: John S. <jo...@sz...> - 2008-11-04 10:28:52
|
On Tue, Nov 4, 2008 at 5:08 AM, Yuri Takhteyev <qar...@gm...> wrote: > Sorry about not getting back to you about this earlier, it's been a > crazy few days. Not a problem. More than anything I was really looking to see if it's useful. :-) > Yes, test cases are good. I will integrate yours the next time I boot > my brain into python markdown. Probably later this week. Thanks! -John |
From: Waylan L. <wa...@gm...> - 2008-11-04 13:38:56
|
On Tue, Nov 4, 2008 at 5:08 AM, Yuri Takhteyev <qar...@gm...> wrote: > Sorry about not getting back to you about this earlier, it's been a > crazy few days. > > Yes, test cases are good. I will integrate yours the next time I boot > my brain into python markdown. Probably later this week. > Sorry, I guess I forgot to mention it, but I already commited that test. You can find it here: http://gitorious.org/projects/python-markdown/repos/mainline/commits/c9389e8b33b5b6771f541c1ba47bb91abd9b3f6f -- ---- Waylan Limberg wa...@gm... |
From: John S. <jo...@sz...> - 2008-11-05 08:15:28
|
On Tue, Nov 4, 2008 at 8:38 AM, Waylan Limberg <wa...@gm...> wrote: > On Tue, Nov 4, 2008 at 5:08 AM, Yuri Takhteyev <qar...@gm...> wrote: >> Sorry about not getting back to you about this earlier, it's been a >> crazy few days. >> >> Yes, test cases are good. I will integrate yours the next time I boot >> my brain into python markdown. Probably later this week. >> > > Sorry, I guess I forgot to mention it, but I already commited that > test. You can find it here: > > http://gitorious.org/projects/python-markdown/repos/mainline/commits/c9389e8b33b5b6771f541c1ba47bb91abd9b3f6f > Thanks Waylan! I'll make sure to try add future tests to the correct area as well. -John |