Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Gregory Ewing
rantingrick wrote: I was thinking more about this comment and it occurred to me that Python does have user controlled data structures. Just because there is no "top level syntax" like ruby does not mean these do not exists. Syntax is what it's really about, though. There's no clear dividing li

Re: embedding: how do I redirect print output?

2011-07-06 Thread Ulrich Eckhardt
Steven D'Aprano wrote: > Why do you think it [sink for use as sys.stdout] needs to be in C? As > far as I can tell, so long as it quacks like a file object (that is, > has a write method), it should work. Good point & thanks for the example fish! Uli -- Domino Laser GmbH Geschäftsführer: Thors

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Ulrich Eckhardt
rantingrick wrote: > On Jul 5, 10:26 am, Steven D'Aprano > Since you can't do anything without a root window, I don't see the >> benefit in forcing the user to do so [create one explicitly]. > > The reason is simple. It's called order. It's called learning from day > one how the order of things ex

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Ulrich Eckhardt
Mel wrote: > In wx, many of the window classes have Create methods, for filling in > various attributes in "two-step construction". I'm not sure why, because > it works so well to just supply all the details when the class is called > and an instance is constructed. Maybe there's some C++ strateg

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Gregory Ewing
rantingrick wrote: Something to replace Python, Ruby, Perl, JavaScript, etc, etc not some "pie-in-the-sky", "single-answer-to-all- our-problems" pipe dream language. So it's just a "single-answer-to-all-our-glue-programming" pipe dream language, then? :-) -- Greg -- http://mail.python.org/mai

Error while downloading webpages

2011-07-06 Thread TimB
Hi everyone, new to python. I'm attempting to download a large amount of webpages (about 600) to disk and for some reason a few of them fail. I'm using this in a loop where pagename and urlStr change each time: import urllib try: urllib.urlretrieve(urlStr, 'webpages/'+pagename+'.htm')

Not able to store data to dictionary because of memory limitation

2011-07-06 Thread Rama Rao Polneni
Hi All, I am facing a problem when I am storing cursor fetched(Oracle 10G) data in to a dictionary. As I don't have option to manipulate data in oracle10G, I had to stick to python to parse the data for some metrics. After storing 1.99 GB data in to the dictionary, python stopped to store the rem

Re: web browsing short cut

2011-07-06 Thread Thomas Jollans
On 07/06/2011 03:30 AM, Dustin Cheung wrote: > I am looking into Tkinter. But i am not sure if it will actually work. > This maybe a crazy idea but i was wondering if i can put a web browser > in the frame. I have tried to use Tkinter to resize and place the > windows to certain areas of the screen

Re: Error while downloading webpages

2011-07-06 Thread TimB
On Jul 6, 5:39 pm, TimB wrote: > Hi everyone, new to python. I'm attempting to download a large amount > of webpages (about 600) to disk and for some reason a few of them > fail. > > I'm using this in a loop where pagename and urlStr change each time: > import urllib >     try: >         urllib.ur

Re: Not able to store data to dictionary because of memory limitation

2011-07-06 Thread Chris Angelico
On Wed, Jul 6, 2011 at 5:49 PM, Rama Rao Polneni wrote: > Hi All, > > I am facing a problem when I am storing cursor fetched(Oracle 10G) > data in to a dictionary. > As I don't have option to manipulate data in oracle10G, I had to stick > to python to parse the data for some metrics. > > After sto

Re: web browsing short cut

2011-07-06 Thread Chris Angelico
On Wed, Jul 6, 2011 at 11:30 AM, Dustin Cheung wrote: > Hey, > I am looking into Tkinter. But i am not sure if it will actually work. This > maybe a crazy idea but i was wondering if i can put a web browser in the > frame. I have tried to use Tkinter to resize and place the windows to > certain ar

Re: Secure ssl connection with wrap_socket

2011-07-06 Thread AndDM
On Jul 5, 4:08 pm, Jean-Paul Calderone wrote: > On Jul 5, 4:52 am, Andrea Di Mario wrote: > > > Hi, I'm a new python user and I'm writing a small web service with ssl. > > I want use a self-signed certificate like in > > wiki:http://docs.python.org/dev/library/ssl.html#certificates > > I've used

Extracting property getters from dir() results

2011-07-06 Thread Gnarlodious
Using introspection, is there a way to get a list of "property getters"? Does this: vars=property(getVars(), "Dump a string of variables and values") have some parsable feature that makes it different from other functions? Or would I need to use some naming scheme to parse them out? -- Gnarlie

Re: Not able to store data to dictionary because of memory limitation

2011-07-06 Thread Rama Rao Polneni
Yes the data is from table. which is retrieved using some queries in to cx_oracel cursor. I am able to read the data row by row. One more information, I am Able to load the data in to dictionary by removin

Re: Not able to store data to dictionary because of memory limitation

2011-07-06 Thread Ulrich Eckhardt
Rama Rao Polneni wrote: > After storing 1.99 GB data in to the dictionary, python stopped to > store the remaining data in to dictionary. Question here: - Which Python? - "stopped to store" (you mean "stopped storing", btw), how does it behave? Hang? Throw exceptions? Crash right away? > Memo

Re: Extracting property getters from dir() results

2011-07-06 Thread Christian Heimes
Am 06.07.2011 11:02, schrieb Gnarlodious: > Using introspection, is there a way to get a list of "property > getters"? > > Does this: > > vars=property(getVars(), "Dump a string of variables and values") > > have some parsable feature that makes it different from other > functions? Or would I ne

Python Packaging

2011-07-06 Thread Benji Benjokal
Can someone show me how to package with py2exe? Every time I tried it says the file does not exist. Can you help? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Does hashlib support a file mode?

2011-07-06 Thread Anssi Saari
Phlip writes: > If the file were huge, the file.read() would allocate a big string and > thrash memory. (Yes, in 2011 that's still a problem, because these > files could be movies and whatnot.) I did a crc32 calculator like that and actually ran into some kind of string length limit with large f

Re: Python Packaging

2011-07-06 Thread Thomas Jollans
On 07/06/2011 11:44 AM, Benji Benjokal wrote: > > Can someone show me how to package with py2exe? > Every time I tried it says the file does not exist. If you show us how you're trying to do it, somebody may be able to spot your error. PS: http://www.catb.org/~esr/faqs/smart-questions.html --

hiiiiiiiiiiii see this webpage

2011-07-06 Thread covai exxon
http://123maza.com/65/papaya846/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Does hashlib support a file mode?

2011-07-06 Thread Adam Tauno Williams
On Tue, 2011-07-05 at 22:54 -0700, Phlip wrote: > Pythonistas > Consider this hashing code: > import hashlib > file = open(path) > m = hashlib.md5() > m.update(file.read()) > digest = m.hexdigest() > file.close() > If the file were huge, the file.read() would allocate a big string and >

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Steven D'Aprano
rantingrick wrote: > On Jul 5, 11:04 am, Corey Richardson wrote: > >> How is giving the sort method a function by which to determine the >> relative value of objects a control structure? Do you know what a control >> structure is? It's something that you use to modify control flow: >> >> if foo

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Steven D'Aprano
Stefaan Himpe wrote: >> Now, I have an ulterior motive in raising this issue... I can't find the >> original article I read! My google-fu has failed me (again...). I don't >> suppose anyone can recognise it and can point me at it? > > My sarcasm detector warns me not to add a link, although perha

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Steven D'Aprano
sal migondis wrote: > How could a belief be wrong? I believe you are a small glass of beer. Are you *actually* a small glass of beer in reality? If so, my belief is right. If you are a human being, then my belief is wrong. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Steven D'Aprano
rantingrick wrote: >> Define "best for all", and try not to make it "what Rick wants". > > You want features? And remember i am talking about scripting/glue > level languages here. Something to replace Python, Ruby, Perl, > JavaScript, etc, etc not some "pie-in-the-sky", "single-answer-to-all- >

Re: Not able to store data to dictionary because of memory limitation

2011-07-06 Thread Tim Chase
On 07/06/2011 02:49 AM, Rama Rao Polneni wrote: After storing 1.99 GB data in to the dictionary, python stopped to store the remaining data in to dictionary. Is there any alternate solution to resolve this issue. Like splitting the dictionaries or writing the data to hard disk instead of writing

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Stefaan Himpe
No! I was serious. I've spent *ages* trying to find the link to the article... if you know it, please share. Ok - I thought you were referring to some troll's rant with similar title. I'm probably way off, but were you referring to the RAII technique? http://en.wikipedia.org/wiki/Resource_A

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread rantingrick
On Jul 6, 6:44 am, Steven D'Aprano wrote: > A control structure is a structure which controls the program flow. Control > structures include: > > * jumps (goto, gosub, comefrom, exceptions, break, continue) > > * loops (for, while, repeat...until) > > * conditional branches (if, case/switch) ---

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Chris Angelico
On Wed, Jul 6, 2011 at 11:41 PM, rantingrick wrote: > Give it up man and admit i am correct and you are wrong. > Sorry. A Lawful Good character cannot tell a lie. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Implicit initialization is EVIL!

2011-07-06 Thread rantingrick
On Jul 6, 1:12 am, Gregory Ewing wrote: > rantingrick wrote: > >>What he means is that On Mac, if you close "all" windows, the application is > >>still running. > > > Then that is NOT closing windows that is only ICONIFIYING/HIDING them. > > No, the windows really are closed. They no longer exist

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
wow, tx y'all! I forgot to mention that hashlib itself is not required; I could also use Brand X. But y'all agree that blocking up the file in python adds no overhead to hashing each block in C, so hashlib in a loop it is! -- http://mail.python.org/mailman/listinfo/python-list

Re: Secure ssl connection with wrap_socket

2011-07-06 Thread Jean-Paul Calderone
On Jul 6, 4:44 am, AndDM wrote: > On Jul 5, 4:08 pm, Jean-Paul Calderone > wrote: > > > > > On Jul 5, 4:52 am, Andrea Di Mario wrote: > > > > Hi, I'm a new python user and I'm writing a small web service with ssl. > > > I want use a self-signed certificate like in > > > wiki:http://docs.python.

Re: Implicit initialization is EVIL!

2011-07-06 Thread Steven D'Aprano
rantingrick wrote: > If you design a GRAPHICAL user interface, then once the GRAPHICAL part > is removed (window), why do need the main code to stick around? Open your mind to ideas that go beyond your simple window-centric paradigm! There is more to graphical user interfaces than windows! In t

Re: Extracting property getters from dir() results

2011-07-06 Thread Gnarlodious
On Jul 6, 3:35 am, Christian Heimes wrote: Thank you! Exactly what I wanted. -- Gnarlie http://Gnarlodious.com -- http://mail.python.org/mailman/listinfo/python-list

Re: wx MenuItem - icon is missing

2011-07-06 Thread Laszlo Nagy
Under windows, this displays the icon for the popup menu item. Under GTK it doesn't and there is no error message, no exception. I get different results than you. Under Ubuntu 9.04 w with wx 2.8.9.1, when I right click I see a menu item called test with little icon of a calculator or someth

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Steven D'Aprano
rantingrick wrote: > On Jul 6, 6:44 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > >> A control structure is a structure which controls the program flow. >> Control structures include: >> >> * jumps (goto, gosub, comefrom, exceptions, break, continue) >> >> * loops (for, while, re

interactive plots

2011-07-06 Thread Mihai Badoiu
How do I do interactive plots in python? Say I have to plot f(x) and g(x) and I want in the plot to be able to click on f and make it disappear. Any python library that does this? thanks, --mihai -- http://mail.python.org/mailman/listinfo/python-list

trouble creating tooltips using Wx in Tk canvas

2011-07-06 Thread Ravikanth
Hi all, Hi all, I am having a trouble creating tooltips. I am trying to embed a matplotlib graph inside a TkInter canvas. After some search over the net, I found out a way to create tooltips using the WXbackend. But when I embed my matplotlib figure inside a Tk and the tooltips are not getting d

Re: Implicit initialization is EVIL!

2011-07-06 Thread rantingrick
On Jul 6, 9:32 am, Steven D'Aprano wrote: > rantingrick wrote: > > If you design a GRAPHICAL user interface, then once the GRAPHICAL part > > is removed (window), why do need the main code to stick around? > > Open your mind to ideas that go beyond your simple window-centric paradigm! Correction:

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Neil Cerutti
On 2011-07-06, Chris Angelico wrote: > On Wed, Jul 6, 2011 at 11:41 PM, rantingrick > wrote: >> Give it up man and admit i am correct and you are wrong. > > Sorry. A Lawful Good character cannot tell a lie. Lawful Good characters have a hard time coexisting with the Chaotic Neutrals. -- Neil C

Re: wx MenuItem - icon is missing

2011-07-06 Thread Philip Semanchuk
On Jul 6, 2011, at 2:25 AM, Laszlo Nagy wrote: > >>> Under windows, this displays the icon for the popup menu item. Under GTK it >>> doesn't and there is no error message, no exception. >> >> I get different results than you. >> >> Under Ubuntu 9.04 w with wx 2.8.9.1, when I right click I see

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread rantingrick
On Jul 6, 9:55 am, Steven D'Aprano wrote: > rantingrick wrote: > > --- > > THIS CODE RESULTS IN A CONTROL STRUCTURE! > > > --> lst.sort(lambda x,y: cmp(x[1], y[1])) > > No it doesn't. > > How does it change the program flow? You call the sort method, it sort

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
Tx, all!. But... > For example I use this function to copy a stream and return a SHA512 and > the output streams size: > >     def write(self, in_handle, out_handle): >         m = hashlib.sha512() >         data = in_handle.read(4096) >         while True: >             if not data: >            

Re: Implicit initialization is EVIL!

2011-07-06 Thread Steven D'Aprano
rantingrick wrote: >> In the Mac OS GUI, an application can have a menubar and no windows. >> Windows come and go as needed, but the menubar stays until the users >> quits the application. > > That's just window visibility (whether by hiding or destroying) under > the veil of a detached UI window

Re: Implicit initialization is EVIL!

2011-07-06 Thread Chris Angelico
On Thu, Jul 7, 2011 at 1:10 AM, rantingrick wrote: > On Jul 6, 9:32 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> Open your mind to ideas that go beyond your simple window-centric paradigm! > > Correction: Window-Centric GUI paradigm! BIG DIFFERENCE. > >> There is more to graphic

Re: Does hashlib support a file mode?

2011-07-06 Thread Peter Otten
Phlip wrote: > Tx, all!. But... > >> For example I use this function to copy a stream and return a SHA512 and >> the output streams size: >> >> def write(self, in_handle, out_handle): >> m = hashlib.sha512() >> data = in_handle.read(4096) >> while True: >> if not data: >> break >> m.update(data)

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Ian Kelly
On Wed, Jul 6, 2011 at 12:49 AM, Ulrich Eckhardt wrote: > Mel wrote: >> In wx, many of the window classes have Create methods, for filling in >> various attributes in "two-step construction".  I'm not sure why, because >> it works so well to just supply all the details when the class is called >>

Javacv / google apps

2011-07-06 Thread PyNewbie
Hi, Is it possible to use JavaCV with Google apps engine? -- http://mail.python.org/mailman/listinfo/python-list

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Mel
Ian Kelly wrote: > On Wed, Jul 6, 2011 at 12:49 AM, Ulrich Eckhardt > wrote: >> Mel wrote: >>> In wx, many of the window classes have Create methods, for filling in >>> various attributes in "two-step construction". I'm not sure why, >>> because it works so well to just supply all the details wh

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
> - Open the file in binary mode. I had tried open(path, 'rb') and it didn't change the "wrong" number. And I added --binary to my evil md5sum version, and it didn't change the "right" number! Gods bless those legacy hacks that will never die, huh? But I'm using Ubuntu (inside VMWare, on Win7, o

Re: Implicit initialization is EVIL!

2011-07-06 Thread Andrew Berg
On 2011.07.06 11:11 AM, Steven D'Aprano wrote: > The Dead Window Sketch > == As much as I hate it when people feed trolls, that was pretty funny. -- http://mail.python.org/mailman/listinfo/python-list

Re: The end to all language wars and the great unity API to come!

2011-07-06 Thread Teemu Likonen
* 2011-07-06T06:41:52-07:00 * wrote: > I am using a user defined spec as an argument to the cmp function. > That spec then modifies the body of the compare function and creates a > user defined control structure. You can argue all day that it is not a > user defined control structure but no one i

Re: Implicit initialization is EVIL!

2011-07-06 Thread Waldek M.
Dnia Wed, 6 Jul 2011 08:10:27 -0700 (PDT), rantingrick napisał(a): >> In the Unix/Linux world, there is a graphical application called xkill which >> has no menus and no windows, all it has is a mouse cursor! No, it does not >> run in the background: it is a foreground app. > > Wow nice corner cas

Re: interactive plots

2011-07-06 Thread Ian Kelly
On Wed, Jul 6, 2011 at 9:04 AM, Mihai Badoiu wrote: > How do I do interactive plots in python?  Say I have to plot f(x) and g(x) > and I want in the plot to be able to click on f and make it disappear.  Any > python library that does this? Matplotlib can be integrated with either wxPython or PyQt

Re: Does hashlib support a file mode?

2011-07-06 Thread Peter Otten
Phlip wrote: >> - Open the file in binary mode. > > I had tried open(path, 'rb') and it didn't change the "wrong" number. > > And I added --binary to my evil md5sum version, and it didn't change > the "right" number! > > Gods bless those legacy hacks that will never die, huh? But I'm using > Ub

Re: Implicit initialization is EVIL!

2011-07-06 Thread Tim Chase
On 07/06/2011 11:24 AM, Chris Angelico wrote: On Thu, Jul 7, 2011 at 1:10 AM, rantingrick wrote: Wow nice corner case. Can you come up with at least five of them though? You and I both know that the vast majority of GUI's require visible windows. Five corner cases. Okay. One is xkill; if I ca

Re: Implicit initialization is EVIL!

2011-07-06 Thread Steven D'Aprano
Andrew Berg wrote: > On 2011.07.06 11:11 AM, Steven D'Aprano wrote: >> The Dead Window Sketch >> == > As much as I hate it when people feed trolls, that was pretty funny. Thanks. Re the troll-feeding, every few months I get a strange seizure in my brain that compels me to int

Re: Implicit initialization is EVIL!

2011-07-06 Thread Chris Angelico
Five more good entries (though I think #8 and #9 are mostly covered already). But hey, we have at least an octagon to work in. On Thu, Jul 7, 2011 at 3:37 AM, Tim Chase wrote: > I think there are sufficiently many edge cases this formerly-square room is > starting to look round... The room is st

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
> >> def file_to_hash(path, m=None): > >> if m is None: > >> m = hashlib.md5() > The first call will give you the correct checksum, the second: not. As the > default md5 instance remembers the state from the previous function call > you'll get the checksum of both files combined. Ouch. That was i

Re: Does hashlib support a file mode?

2011-07-06 Thread Chris Torek
>> - Do the usual dance for default arguments: >> def file_to_hash(path, m=None): >> if m is None: >> m = hashlib.md5() [instead of def file_to_hash(path, m = hashlib.md5()): ] In article Phlip wrote: >Not sure why if that's what the defaulter does? For the same

Re: interactive plots

2011-07-06 Thread Steven Howe
On 07/06/2011 09:59 AM, Ian Kelly wrote: On Wed, Jul 6, 2011 at 9:04 AM, Mihai Badoiu wrote: How do I do interactive plots in python? Say I have to plot f(x) and g(x) and I want in the plot to be able to click on f and make it disappear. Any python library that does this? Matplotlib can be i

Re: Implicit initialization is EVIL!

2011-07-06 Thread rantingrick
On Jul 6, 11:11 am, Steven D'Aprano wrote: > The Dead Window Sketch > == > > [snip] ## The Roman Stawman Sketch ## [cmp.lang.python]: (The trolls are gathered and a righteous man speaks.) GRACCHUS: For your guidance TrollCae

Re: trouble creating tooltips using Wx in Tk canvas

2011-07-06 Thread Ian Kelly
On Wed, Jul 6, 2011 at 9:12 AM, Ravikanth wrote: > Hi all, > Hi all, > > I am having a trouble creating tooltips. I am trying to embed a > matplotlib graph inside  a TkInter canvas. After some search over the > net, I found out a way to create tooltips using the WXbackend. > But when I embed my ma

Re: Implicit initialization is EVIL!

2011-07-06 Thread Andrew Berg
On 2011.07.06 01:19 PM, rantingrick wrote: > ## > The Roman Stawman Sketch > ## Nice try, but you have to use a Monty Python sketch (and you have to spell correctly :-P ). -- http://mail.python.org/mailman/listinfo/python-list

Re: Does hashlib support a file mode?

2011-07-06 Thread Andrew Berg
On 2011.07.06 12:38 PM, Phlip wrote: > Python sucks. m = md5() looks like an initial assignment, not a > special magic storage mode. Principle of least surprise fail, and > principle of most helpful default behavior fail. func() = whatever the function returns func = the function object itself (in

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
On Jul 6, 11:42 am, Andrew Berg wrote: > On 2011.07.06 12:38 PM, Phlip wrote:> Python sucks. m = md5() looks like an > initial assignment, not a > > special magic storage mode. Principle of least surprise fail, and > > principle of most helpful default behavior fail. > > func() = whatever the fun

Re: Does hashlib support a file mode?

2011-07-06 Thread geremy condra
On Wed, Jul 6, 2011 at 3:07 PM, Phlip wrote: > On Jul 6, 11:42 am, Andrew Berg wrote: >> On 2011.07.06 12:38 PM, Phlip wrote:> Python sucks. m = md5() looks like an >> initial assignment, not a >> > special magic storage mode. Principle of least surprise fail, and >> > principle of most helpful

Re: Implicit initialization is EVIL!

2011-07-06 Thread Ian Kelly
On Wed, Jul 6, 2011 at 12:36 PM, Andrew Berg wrote: > On 2011.07.06 01:19 PM, rantingrick wrote: >> ## >>  The Roman Stawman Sketch >> ## > Nice try, but you have to use a Monty Python sketch (and you have to > spell correctly :-P ). Seriously. The

Re: Implicit initialization is EVIL!

2011-07-06 Thread MRAB
On 06/07/2011 20:15, Ian Kelly wrote: On Wed, Jul 6, 2011 at 12:36 PM, Andrew Berg wrote: On 2011.07.06 01:19 PM, rantingrick wrote: ## The Roman Stawman Sketch ## Nice try, but you have to use a Monty Python sketch (and you have to spell corr

Large number multiplication

2011-07-06 Thread Billy Mays
I was looking through the python source and noticed that long multiplication is done using the Karatsuba method (O(~n^1.5)) rather than using FFTs O(~n log n). I was wondering if there was a reason the Karatsuba method was chosen over the FFT convolution method? -- Bill -- http://mail.python.

Re: trouble creating tooltips using Wx in Tk canvas

2011-07-06 Thread Ravikanth
On Jul 6, 1:32 pm, Ian Kelly wrote: > On Wed, Jul 6, 2011 at 9:12 AM, Ravikanth wrote: > > Hi all, > > Hi all, > > > I am having a trouble creating tooltips. I am trying to embed a > > matplotlib graph inside  a TkInter canvas. After some search over the > > net, I found out a way to create toolt

Re: Does hashlib support a file mode?

2011-07-06 Thread Andrew Berg
On 2011.07.06 02:07 PM, Phlip wrote: > If I call m = md5() twice, I expect two objects. You get two objects because you make the function run again. Of course, the first one is garbage collected if it doesn't have another reference. >>> m1 = hashlib.md5() >>> m2 = hashlib.md5() >>> m1 is m2 False

Re: Does hashlib support a file mode?

2011-07-06 Thread Mel
Phlip wrote: > If I call m = md5() twice, I expect two objects. > > I am now aware that Python bends the definition of "call" based on > where the line occurs. Principle of least surprise. Actually, in def file_to_hash(path, m = hashlib.md5()): hashlib.md5 *is* called once; that is when the de

Re: Does hashlib support a file mode?

2011-07-06 Thread Ian Kelly
On Wed, Jul 6, 2011 at 1:07 PM, Phlip wrote: > If I call m = md5() twice, I expect two objects. > > I am now aware that Python bends the definition of "call" based on > where the line occurs. Principle of least surprise. There is no definition-bending. The code: """ def file_to_hash(path, m = h

Re: Large number multiplication

2011-07-06 Thread Ian Kelly
On Wed, Jul 6, 2011 at 1:30 PM, Billy Mays wrote: > I was looking through the python source and noticed that long multiplication > is done using the Karatsuba method (O(~n^1.5)) rather than using FFTs O(~n > log n).  I was wondering if there was a reason the Karatsuba method was > chosen over the

Re: Large number multiplication

2011-07-06 Thread Christian Heimes
Am 06.07.2011 21:30, schrieb Billy Mays: > I was looking through the python source and noticed that long > multiplication is done using the Karatsuba method (O(~n^1.5)) rather > than using FFTs O(~n log n). I was wondering if there was a reason the > Karatsuba method was chosen over the FFT con

Re: Does hashlib support a file mode?

2011-07-06 Thread Ethan Furman
Phlip wrote: On 2011.07.06 12:38 PM, Phlip wrote: Python sucks. m = md5() looks like an initial assignment, not a special magic storage mode. Principle of least surprise fail, and principle of most helpful default behavior fail. >>> If I call m = md5() twice, I expect two objects. You didn'

Re: Large number multiplication

2011-07-06 Thread Billy Mays
On 07/06/2011 04:05 PM, Christian Heimes wrote: Am 06.07.2011 21:30, schrieb Billy Mays: I was looking through the python source and noticed that long multiplication is done using the Karatsuba method (O(~n^1.5)) rather than using FFTs O(~n log n). I was wondering if there was a reason the Kara

Re: Large number multiplication

2011-07-06 Thread Billy Mays
On 07/06/2011 04:02 PM, Ian Kelly wrote: On Wed, Jul 6, 2011 at 1:30 PM, Billy Mays wrote: I was looking through the python source and noticed that long multiplication is done using the Karatsuba method (O(~n^1.5)) rather than using FFTs O(~n log n). I was wondering if there was a reason the K

Re: Large number multiplication

2011-07-06 Thread Ian Kelly
On Wed, Jul 6, 2011 at 2:21 PM, Billy Mays wrote: > Side note: Are Numpy/Scipy the libraries you are referring to? I was thinking more of gmpy or mpmath, but I'm not personally well acquainted with any of them. -- http://mail.python.org/mailman/listinfo/python-list

Re: Large number multiplication

2011-07-06 Thread Christian Heimes
Am 06.07.2011 22:15, schrieb Billy Mays: > I believe it is possible to do FFTs without significant rounding error. > I know that the GIMPS's Prime95 does very large multiplications using > FFTs (I don't know if they use the integer based or double based > version). I also know they have guard

Re: Does hashlib support a file mode?

2011-07-06 Thread Carl Banks
On Wednesday, July 6, 2011 12:07:56 PM UTC-7, Phlip wrote: > If I call m = md5() twice, I expect two objects. > > I am now aware that Python bends the definition of "call" based on > where the line occurs. Principle of least surprise. Phlip: We already know about this violation of the least surp

Re: web browsing short cut

2011-07-06 Thread Ian
On 03/07/2011 02:21, Dustin Cheung wrote: Hey guys, I am new to python. I want to make a shortcut that opens my websites and re-sizes them to display on different areas on the screen. I looked around but i had no luck. Is that possible with python? if so can someone point to to the right dir

Re: Does hashlib support a file mode?

2011-07-06 Thread Phlip
On Jul 6, 1:25 pm, Carl Banks wrote: > We already know about this violation of the least surprise principle; most of > us acknowledge it as small blip in an otherwise straightforward and clean > language. Here's the production code we're going with - thanks again all: def file_to_hash(path,

Re: interactive plots

2011-07-06 Thread Jeremy Sanders
Mihai Badoiu wrote: > How do I do interactive plots in python? Say I have to plot f(x) and g(x) > and I want in the plot to be able to click on f and make it disappear. > Any python library that does this? You could try veusz, which is a python module and plotting program combined. You can als

Re: interactive plots

2011-07-06 Thread Almar Klein
On 6 July 2011 17:04, Mihai Badoiu wrote: > How do I do interactive plots in python? Say I have to plot f(x) and g(x) > and I want in the plot to be able to click on f and make it disappear. Any > python library that does this? Visvis is a plotting toolkit that has good support for interactiv

Re: interactive plots

2011-07-06 Thread Almar Klein
On 7 July 2011 00:00, Almar Klein wrote: > > > On 6 July 2011 17:04, Mihai Badoiu wrote: > >> How do I do interactive plots in python? Say I have to plot f(x) and g(x) >> and I want in the plot to be able to click on f and make it disappear. Any >> python library that does this? > > > Visvis i

show() in pylab doesn't work if used twice

2011-07-06 Thread Ravikanth
Hi all, I have been using python for just over a month now. I am writing a program to plot some graph using the show() twice in the same program. The code snippet is shown below. I am trying to plot a simple x vs y using ax.plot() then I get a figure displayed. I close the figure displayed and th

multiple call to show not working in matplotlib

2011-07-06 Thread Ravikanth
Hi, I am facing some problem. I have made multiple calls to show() function in a sinlge program. as below. Before the first call I plotted x vs y . then i called show. execution halted until i closed the window. Once I closed the window, execution again progressed and even passed second show(), bu

multiple calls to show doesnot work for matplotlib

2011-07-06 Thread Ravikanth
Hi, I am facing some problem. I have made multiple calls to show() function in a sinlge program. as below. Before the first call I plotted x vs y . then i called show. execution halted until i closed the window. Once I closed the window, execution again progressed and even passed second show(), bu

multiple call to show not working in matplotlib

2011-07-06 Thread mru
Hi, I am facing some problem. I have made multiple calls to show() function in a sinlge program. as below. Before the first call I plotted x vs y . then i called show. execution halted until i closed the window. Once I closed the window, execution again progressed and even passed second show(), bu

Re: web browsing short cut

2011-07-06 Thread Dustin Cheung
Okay thanks for the help guys, ill keep you guys posted. On Wed, Jul 6, 2011 at 1:19 PM, Ian wrote: > On 03/07/2011 02:21, Dustin Cheung wrote: > >> Hey guys, >> >> I am new to python. I want to make a shortcut that opens my websites and >> re-sizes them to display on different areas on the scr

Re: multiple calls to show doesnot work for matplotlib

2011-07-06 Thread Steven D'Aprano
Ravikanth wrote: > Hi, > > I am facing some problem. Yes, we heard you the first two times, there's no need to keep repeating the question over and over again. There is no Service Level Agreement for guaranteed response times for free advice over the Internet. Be patient, and hopefully somebo

Re: Does hashlib support a file mode?

2011-07-06 Thread Steven D'Aprano
Phlip wrote: > Note the fix also avoids comparing to None, which, as usual, is also > icky and less typesafe! "Typesafe"? Are you trying to make a joke? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: show() in pylab doesn't work if used twice

2011-07-06 Thread Robert Kern
On 7/6/11 5:05 PM, Ravikanth wrote: Hi all, I have been using python for just over a month now. I am writing a program to plot some graph using the show() twice in the same program. The code snippet is shown below. Please use the matplotlib-users list for matplotlib questions. By the way, fou

Re: multiple calls to show doesnot work for matplotlib

2011-07-06 Thread Ravikanth
On Jul 6, 6:15 pm, Steven D'Aprano wrote: > Ravikanth wrote: > > Hi, > > > I am facing some problem. > > Yes, we heard you the first two times, there's no need to keep repeating the > question over and over again. > > There is no Service Level Agreement for guaranteed response times for free > adv

Re: Implicit initialization is EXCELLENT

2011-07-06 Thread Steven D'Aprano
Stefaan Himpe wrote: > >> No! I was serious. I've spent *ages* trying to find the link to the >> article... if you know it, please share. > > Ok - I thought you were referring to some troll's rant with similar > title. I'm probably way off, but were you referring to the RAII technique? > > http

Re: How do twisted and multiprocessing.Process create zombies?

2011-07-06 Thread Nobody
On Tue, 05 Jul 2011 14:52:49 -0700, bitcycle wrote: > In python, using twisted loopingcall, multiprocessing.Process, and > multiprocessing.Queue; is it possible to create a zombie process. And, if > so, then how? A zombie is a process which has terminated but hasn't been wait()ed on (aka "reaped"

Re: Should ctypes handle mis-matching structure return ABI between mingw and MSVC?

2011-07-06 Thread Nobody
On Wed, 06 Jul 2011 11:12:47 +0800, Just Fill Bugs wrote: > According the Bug 36834 of gcc, there is a mis-matching between mingw and > MSVC when a struct was returned by value from a C function. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834 > > Should ctypes handle this situation a

Re: show() in pylab doesn't work if used twice

2011-07-06 Thread Ravikanth
On Jul 6, 6:26 pm, Robert Kern wrote: > On 7/6/11 5:05 PM, Ravikanth wrote: > > > Hi all, > > > I have been using python for just over a month now. > > I am writing a program to plot some graph using the  show() twice in > > the same program. The code snippet is shown below. > > Please use the mat

  1   2   >