Re: Re: what is the difference between @property and method

2012-02-09 Thread John Posner
On 2:59 PM, Devin Jeanpierre wrote: > It is kind of funny that the docs don't ever explicitly say what a > property is. http://docs.python.org/library/functions.html#property -- > Devin Here's a writeup that does: http://wiki.python.org/moin/AlternativeDescriptionOfProper

Re: Formate a number with commas

2012-02-09 Thread John Posner
(?<=\d)(?=(\d\d\d)+$)" # python 2.6.6 import re find_blocks = re.compile(r"(?<=\d)(?=(\d\d\d)+$)") for numstr in "1 12 123 1234 12345 123456 1234567 12345678".split(): print find_blocks.sub("," , numstr) output is: 1 12 123 1,234 12,345 123,456 1,234,567 12,345,678 -John -- http://mail.python.org/mailman/listinfo/python-list

Re: Common LISP-style closures with Python

2012-02-09 Thread John Nagle
;s new language. Rust doesn't have the "spaghetti stack" needed to implement closures, so it has more limited closure semantics. It's more like some of the C add-ons for closures, but sounder. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: frozendict

2012-02-10 Thread John Nagle
antics. They've made some progress. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

How can I catch misnamed variables?

2012-02-10 Thread John Gordon
d it does catch some errors such as incorrect indentation, but not errors like the above. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tin

Re: datetime module and timezone

2012-02-10 Thread John Gordon
re you asking for a list of of all the possible timezone choices? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread John Gordon
e function to stop profiling! So when I went to print the results, it was still profiling... endlessly. (Okay, maybe it wasn't that funny.) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: frozendict

2012-02-13 Thread John Nagle
On 2/10/2012 9:52 PM, 8 Dihedral wrote: 在 2012年2月11日星期六UTC+8上午2时57分34秒,John Nagle写道: On 2/10/2012 10:14 AM, Nathan Rice wrote: Lets also not forget that knowing an object is immutable lets you do a lot of optimizations; it can be inlined, it is safe to convert to a contiguous block of

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-14 Thread John O'Hagan
is completely dead outside the U.S. - ironically the only developed nation where real Darwinism is still seriously questioned. [...] > Go on believing that humans will be inhabiting this rock in > the next 1000 years, or this universe in the next 10,000 -- because > the enlightened few will have transcended into the mind hive and your @ > $$ will be glued to Terra firma forever! Now that is some crazy shit! Maybe L. Ron _is_ still alive... Regards, John -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-15 Thread John O'Hagan
On Tue, 14 Feb 2012 17:26:36 -0800 (PST) Rick Johnson wrote: > On Feb 14, 6:44 pm, Chris Angelico wrote: > > But WE are the fittest! Because we are INTELLIGENT! And the whales say: But WE are the fittest! Because we are BIG! And the rabbits say: But WE are the fittest! Because we are FERTILE!

Re: Looking for PyPi 2.0...

2012-02-15 Thread John Nagle
is just a collection of links). They have packaging standards (PyPi does not.) CPAN tends not to be full of low-quality modules that do roughly the same thing. If you want to find a Python module, Google is more useful than PyPi. John Nagle -- http

Re: Script randomly exits for seemingly no reason with strange traceback

2012-02-15 Thread John Nagle
t the error message you're getting. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Python code file prototype

2012-02-17 Thread John Gordon
pass if __name__ == '__main__': main() Where $USERNAME, $DATE and $YEAR are expanded to the actual values. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears

Re: Just curious: why is /usr/bin/python not a symlink?

2012-02-24 Thread John Roth
her the > pep or the discussion around it says symlinks are fine now and the > decision is up to distributors. > > -- > Terry Jan Reedy I believe the changes for PEP 394 are using symlinks. The distro maintainer can, of course, change that. John Roth -- http://mail.python.org/mailman/listinfo/python-list

MAJOR JAVA EVANGELIST CONVERTS TO PYTHON !!!!!!!!!!!!!!

2012-02-26 Thread John Ladasky
On Feb 26, 12:29 am, BV wrote: > MAJOR CANADIAN CHRISTIAN MISSIONARY CONVERTS TO ISLAM MAJOR JAVA EVANGELIST CONVERTS TO PYTHON !! ...Hey, someone has to keep the spam around here on-topic. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python math is off by .000000000000045

2012-02-26 Thread John Ladasky
Curiosity prompts me to ask... Those of you who program in other languages regularly: if you visit comp.lang.java, for example, do people ask this question about floating-point arithmetic in that forum? Or in comp.lang.perl? Is there something about Python that exposes the uncomfortable truth ab

How can I make an instance of a class act like a dictionary?

2012-02-26 Thread John Salerno
Hi everyone. I created a custom class and had it inherit from the "dict" class, and then I have an __init__ method like this: def __init__(self): self = create() The create function creates and returns a dictionary object. Needless to say, this is not working. When I create an instance of

Re: How can I make an instance of a class act like a dictionary?

2012-02-27 Thread John Salerno
On Feb 27, 1:39 am, Chris Rebert wrote: > On Sun, Feb 26, 2012 at 11:24 PM, John Salerno wrote: > > Hi everyone. I created a custom class and had it inherit from the > > "dict" class, and then I have an __init__ method like this: > > > def __init__(self): &g

Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-02-28 Thread John Salerno
t;C:\Users\John\Desktop\gui.py", line 12, in root.destroy() File "C:\Python32\lib\tkinter\__init__.py", line 1714, in destroy self.tk.call('destroy', self._w) _tkinter.TclError: can't invoke "destroy" command: application has been destroyed So a

Re: list comprehension question

2012-02-29 Thread John Gordon
oing: > > t = t.append(instansie) append() modifies the list in-place. It doesn't return anything. (and therefore its return value is None) >>> x = [1, 2, 3] >>> y = x.append(4) >>> print x [1, 2, 3, 4] >>> print y None -- John Gordon

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-02-29 Thread John Salerno
> It is not necessarily to call Tk explicitly, which i think is a bug > BTW. Sure, for simple scripts you can save one line of code but only > at the expense of explicitness and intuitiveness. Observe > > ## START CODE ## > import Tkinter as tk > > root = tk.Tk() > root.title('Explicit Root') > r

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-02-29 Thread John Salerno
> Yes, but i think the REAL problem is faulty code logic. Remove the > last line "root.destroy()" and the problem is solved. Obviously the > author does not have an in-depth knowledge of Tkinter. The faulty code is not my own, which is part of the reason I asked the question. The book I'm reading

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-02-29 Thread John Salerno
On Wednesday, February 29, 2012 11:40:45 PM UTC-6, Terry Reedy wrote: > On 2/29/2012 11:41 PM, John Salerno wrote: > > > window? If you only want the Windows "X" button to close the window, > > then is it okay to leave out any call to destroy()? > > Yes. You mu

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-02-29 Thread John Salerno
> What exactly is the purpose of doing that? Does Tk do some extra work that a > simple call to Frame won't do? More specifically, what is the benefit of doing: root = tk.Tk() app = Application(master=root) app.mainloop() as opposed to: app = Application() app.mainloop() Also, in the first ex

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-02-29 Thread John Salerno
> Yes. You must leave it out. Now I'm reading a Tkinter reference at http://infohost.nmt.edu/tcc/help/pubs/tkinter/minimal-app.html and it has this example: #!/usr/local/bin/python from Tkinter import * class Application(Frame): def __init__(self, master=None):

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread John Salerno
On Thursday, March 1, 2012 1:38:08 AM UTC-6, Steven D'Aprano wrote: > On Wed, 29 Feb 2012 22:41:53 -0800, John Salerno wrote: > > >> Yes. You must leave it out. > > > > Now I'm reading a Tkinter reference at > > http://infohost.nmt.edu/tcc/help/pubs/t

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread John Salerno
> EXAMPLE 1: (this works, but is flawed!) > root = tk.Tk() > b = tk.Button(master=None, text='Sloppy Coder') > b.pack() > root.mainloop() > > EXAMPLE 2: (This is how to write code!) > root = tk.Tk() > widgetframe = tk.Frame(root) > b = tk.Button(master=None, text='Sloppy Coder') > b.pack()

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread John Salerno
> Hmm, it seems as though i am the latest victim of the "copy/paste > error"! Oh well, if you were going to absorb my teachings, you would > have absorbed them by now. I am moving on unless a new subject needs > explaining. Well, I've certainly absorbed your recommendation to always create the roo

Is this the proper way to use a class method?

2012-03-01 Thread John Salerno
This is purely for fun and learning, so I know there are probably better ways of creating a chess program. Right now I'm just curious about my specific question, but I'd love to hear any other advice as well. Basically, I'm wondering if I'm using the class method properly with the move method.

Re: Is this the proper way to use a class method?

2012-03-01 Thread John Salerno
> That's just a coincidence. Your supercall is ought to be: super().move() > In contrast, super().move(self) calls the superclass instance method > `move` with 2 arguments, both `self`, which just happens to work given > your move() method, inside which `cls` isn't actually a class like it > ought

Re: Is this the proper way to use a class method?

2012-03-02 Thread John Salerno
> Oh, but it does get passed, just implicitly. `super()` basically grabs > `self` magically from its caller, and uses it to bind method calls on > the magical object returned by `super()`. Thanks again, now I understand :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-02 Thread John Salerno
> Indeed. One of the things that motivated me to write the tutorial at > http://www.tkdocs.com is the rather poor state (in terms of being out of > date, incorrect, or demonstrating poor practices) of most Tkinter > documentation. > > Call it self-serving, but I think the Tkinter world would b

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-02 Thread John Salerno
> After that, you can nest as > many frames, toplevels, and blah widgets under that root window as you > so desire. Actually you don't even need a "frame", you can pack > widgets directly into a Toplevel or Tk widget. This is interesting. I completely understand your point about always calling (a

How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

2012-03-02 Thread John Salerno
According to the Python docs, the way to use tkinter.ttk is this: from tkinter import * from tkinter.ttk import * But what if I don't like this import method and prefer to do: import tkinter as tk How then do I utilize tkinter.ttk using the same name? Or is that not possible? Will I have to us

Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

2012-03-02 Thread John Salerno
> I suppose the 'advantage' of this is that it will replace tk widgets > with equivalent ttk widgets, if they exist and have the same name. I > believe one has to program them differently, however, so the replacement > cannot be transparent and one mush know anyway what gets replaced and > what

Is this the right location to launch IDLE?

2012-03-04 Thread John Salerno
I'm trying to get Notepad++ to launch IDLE and run the currently open file in IDLE, but all my attempts have failed so far. I'm wondering, am I even using the IDLE path correctly? I'm using this: "C:\Python32\Lib\idlelib\idle.pyw" "$(FULL_CURRENT_PATH)" (That last part puts in the full path to

Re: Is this the right location to launch IDLE?

2012-03-04 Thread John Salerno
Unfortunately neither method worked. Adding "-r" to the path created this error when I tried it: >>> *** Error in script or command! Traceback (most recent call last): File "C:\Users\John\Documents\Python Scripts\chess_pieces.py", line 1 class ChessPiece

Re: Is this the right location to launch IDLE?

2012-03-04 Thread John Salerno
> That would be a Notepad++ problem. That "" gibberish is what you > get when a Unicode BOM (Byte Order Mark) character is encoded as UTF-8 > but decoded as ISO-8859-1 or CP-1252. A BOM is not recommended for > UTF-8 text; there should be some setting in Notepad++ to suppress it. You are my new

Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

2012-03-04 Thread John Salerno
On Sunday, March 4, 2012 7:39:27 PM UTC-6, Rick Johnson wrote: > On Mar 2, 11:06 pm, John Salerno wrote: > > I'm tempted just to go back to wxPython. Two sets of widgets in Tkinter is > > a little annoying. > > Your complaint is justified. The Tkinter API is a disgrac

Tkinter: Why aren't my widgets expanding when I resize the window?

2012-03-04 Thread John Salerno
I can't seem to wrap my head around all the necessary arguments for making a widget expand when a window is resized. I've been following along with a tutorial and I feel like I'm doing everything it said, but I must be missing something. Here's what I have. What I expect is that when I resize th

Re: Tkinter: Why aren't my widgets expanding when I resize the window?

2012-03-05 Thread John Salerno
> You will need to configure the root columns and rows also because the > configurations DO NOT propagate up the widget hierarchy! Actually, for > this example, I would recommend using the "pack" geometry manager on > the frame. Only use grid when you need to use grid. Never use any > functionality

Re: Tkinter: Why aren't my widgets expanding when I resize the window?

2012-03-05 Thread John Salerno
> > I don't like importing things piecemeal. I suppose I could do: > > So you prefer to pollute? How bout we just auto import the whole > Python stdlib so you can save a few keystrokes? > > so that's four more constants I'd have to explicitly import. And > > (tk.N, tk.S, tk.E, tk.W) is just horri

Re: Tkinter: Why aren't my widgets expanding when I resize the window?

2012-03-05 Thread John Salerno
On Monday, March 5, 2012 7:10:50 PM UTC-6, Steven D'Aprano wrote: > On Mon, 05 Mar 2012 14:07:05 -0800, John Salerno quoted: > > >> Wah! > >> > >> Stop whining and act like a professional! You complain about qualifying > >> constants but you happi

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
On Tuesday, March 6, 2012 4:52:10 PM UTC-6, Chris Rebert wrote: > On Tue, Mar 6, 2012 at 2:43 PM, John Salerno wrote: > > I sort of have to work with what the website gives me (as you'll see > > below), but today I encountered an exception to my RE. Let me just give a

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
> Anything that allows me NOT to use REs is welcome news, so I look forward to > learning about something new! :) I should ask though...are there alternatives already bundled with Python that I could use? Now that you mention it, I remember something called HTMLParser (or something like that) a

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
On Tuesday, March 6, 2012 5:05:39 PM UTC-6, John Salerno wrote: > > Anything that allows me NOT to use REs is welcome news, so I look forward > > to learning about something new! :) > > I should ask though...are there alternatives already bundled with Python that > I co

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
On Tuesday, March 6, 2012 5:05:39 PM UTC-6, John Salerno wrote: > > Anything that allows me NOT to use REs is welcome news, so I look forward > > to learning about something new! :) > > I should ask though...are there alternatives already bundled with Python that > I co

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
gh that I won't have to learn another method later. On Tue, Mar 6, 2012 at 5:35 PM, Ian Kelly wrote: > On Tue, Mar 6, 2012 at 4:05 PM, John Salerno wrote: >>> Anything that allows me NOT to use REs is welcome news, so I look forward >>> to learning about something new!

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
> Also, you're still double-posting. Grr. I just reported it to Google, but I think if I start to frequent the newsgroup again I'll have to switch to Thunderbird, or perhaps I'll just try switching back to the old Google Groups interface. I think the issue is the new interface. Sorry. -- http

Re: What's the best way to write this regular expression?

2012-03-06 Thread John Salerno
After a bit of reading, I've decided to use Beautiful Soup 4, with lxml as the parser. I considered simply using lxml to do all the work, but I just got lost in the documentation and tutorials. I couldn't find a clear explanation of how to parse an HTML file and then navigate its structure. The Be

"Decoding unicode is not supported" in unusual situation

2012-03-07 Thread John Nagle
n the WSDL is provided without class generation." I think that somewhere in "suds", they subclass the "unicode" type. That's almost too cute. The proper test is isinstance(s,unicode) John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Project

2012-03-07 Thread John Gordon
In Dev Dixit writes: > Please, tell me how to develop project on "how people intract with > social networing sites". First you need a more detailed description of exactly what you want. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.co

Re: "Decoding unicode is not supported" in unusual situation

2012-03-07 Thread John Nagle
de", or catch the undocumented TypeError exception afterward. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
Ok, first major roadblock. I have no idea how to install Beautiful Soup or lxml on Windows! All I can find are .tar files. Based on what I've read, I can use the easy_setup module to install these types of files, but when I went to download the setuptools package, it only seemed to support Python 2

Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
On Wed, Mar 7, 2012 at 3:01 PM, Ian Kelly wrote: > There is a fork of setuptools called "distribute" that supports Python 3. Thanks, I guess I'll give this a try tonight! > setup.py is a file that should be included at the top-level of the > .tar files you downloaded.  Generally, to install som

Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
On Wed, Mar 7, 2012 at 3:34 PM, Ian Kelly wrote: > The setup.py file (as well as the other files) would be inside the > .tar file.  Unlike a Windows zip file, which does both archival and > compression, Unix files are typically archived and compressed in two > separate steps: "tar" denotes the ar

Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
On Mar 7, 11:03 pm, Chris Angelico wrote: > On Thu, Mar 8, 2012 at 7:39 AM, John Salerno wrote: > > it only > > seemed to support Python 2.7. I'm using 3.2. Is 2.7 just the minimum > > version it requires? It didn't say something like "2.7+", so I w

Re: What's the best way to write this regular expression?

2012-03-07 Thread John Salerno
On Mar 7, 4:02 pm, Evan Driscoll wrote: > On 01/-10/-28163 01:59 PM, Prasad, Ramit wrote: > > > gz stands for gzip and is a form of compression (like rar/zip ). > > tar stands for a tape archive. It is basically a box that holds the > > files. So you need to "unzip" and then "open the box". > > >

Re: What's the best way to write this regular expression?

2012-03-08 Thread John Salerno
Alright, I'm simply lost about how to install these modules. I extracted the folders from the .tar.gz files and then went into those folders in my command prompt. I typed: C:\Python32\python setup.py install and for a while something was happening (I was doing the lxml one) and then it stopped wi

Re: What's the best way to write this regular expression?

2012-03-08 Thread John Salerno
On Mar 8, 3:33 pm, John Salerno wrote: > Alright, I'm simply lost about how to install these modules. I > extracted the folders from the .tar.gz files and then went into those > folders in my command prompt. I typed: > > C:\Python32\python setup.py install > > and

Re: What's the best way to write this regular expression?

2012-03-08 Thread John Gordon
In <21519dbf-4097-4780-874d-41d76f645...@x17g2000yqj.googlegroups.com> John Salerno writes: > Well, after a bit of experimentation, I got it to run, but I seem to > have run into the same error as when I used setup.py: > http://i271.photobucket.com/albums/jj138/JohnJSal/lxml_err

Re: What's the best way to write this regular expression?

2012-03-08 Thread John Salerno
On Mar 8, 3:40 pm, John Salerno wrote: > Now I have no idea what to do. Hmph, I suppose I should have more patience. I realized that the easy_install for lxml only tried to install a binary version, which doesn't exist for the version it found (the latest, 2.3.3). I just had to look thr

Re: "Decoding unicode is not supported" in unusual situation

2012-03-08 Thread John Nagle
s is all different in Python 3.x, where "str" is Unicode and "bytes" really are a distinct type. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to write this regular expression?

2012-03-08 Thread John Salerno
Thanks, I had no idea about either option, since I don't use the command prompt very much. Needless to say, the Linux console is much nicer :) On Thu, Mar 8, 2012 at 4:19 PM, Dave Angel wrote: > On 03/08/2012 04:40 PM, John Salerno wrote: >> >> >> http://i271.ph

Re: What's the best way to write this regular expression?

2012-03-08 Thread John Salerno
On Thursday, March 8, 2012 9:38:51 PM UTC-6, alex23 wrote: > John Salerno wrote: > > So much work just to get a 3rd party module installed! > > "New! Try out the beta release of Beautiful Soup 4. (Last updated > February 28, 2012) > easy_install beautifulsoup4 or pip

PyUSB available for current versions of Windows?

2012-03-09 Thread John Nagle
es before installing." Does this include the keyboard and mouse? They also warn "The device driver can not be easily removed from the system." John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: "Decoding unicode is not supported" in unusual situation

2012-03-09 Thread John Nagle
" of "bytes" should require an encoding. But because of the bytes/str ambiguity in Python 2.6/2.7, the behavior couldn't be type-based. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: "Decoding unicode is not supported" in unusual situation

2012-03-10 Thread John Nagle
On 3/9/2012 4:57 PM, Steven D'Aprano wrote: On Fri, 09 Mar 2012 10:11:58 -0800, John Nagle wrote: This demonstrates a gross confusion about both Unicode and Python. John, I honestly don't mean to be rude here, but if you actually believe that (rather than merely expressing yourself poo

html5lib not thread safe. Is the Python SAX library thread-safe?

2012-03-11 Thread John Nagle
that. But html5lib calls the XML SAX parser. Is that thread-safe? Or is there more trouble down at the bottom? (I run a multi-threaded web crawler, and currently use BeautifulSoup, which is thread safe, although dated. I'm looking at converting to html5lib.)

What's the best way to parse this HTML tag?

2012-03-11 Thread John Salerno
I'm using Beautiful Soup to extract some song information from a radio station's website that lists the songs it plays as it plays them. Getting the time that the song is played is easy, because the time is wrapped in a tag all by itself with a class attribute that has a specific value I can searc

Re: What's the best way to parse this HTML tag?

2012-03-11 Thread John Salerno
On Mar 11, 7:28 pm, Roy Smith wrote: > In article > <239c4ad7-ac93-45c5-98d6-71a434e1c...@r21g2000yqa.googlegroups.com>, >  John Salerno wrote: > > > > > > > > > > > Getting the time that the song is played is easy, because the time is > >

Re: html5lib not thread safe. Is the Python SAX library thread-safe?

2012-03-11 Thread John Nagle
On 3/11/2012 2:45 PM, Cameron Simpson wrote: On 11Mar2012 13:30, John Nagle wrote: | "html5lib" is apparently not thread safe. | (see "http://code.google.com/p/html5lib/issues/detail?id=189";) | Looking at the code, I've only found about three problems. | They'

Re: html5lib not thread safe. Is the Python SAX library thread-safe?

2012-03-12 Thread John Nagle
On 3/12/2012 3:05 AM, Stefan Behnel wrote: John Nagle, 11.03.2012 21:30: "html5lib" is apparently not thread safe. (see "http://code.google.com/p/html5lib/issues/detail?id=189";) Looking at the code, I've only found about three problems. They're all the usu

Re: A Plausible Promise of Abundant Educational Resources

2012-03-12 Thread John Graves
repository. On Sat, Mar 10, 2012 at 3:11 AM, John Graves wrote: > Dear Python-List: > > If you find Wikipedia useful and can see the value of collaborating on a > project which could make learning material as freely and spectacularly > available as Wikipedia does reference material[1],

Re: A Plausible Promise of Abundant Educational Resources

2012-03-12 Thread John Graves
OK. Do you have an presentation prepared? I've put the one with the photographs<http://dl.dropbox.com/u/12838403/20120311/photo-slide-en.htm>onto Dropbox. On Tue, Mar 13, 2012 at 5:06 PM, John Graves wrote: > The warning from Google should be fixed by now. A server outside my

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-13 Thread John Nagle
ot;http://www.youtube.com/watch?v=5lHqEwk7YHs";) (A test with a heavy object: "http://www.youtube.com/watch?v=-DaWIHc1VLY";. Most physics engines don't do heavy objects well. Everything looks too light. We call this the "boink problem.") John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Enchancement suggestion for argparse: intuit type from default

2012-03-14 Thread John Nagle
;, type=int, default=100) Does this seem like a reasonable enhancement to argparse? default=None presents some problems. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Does anyone actually use PyPy in production?

2012-03-16 Thread John Nagle
Does anyone run PyPy in production? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Daemonization / Popen / pipe issue

2012-03-16 Thread John O'Hagan
nished executing and only daemon threads remain. This can abruptly terminate threads which may be busy, for example, communicating via a pipe. The best solution IMO is not to use daemon threads, but to give all threads a way to terminate cleanly before the main thread does, even if this means using a

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread John Nagle
can create a dict full of function names and lambdas, but it's clunky looking. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Daemonization / Popen / pipe issue

2012-03-17 Thread John O'Hagan
On Sat, 17 Mar 2012 18:17:10 -0400 Lee Clemens wrote: > On 03/16/2012 11:37 PM, John O'Hagan wrote: > > On Fri, 16 Mar 2012 22:12:14 -0400 > > Lee Clemens wrote: > > > >> I have a multi-threaded application > >> > >> I have provided a

Re: Python is readable

2012-03-18 Thread John Ladasky
On Mar 14, 11:23 pm, alex23 wrote: > The idea that Python code has to be obvious to non-programmers is an > incorrect and dangerous one. Incorrect? Probably. Dangerous? You'll have to explain what you mean. What I would say is that, when PROGRAMMERS look at Python code for the first time, th

Re: urllib.urlretrieve never returns???

2012-03-20 Thread John Nagle
to negotiate a SSL connection results in the SSL protocol reaching a point where the host end is supposed to finish the handshake, but it doesn't. The odds are against this being the problem. I see problems like that in maybe 1 in 100,000 URLs. John Nag

Best way to disconnect from ldap?

2012-03-21 Thread John Gordon
ms like a much cleaner solution, as I don't ever have to worry about closing the connection; it gets done automatically. I haven't ever used __del__ before. Are there any 'gotchas' I need to worry about? Thanks! -- John Gordon A i

Re: Fetching data from a HTML file

2012-03-24 Thread John Nagle
On 3/23/2012 10:12 PM, Jon Clements wrote: ROBOT Framework Would people please stop using robotic names for things that aren't robots? Thank you. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread John Nagle
h the ascii portions and keep anything else unchanged. So why let the data get into a "str" type at all? Do everything end to end with "bytes" or "bytearray" types. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Will MySQL ever be supported for Python 3.x?

2012-03-30 Thread John Nagle
from other sources. (http://www.lfd.uci.edu/~gohlke/pythonlibs/) But those are just blind builds; they haven't been debugged. MySQL Connector (http://forge.mysql.com/projects/project.php?id=302) is still pre-alpha. John Nagle -- http://mail.python.org/ma

Re: Will MySQL ever be supported for Python 3.x?

2012-03-30 Thread John Nagle
, with the parameters expressed differently. It's a good approach, but very incompatible. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

getaddrinfo NXDOMAIN exploit - please test on CentOS 6 64-bit

2012-03-31 Thread John Nagle
set up their DNS to exploit this. And, of course, it has nothing to do with browser toolbars. This is at a much lower level. If you can make this happen, report back the CentOS version and the library version, please. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: getaddrinfo NXDOMAIN exploit - please test on CentOS 6 64-bit

2012-03-31 Thread John Nagle
On 3/31/2012 9:26 PM, Owen Jacobson wrote: On 2012-03-31 22:58:45 +, John Nagle said: Some versions of CentOS 6 seem to have a potential getaddrinfo exploit. See To test, try this from a command line: ping example If it fails, good. If it returns pings from "example.com"

Re: [OT] getaddrinfo NXDOMAIN exploit - please test on CentOS 6 64-bit

2012-04-01 Thread John Nagle
On 4/1/2012 9:26 AM, Michael Torrie wrote: On 03/31/2012 04:58 PM, John Nagle wrote: If you can make this happen, report back the CentOS version and the library version, please. CentOS release 6.2 (Final) glibc-2.12-1.47.el6_2.9.x86_64 example does not ping example.com does not resolve to

Re: Will MySQL ever be supported for Python 3.x?

2012-04-01 Thread John Nagle
On 3/31/2012 10:54 PM, Tim Roberts wrote: John Nagle wrote: On 3/30/2012 2:32 PM, Irmen de Jong wrote: Try Oursql instead http://packages.python.org/oursql/ "oursql is a new set of MySQL bindings for python 2.4+, including python 3.x" Not even close to being compatible wit

No os.copy()? Why not?

2012-04-02 Thread John Ladasky
I'm looking for a Python (2.7) equivalent to the Unix "cp" command. Since the equivalents of "rm" and "mkdir" are in the os module, I figured I look there. I haven't found anything in the documentation. I am also looking through the Python source code in os.py and its child, posixfile.py. Any hel

Re: No os.copy()? Why not?

2012-04-02 Thread John Ladasky
On Mar 28, 9:50 pm, alex23 wrote: > On Mar 29, 6:12 am, John Ladasky wrote: > > > I'm looking for a Python (2.7) equivalent to the Unix "cp" command. > > Any help?  Thanks. > > Try the shutil module:http://docs.python.org/library/shutil.html Many thanks!

Re: getaddrinfo NXDOMAIN exploit - please test on CentOS 6 64-bit

2012-04-02 Thread John Nagle
On 4/1/2012 1:41 PM, John Nagle wrote: On 4/1/2012 9:26 AM, Michael Torrie wrote: On 03/31/2012 04:58 PM, John Nagle wrote: Removed all "search" and "domain" entries from /etc/resolve.conf It's a design bug in glibc. I just submitted a bug report. http:

Re: No os.copy()? Why not?

2012-04-03 Thread John Ladasky
I use subprocess.call() for quite a few other things. I just figured that I should use the tidier modules whenever I can. -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to structure data for efficient searching

2012-04-03 Thread John Nagle
ed on the index sizes, how to do the join. All of these approaches are roughly O(N log N), which beats the O(N^2) approach you have now. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Run once while loop

2012-04-04 Thread John O'Hagan
m to sleep. If that's the case, you could use threading.Timer, for example: import threading, time def twelve(): print("It's twelve o'clock") local_secs = (time.time() - time.timezone) % (24 * 60 * 60) secs_till_12 = 12 * 60 * 60 - (local_secs % (12 * 60 * 60)) wait_till_12 = threading.Timer(secs_till_12, twelve) wait_till_12.start() Regards, John -- http://mail.python.org/mailman/listinfo/python-list

Re: getaddrinfo NXDOMAIN exploit - please test on CentOS 6 64-bit

2012-04-04 Thread John Nagle
On 4/2/2012 6:53 PM, John Nagle wrote: On 4/1/2012 1:41 PM, John Nagle wrote: On 4/1/2012 9:26 AM, Michael Torrie wrote: On 03/31/2012 04:58 PM, John Nagle wrote: Removed all "search" and "domain" entries from /etc/resolve.conf It's a design bug in glibc. I ju

Re: Re: Python Gotcha's?

2012-04-05 Thread John Posner
t sure it deserves to be called a wart. Note the similarity to: temp = a[0] + [3] # succeeds a[0] = temp # fails -John -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >