Re: Mutating an HTML file with BeautifulSoup

2022-08-21 Thread Buck Evan
I've had much success doing round trips through the lxml.html parser. https://lxml.de/lxmlhtml.html I ditched bs for lxml long ago and never regretted it. If you find that you have a bunch of invalid html that lxml inadvertently "fixes", I would recommend adding a stutter-step to your project: p

Re: New Python implementation

2021-02-15 Thread Buck Evan
On Thu, Feb 11, 2021 at 1:49 PM dn via Python-list wrote: > When I first met it, one of the concepts I found difficult to 'wrap my > head around' was the idea that "open software" allowed folk to fork the > original work and 'do their own thing'. My thinking was (probably) > "surely, the original

Re: Explicit vararg values

2018-09-22 Thread Buck Evan
Received? On Sun, Sep 16, 2018 at 3:39 PM Buck Evan wrote: > I started to send this to python-ideas, but I'm having second thoughts. > Does tihs have merit? > > --- > I stumble on this a lot, and I see it in many python libraries: > > def f(*args, **kwargs): > .

Explicit vararg values

2018-09-17 Thread Buck Evan
I started to send this to python-ideas, but I'm having second thoughts. Does tihs have merit? --- I stumble on this a lot, and I see it in many python libraries: def f(*args, **kwargs): ... f(*[list comprehension]) f(**mydict) It always seems a shame to carefully build up an object in order

Re: python 3.44 float addition bug?

2014-06-23 Thread buck
It used to be that the best way to compare floating point numbers while disregarding the inherent epsilon was to use `str(x) == str(y)`. It looks like that workaround doesn't work anymore in 3.4. What's the recommended way to do this now? >>> format(.01 + .01 + .01 + .01 + .01 + .01, 'g') == fo

Re: graphical python

2014-01-19 Thread buck
On Sunday, January 19, 2014 12:19:29 AM UTC-8, Ian wrote: > On Sat, Jan 18, 2014 at 10:40 PM, buck wrote: > > > I'm trying to work through Skienna's algorithms handbook, and note that the > > author often uses graphical representations of the diagrams to help &g

graphical python

2014-01-18 Thread buck
I'm trying to work through Skienna's algorithms handbook, and note that the author often uses graphical representations of the diagrams to help understand (and even debug) the algorithms. I'd like to reproduce this in python. How would you go about this? pyQt, pygame and pyglet immediately come

Re: latin1 and cp1252 inconsistent?

2012-11-17 Thread buck
On Friday, November 16, 2012 4:33:14 PM UTC-8, Nobody wrote: > On Fri, 16 Nov 2012 13:44:03 -0800, buck wrote: > IOW: Microsoft's "embrace, extend, extinguish" strategy has been too > successful and now we have to deal with it. If HTML content is tagged as > using ISO-88

Re: latin1 and cp1252 inconsistent?

2012-11-16 Thread buck
On Friday, November 16, 2012 2:34:32 PM UTC-8, Ian wrote: > On Fri, Nov 16, 2012 at 2:44 PM, wrote: > > > Latin1 has a block of 32 undefined characters. > > > These characters are not undefined. 0x80-0x9f are the C1 control > codes in Latin-1, much as 0x00-0x1f are the C0 control codes, and >

latin1 and cp1252 inconsistent?

2012-11-16 Thread buck
Latin1 has a block of 32 undefined characters. Windows-1252 (aka cp1252) fills in 27 of these characters but leaves five undefined: 0x81, 0x8D, 0x8F, 0x90, 0x9D The byte 0x81 decoded with latin gives the unicode 0x81. Decoding the same byte with windows-1252 yields a stack trace with `UnicodeDec

Re: sum() requires number, not simply __add__

2012-02-23 Thread Buck Golemon
On Feb 23, 1:32 pm, Chris Rebert wrote: > On Thu, Feb 23, 2012 at 1:19 PM, Buck Golemon wrote: > > I feel like the design of sum() is inconsistent with other language > > features of python. Often python doesn't require a specific type, only > > that the type

Re: sum() requires number, not simply __add__

2012-02-23 Thread Buck Golemon
On Feb 23, 1:19 pm, Buck Golemon wrote: > I feel like the design of sum() is inconsistent with other language > features of python. Often python doesn't require a specific type, only > that the type implement certain methods. > > Given a class that implements __add__ why shou

sum() requires number, not simply __add__

2012-02-23 Thread Buck Golemon
I feel like the design of sum() is inconsistent with other language features of python. Often python doesn't require a specific type, only that the type implement certain methods. Given a class that implements __add__ why should sum() not be able to operate on that class? We can fix this in a bac

Re: Debugging a difficult refcount issue.

2011-12-19 Thread buck
This is what I came up with: https://gist.github.com/1496028 We'll see if it helps, tomorrow. On Sunday, December 18, 2011 6:01:50 PM UTC-8, buck wrote: > Thanks Jack. I think printf is what it will come down to. I plan to put a > little code into PyDict_New to print the id and

Re: Debugging a difficult refcount issue.

2011-12-18 Thread buck
r unit tests on and off to pinpoint where > the refcounts are getting messed up. It also causes python to use > plain malloc()s so valgrind becomes useful. Worst case add assertions > and printf()s in the places you think are most janky. > > -Jack > > On Sat, Dec 17, 2011 a

Re: Debugging a difficult refcount issue.

2011-12-18 Thread buck
On Saturday, December 17, 2011 11:55:13 PM UTC-8, Paul Rubin wrote: > buck writes: > > I tried to pinpoint this intermediate allocation with a similar > > PyDict_New/LD_PRELOAD interposer, but that isn't working for me[2]. > > Did you try a gdb watchpoint? I didn'

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread buck
head, @tuple tail = sequence def foo(@list args, @dict kwargs): pass foo(@args, @kwargs) For backward compatibility, we could say that the unary * is identical to @list and unary ** is identical to @dict. -buck -- http://mail.python.org/mailman/listinfo/python-list

Debugging a difficult refcount issue.

2011-12-17 Thread buck
I'm getting a fatal python error "Fatal Python error: GC object already tracked"[1]. Using gdb, I've pinpointed the place where the error is detected. It is an empty dictionary which is marked as in-use. This is somewhat helpful since I can reliably find the memory address of the dict, but it d

Re: [OT] From svn to something else?

2011-05-05 Thread buck
This is what made me choose Mercurial in my recent search. http://www.python.org/dev/peps/pep-0374/ There is a tremendous amount of detail there. In summary, hg and git are both very good, and essentially equal in features. The only salient difference is that hg is implemented in python, so th

Re: Development tools and practices for Pythonistas

2011-05-05 Thread buck
and you can post it to bitbucket and share with the world if you like, almost as easily. --Buck -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent code to the bool() built-in function

2011-04-28 Thread buck
I'm not not touching you! -- http://mail.python.org/mailman/listinfo/python-list

multiprocessing: file-like object

2011-04-28 Thread buck
I've been having issues with getting a file-like object to work with multiprocessing. Since the details are quite lengthy, I've posted them on stackoverflow here: http://stackoverflow.com/questions/5821880/python-multiprocessing-synchronizing-file-like-object I hope I'm not being super rude by

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Buck
On Oct 13, 9:37 am, Ethan Furman wrote: > Buck wrote: > >I'd like to get to zero-installation if possible. It's easy with > >simple python scripts, why not packages too? I know the technical > >reasons, but I haven't heard any practical reasons. > &g

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Buck
On Oct 12, 3:34 pm, "Gabriel Genellina" wrote: > En Mon, 12 Oct 2009 15:24:34 -0300, Buck escribió: > > > On Oct 10, 9:44 am, "Gabriel Genellina" > > wrote: > >> The good thing is that, if the backend package is properly installed   > >>

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Buck
On Oct 12, 4:30 pm, Carl Banks wrote: > On Oct 12, 11:24 am, Buck wrote: > > > On Oct 10, 9:44 am, "Gabriel Genellina" > > wrote: > > > > The good thing is that, if the backend package is properly installed   > > > somewhere in the Python path ..

Re: organizing your scripts, with plenty of re-use

2009-10-12 Thread Buck
e. To fix this, I might make a packagehelper module or some such, but as soon as I start organizing my scripts into a hierarchy (the topic of the OP), I have a catch 22 in that packagehelper is a module that helps me find modules. This means I need a copy of packagehelper in each script dire

Re: organizing your scripts, with plenty of re-use

2009-10-12 Thread Buck
On Oct 10, 9:44 am, "Gabriel Genellina" wrote: > The good thing is that, if the backend package is properly installed   > somewhere in the Python path ... it still works with no modifications. I'd like to get to zero-installation if possible. It's easy with simple python scripts, why not packages

Re: organizing your scripts, with plenty of re-use

2009-10-09 Thread Buck
On Oct 5, 8:12 pm, Steven D'Aprano wrote: > The Original Poster is confusing installation difficulties with code > organization -- his problem is that users have special requirements for > installation, and he's trying to work around those requirements by > organizing his code differently. I beli

Re: organizing your scripts, with plenty of re-use

2009-10-09 Thread Buck
On Oct 5, 2:15 pm, "Rami Chowdhury" wrote: > On Mon, 05 Oct 2009 13:46:09 -0700, Buck wrote: > > Thanks. I think we're getting closer to the core of this. > > > To restate my problem more simply: > > > My core goal is to have my scripts in some sor

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Buck
use it again because it was too complicated. I could fix the error message to tell them exactly what to do, but at that point I might as well re-write the above boilerplate code. I'm overstating my case here for emphasis, but it's essentially true. --Buck -- http://mail.python.org/mailman/listinfo/python-list

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Buck
On Oct 5, 11:29 am, Robert Kern wrote: > On 2009-10-05 12:42 PM, Buck wrote: > > > > >> With the package layout, you would just do: > > >>     from parrot.sleeping import sleeping_in_a_bed > >>     from parrot.feeding.eating import eat_cracker > >

Re: organizing your scripts, with plenty of re-use

2009-10-05 Thread Buck
> > With the package layout, you would just do: > >    from parrot.sleeping import sleeping_in_a_bed >    from parrot.feeding.eating import eat_cracker > > This is really much more straightforward than you are making it out to be. > As in the OP, I need things to "Just Work" without installation r

Re: Module updating plans for Python 3.1: feedparser, MySQLdb

2009-08-01 Thread Buck
I use MySQLdb quite a bit in my work. I could volunteer to help update it. Are there any particular bugs we're talking about or just a straight port to 3.0? --Buck On Jul 31, 6:32 pm, John Nagle wrote: >     Any progress on updating feedparser and MySQLdb for Python 3.x in the >

Python installation problem

2007-03-02 Thread Ray Buck
I've been trying to install Mailman, which requires a newer version of the Python language compiler (p-code generator?) than the one I currently have on my linux webserver/gateway box. It's running a ClarkConnect 2.01 package based on Red Hat 7.2 linux. I downloaded the zipped tarball (Python-

Python installation problem (sorry if this is a dup)

2007-02-28 Thread Ray Buck
I've been trying to install Mailman, which requires a newer version of the Python language compiler (p-code generator?) than the one I currently have on my linux webserver/gateway box. It's running a ClarkConnect 2.01 package based on Red Hat 7.2 linux. I downloaded the zipped tarball (Python-2

Re: database in python ?

2005-04-12 Thread Buck Nuggets
ive, just wait and see what this guys finds: http://sql-info.de/mysql/gotchas.html BTW, you should upgrade, they're now on 5.0.3. Their support site appears to be down right now (timeouts) so I can't check the new bug list, but since 5.0.2 is beta, it may have introduced more prob

Re: database in python ?

2005-04-12 Thread Buck Nuggets
one of their reps. Bottomline - mysql has a lot of marketshare, is improving, and I'm sure that it'll eventually be a credible product. But right now it's has a wide range of inexcusable problems. More info at http://sql-info.de/mysql/gotchas.html buck -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming Language for Systems Administrator

2005-04-12 Thread Buck Nuggets
. Maybe something from the 70s like IMS-DB or Model 204? buck -- http://mail.python.org/mailman/listinfo/python-list