Re: Problem With Embedded Icon and Python 3.4

2016-03-24 Thread Zachary Ware
On Fri, Mar 25, 2016 at 12:10 AM, Wildman via Python-list wrote: > I have a program that I have been trying to rewrite so it will > run on Python 2.7 and 3.4. It has been a pain to say the least. > Thank $DIETY for aliases. Anyway, I got it all working except > for one thing. The program has an

Re: Problem With Embedded Icon and Python 3.4

2016-03-24 Thread Terry Reedy
On 3/25/2016 1:10 AM, Wildman via Python-list wrote: I have a program that I have been trying to rewrite so it will run on Python 2.7 and 3.4. It has been a pain to say the least. Thank $DIETY for aliases. Anyway, I got it all working except for one thing. The program has an embedded icon. It

Problem With Embedded Icon and Python 3.4

2016-03-24 Thread Wildman via Python-list
I have a program that I have been trying to rewrite so it will run on Python 2.7 and 3.4. It has been a pain to say the least. Thank $DIETY for aliases. Anyway, I got it all working except for one thing. The program has an embedded icon. It is displayed in the window's titlebar. The icon is a

Re: Key Binding Problem

2016-03-24 Thread Wildman via Python-list
On Thu, 24 Mar 2016 21:43:26 -0400, Dennis Lee Bieber wrote: > On Thu, 24 Mar 2016 11:19:52 -0500, Wildman via Python-list > declaimed the following: > >> >>I believe I understand. Thanks. If you can't tell, I'm new to >>Python so the learning process is on-going. > > And you decided to

Negative responses (Re: [OT'ish] Is there a list)

2016-03-24 Thread Rustom Mody
On Friday, March 25, 2016 at 6:08:43 AM UTC+5:30, Ned Batchelder wrote: > Yes Mark, you are a problem. You insult people personally. There is no need > for that. BartC is a challenge, I agree, but he has not said anything > personal against you or anyone else. > > Stop making personal attacks.

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Michael Torrie
On 03/24/2016 04:18 PM, Mark Lawrence wrote: > On 24/03/2016 19:54, BartC wrote: >> On 24/03/2016 18:10, Steven D'Aprano wrote: >>> On Fri, 25 Mar 2016 12:01 am, BartC wrote: >> >>> >>> Then those numbers are pointless. >> >> Yes, they would need some adjustment to do this stuff properly. > > Plea

Re: Tkinter --> Why multiple windows

2016-03-24 Thread Terry Reedy
On 3/24/2016 4:43 PM, kevind0...@gmail.com wrote: On Thursday, March 24, 2016 at 4:29:03 PM UTC-4, Random832 wrote: On Thu, Mar 24, 2016, at 16:24, kevind0...@gmail.com wrote: If I run the code below two windows appear. One empty and one with the text box and button. >>> Why? The answer to

Re: Tkinter --> Why multiple windows

2016-03-24 Thread Wildman via Python-list
On Thu, 24 Mar 2016 13:24:16 -0700, kevind0718 wrote: > Hello: > > newbie Tkinter question > > If I run the code below two windows appear. > One empty and one with the text box and button. > > Why? please > > KD > > > > from Tkinter import * > > class MyDialog: > def __init__(self, pa

Web Scraping

2016-03-24 Thread 121sukha via Python-list
I am new to python and I want to use web scraping to download songs from website. how do I write code to check if the website has uploaded a new song and have that song automatically be downloaded onto my computer. I know how to use the requests.get() module but i am more interested in knowing h

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Ned Batchelder
On Thursday, March 24, 2016 at 7:47:34 PM UTC-4, Mark Lawrence wrote: > On 24/03/2016 23:33, Ian Kelly wrote: > > On Thu, Mar 24, 2016 at 4:58 PM, Mark Lawrence > > wrote: > >> No. While this idiot, BartC, is let loose on this forum, I'll say what I > >> like. > > > > Good to know. I've been on

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Ned Batchelder
On Thursday, March 24, 2016 at 2:03:58 PM UTC-4, BartC wrote: > On 24/03/2016 17:13, Ned Batchelder wrote: > > On Thursday, March 24, 2016 at 12:12:55 PM UTC-4, BartC wrote: > >> On 24/03/2016 15:30, Ned Batchelder wrote: > >>> On Thursday, March 24, 2016 at 9:51:11 AM UTC-4, Steven D'Aprano wrote:

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Larry Martell
On Thu, Mar 24, 2016 at 4:53 PM, wrote: > I use Python wherever I can and find this list (as a usenet group via > gmane) an invaluable help at times. > > Occasionally I have to make forays into Javascript, can anyone > recommend a place similar to this list where Javascript questions can > be ask

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Mark Lawrence
On 24/03/2016 23:33, Ian Kelly wrote: On Thu, Mar 24, 2016 at 4:58 PM, Mark Lawrence wrote: No. While this idiot, BartC, is let loose on this forum, I'll say what I like. Good to know. I've been on the fence about this for a long time, but lately the frequency of your outbursts seems to have

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Ian Kelly
On Thu, Mar 24, 2016 at 4:58 PM, Mark Lawrence wrote: > No. While this idiot, BartC, is let loose on this forum, I'll say what I > like. Good to know. I've been on the fence about this for a long time, but lately the frequency of your outbursts seems to have increased, and you're being more of a

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Joel Goldstick
On Thu, Mar 24, 2016 at 7:06 PM, Mark Lawrence wrote: > On 24/03/2016 22:45, c...@isbd.net wrote: > >> Mark Lawrence wrote: >> >>> On 24/03/2016 22:08, c...@isbd.net wrote: >>> If you do find anything like c.l.p for Javascript, let us know... > > OK! :-) >>> I'd try

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Mark Lawrence
On 24/03/2016 22:45, c...@isbd.net wrote: Mark Lawrence wrote: On 24/03/2016 22:08, c...@isbd.net wrote: If you do find anything like c.l.p for Javascript, let us know... OK! :-) I'd try c.l.bartc as he is the world's leading expert on everything that you need to know about any languag

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Mark Lawrence
On 24/03/2016 22:49, Chris Angelico wrote: On Fri, Mar 25, 2016 at 9:31 AM, Mark Lawrence wrote: On 24/03/2016 22:08, c...@isbd.net wrote: If you do find anything like c.l.p for Javascript, let us know... OK! :-) I'd try c.l.bartc as he is the world's leading expert on everything that

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread cl
Mark Lawrence wrote: > On 24/03/2016 22:08, c...@isbd.net wrote: > > > >> If you do find anything like c.l.p for Javascript, let us know... > >> > > OK! :-) > > > > I'd try c.l.bartc as he is the world's leading expert on everything that > you need to know about any language, whereby the only t

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Chris Angelico
On Fri, Mar 25, 2016 at 9:31 AM, Mark Lawrence wrote: > On 24/03/2016 22:08, c...@isbd.net wrote: >> >> >>> If you do find anything like c.l.p for Javascript, let us know... >>> >> OK! :-) >> > > I'd try c.l.bartc as he is the world's leading expert on everything that you > need to know about any

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Mark Lawrence
On 12/03/2016 01:16, BartC wrote: Please go and play with this. https://www.ibm.com/developerworks/community/blogs/jfp/entry/A_Comparison_Of_C_Julia_Python_Numba_Cython_Scipy_and_BLAS_on_LU_Factorization?lang=en -- My fellow Pythonistas, ask not what our language can do for you, ask what you ca

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Mark Lawrence
On 24/03/2016 14:37, Rustom Mody wrote: On Thursday, March 24, 2016 at 7:46:55 PM UTC+5:30, Marko Rauhamaa wrote: BartC : And forgetting Python for a minute and concentrating only on its byte-code as a language in its own right, how would you go about the job of streamlining it? Really, you

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Mark Lawrence
On 24/03/2016 22:08, c...@isbd.net wrote: If you do find anything like c.l.p for Javascript, let us know... OK! :-) I'd try c.l.bartc as he is the world's leading expert on everything that you need to know about any language, whereby the only thing to know is how fast is it. It's just

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread cl
Grant Edwards wrote: > On 2016-03-24, c...@isbd.net wrote: > > > I use Python wherever I can and find this list (as a usenet group > > via gmane) an invaluable help at times. > > > > Occasionally I have to make forays into Javascript, can anyone > > recommend a place similar to this list where J

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Mark Lawrence
On 24/03/2016 19:54, BartC wrote: On 24/03/2016 18:10, Steven D'Aprano wrote: On Fri, 25 Mar 2016 12:01 am, BartC wrote: Then those numbers are pointless. Yes, they would need some adjustment to do this stuff properly. Please give up before you get sued by the families of the people who

Re: [OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread Grant Edwards
On 2016-03-24, c...@isbd.net wrote: > I use Python wherever I can and find this list (as a usenet group > via gmane) an invaluable help at times. > > Occasionally I have to make forays into Javascript, can anyone > recommend a place similar to this list where Javascript questions > can be asked?

[OT'ish] Is there a list as good as this for Javascript

2016-03-24 Thread cl
I use Python wherever I can and find this list (as a usenet group via gmane) an invaluable help at times. Occasionally I have to make forays into Javascript, can anyone recommend a place similar to this list where Javascript questions can be asked? The trouble is that there are very many usenet J

Re: Tkinter --> Why multiple windows

2016-03-24 Thread kevind0718
On Thursday, March 24, 2016 at 4:29:03 PM UTC-4, Random832 wrote: > On Thu, Mar 24, 2016, at 16:24, kevind0...@gmail.com wrote: > > Hello: > > > > newbie Tkinter question > > > > If I run the code below two windows appear. > > One empty and one with the text box and button. > > The empty one is

Re: Tkinter --> Why multiple windows

2016-03-24 Thread Random832
On Thu, Mar 24, 2016, at 16:24, kevind0...@gmail.com wrote: > Hello: > > newbie Tkinter question > > If I run the code below two windows appear. > One empty and one with the text box and button. The empty one is the root window. -- https://mail.python.org/mailman/listinfo/python-list

Tkinter --> Why multiple windows

2016-03-24 Thread kevind0718
Hello: newbie Tkinter question If I run the code below two windows appear. One empty and one with the text box and button. Why? please KD from Tkinter import * class MyDialog: def __init__(self, parent): top = self.top = Toplevel(parent) Label(top, text="Value").pack(

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread BartC
On 24/03/2016 18:10, Steven D'Aprano wrote: On Fri, 25 Mar 2016 12:01 am, BartC wrote: Python 3 (on Windows) might take 200ns. Clisp is 1300ns (interpreted, presumably). Ruby 170ns. Lua 80ns. Mine 10-20ns. Unoptimised C is 4ns, but this is not executing code indirectly as most of the rest have

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Michael Torrie
On 03/21/2016 06:43 AM, BartC wrote: > On 21/03/2016 12:08, Ned Batchelder wrote: >> On Sunday, March 20, 2016 at 9:15:32 PM UTC-4, BartC wrote: >>> >>> A tokeniser along those lines in Python, with most of the bits filled >>> in, is here: >>> >>> http://pastebin.com/dtM8WnFZ >>> >> >> Bart, we get

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Jon Ribbens
On 2016-03-24, Steven D'Aprano wrote: > On Fri, 25 Mar 2016 02:03 am, Jon Ribbens wrote: >> On 2016-03-24, BartC wrote: >>> On 24/03/2016 14:08, Jon Ribbens wrote: if you thought you needed to do that then most likely what you should actually be doing is re-writing your code so you no l

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread alister
On Thu, 24 Mar 2016 14:28:32 +, BartC wrote: > On 24/03/2016 14:01, Chris Angelico wrote: > >> I don't, until it's pointed out. At that point, someone who respects >> the language will at least pay *some* heed to the changed >> recommendations; what we're seeing here is that he continues to u

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread alister
On Thu, 24 Mar 2016 14:04:53 +, BartC wrote: > On 24/03/2016 13:50, Steven D'Aprano wrote: >> On Thu, 24 Mar 2016 02:24 pm, Chris Angelico wrote: >> >> >>> This is how you're currently evaluating Python. Instead of starting >>> with the most simple and obvious code >> >> One problem is that wh

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Steven D'Aprano
On Fri, 25 Mar 2016 12:01 am, BartC wrote: > But there are all sorts of micro-micro-benchmarks that can concentrate > on a single byte-code. For example, how long does it take to call an > empty function with no parameters? Just putting such a call into a > simple loop can be effective: > > Python

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread BartC
On 24/03/2016 17:13, Ned Batchelder wrote: On Thursday, March 24, 2016 at 12:12:55 PM UTC-4, BartC wrote: On 24/03/2016 15:30, Ned Batchelder wrote: On Thursday, March 24, 2016 at 9:51:11 AM UTC-4, Steven D'Aprano wrote: You know what is missing from this conversation? For one of Bart's criti

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Steven D'Aprano
On Fri, 25 Mar 2016 02:03 am, Jon Ribbens wrote: > On 2016-03-24, BartC wrote: >> On 24/03/2016 14:08, Jon Ribbens wrote: >>> if you thought you needed to do that then most likely what you >>> should actually be doing is re-writing your code so you no longer >>> need to. However, you could do: >>

Re: newbie question

2016-03-24 Thread Sven R. Kunze
On 24.03.2016 14:22, Matt Wheeler wrote: On Thu, 24 Mar 2016 11:10 Sven R. Kunze, wrote: On 24.03.2016 11:57, Matt Wheeler wrote: import ast s = "(1, 2, 3, 4)" t = ast.literal_eval(s) t (1, 2, 3, 4) I suppose that's the better solution in terms of safety. It has the added advantage that t

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Steven D'Aprano
On Fri, 25 Mar 2016 01:16 am, BartC wrote: > Or is the Pythonic way, when you want to change some elements of a list > to just build a new one that incorporates those changes? If you are only changing a few elements, or one at a time in some random order, then just change the element. Lists have

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Steven D'Aprano
On Fri, 25 Mar 2016 01:04 am, BartC wrote: > On 24/03/2016 13:50, Steven D'Aprano wrote: >> On Thu, 24 Mar 2016 02:24 pm, Chris Angelico wrote: >> >> >>> This is how you're currently evaluating Python. Instead of starting >>> with the most simple and obvious code >> >> One problem is that what cou

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Ned Batchelder
On Thursday, March 24, 2016 at 12:12:55 PM UTC-4, BartC wrote: > On 24/03/2016 15:30, Ned Batchelder wrote: > > On Thursday, March 24, 2016 at 9:51:11 AM UTC-4, Steven D'Aprano wrote: > >> You know what is missing from this conversation? > >> > >> For one of Bart's critics to actually show faster c

Re: Python

2016-03-24 Thread Zachary Ware
On Thu, Mar 24, 2016 at 11:21 AM, Niyoo *Unkown* wrote: > The reason I uninstalled Python was because it was 32 bit not 64 bit and I > couldn't find the 64 bit version. Have a look at this page: https://www.python.org/downloads/windows/ The 64 bit versions are the "x86_64" ones. -- Zach -- ht

Re: Python

2016-03-24 Thread alister
On Thu, 24 Mar 2016 12:21:29 -0400, Niyoo *Unkown* wrote: > The reason I uninstalled Python was because it was 32 bit not 64 bit and > I couldn't find the 64 bit version. that's nice -- That which is not good for the swarm, neither is it good for the bee. -- https://mail.python.org/mailman/l

Python

2016-03-24 Thread Niyoo *Unkown*
The reason I uninstalled Python was because it was 32 bit not 64 bit and I couldn't find the 64 bit version. -- https://mail.python.org/mailman/listinfo/python-list

Re: Key Binding Problem

2016-03-24 Thread Wildman via Python-list
On Thu, 24 Mar 2016 08:06:28 -0400, Dennis Lee Bieber wrote: > On Wed, 23 Mar 2016 21:17:57 -0500, Wildman via Python-list > declaimed the following: > >> >>I was referring to procedures called by a button click as >>opposed to a procedure calledd from elsewhere in the code. >>I guess there is n

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread BartC
On 24/03/2016 15:30, Ned Batchelder wrote: On Thursday, March 24, 2016 at 9:51:11 AM UTC-4, Steven D'Aprano wrote: You know what is missing from this conversation? For one of Bart's critics to actually show faster code. There's plenty of people telling him off for writing unpythonic and slow c

Re: Connect to Default Printer

2016-03-24 Thread Terry Reedy
On 3/23/2016 8:39 PM, Bryon Fawcett wrote: Could you please advise me how to connect the python software to my default printer. IDLE prints to default printer with function print_window in idlelib/IOBinding.py. The two GetOption calls return these two strings (from config-main.def). For p

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Random832
On Thu, Mar 24, 2016, at 11:18, BartC wrote: > On 24/03/2016 15:03, Jon Ribbens wrote: > > No it isn't, it's replacing the elements in-place, > > Replace them with what, if not an entirely new list built from > '[0]*len(L)'? Well, the *contents* of such a list, obviously. But the original list's

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Ned Batchelder
On Thursday, March 24, 2016 at 9:51:11 AM UTC-4, Steven D'Aprano wrote: > You know what is missing from this conversation? > > For one of Bart's critics to actually show faster code. > > There's plenty of people telling him off for writing unpythonic and slow > code, but I haven't seen anyone act

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Jon Ribbens
On 2016-03-24, BartC wrote: > On 24/03/2016 14:08, Jon Ribbens wrote: >> if you thought you needed to do that then most likely what you >> should actually be doing is re-writing your code so you no longer >> need to. However, you could do: >> >>L[:] = [0] * len(L) > > OK, but that's just build

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Jon Ribbens
On 2016-03-24, BartC wrote: > On 24/03/2016 15:03, Jon Ribbens wrote: >> On 2016-03-24, BartC wrote: >>> On 24/03/2016 14:08, Jon Ribbens wrote: if you thought you needed to do that then most likely what you should actually be doing is re-writing your code so you no longer need to.

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread BartC
On 24/03/2016 15:03, Jon Ribbens wrote: On 2016-03-24, BartC wrote: On 24/03/2016 14:08, Jon Ribbens wrote: if you thought you needed to do that then most likely what you should actually be doing is re-writing your code so you no longer need to. However, you could do: L[:] = [0] * len(L)

Re: newbie question

2016-03-24 Thread Grant Edwards
On 2016-03-24, Steven D'Aprano wrote: > On Thu, 24 Mar 2016 09:49 pm, David Palao wrote: > >> Hi, >> Use "eval": >> s = "(1, 2, 3, 4)" >> t = eval(s) > > Don't use eval unless you absolutely, categorically, 100% trust the source > of the string. And then still don't use it. :) eval is only safe

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Random832
On Thu, Mar 24, 2016, at 10:49, BartC wrote: > On 24/03/2016 14:34, Jussi Piitulainen wrote: > > You understand correctly, but it may be more natural in practice to > > write it this way: > > > > for k, item in enumerate(them): > > them[k] = f(item) > > > > I _think_ I might write i

Re: netrc and password containing whitespace

2016-03-24 Thread Lele Gaifax
Random832 writes: > The implementation seems very basic... I ran into trouble trying to > store entries with no password (with the idea in mind of having my > program prompt for the password), though, out of curiosity, does ftp > handle your quoted passwords? Uhm, dunno :-) I think it's been mor

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread BartC
On 24/03/2016 14:34, Jussi Piitulainen wrote: BartC writes: On 24/03/2016 14:08, Jon Ribbens wrote: On 2016-03-24, BartC wrote: I'd presumably have to do: for i in range(len(L)): L[i]=0 That's kind've a weird thing to want to do; The thing I'm trying to demonstrate is changing a

Re: netrc and password containing whitespace

2016-03-24 Thread Random832
On Thu, Mar 24, 2016, at 06:14, Lele Gaifax wrote: > I tried to insert an entry in my ~/.netrc for an account having a > password that contains a space, something like: > > machine my-host-name login myname password "My Password" > > The standard library netrc module does not seem able to parse i

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Mark Lawrence
On 24/03/2016 14:22, Matt Wheeler wrote: The point is that one can just do `mylist.clear()` Only in 3.3 and up. In Python 2.x you have to do it the old fashioned, long winded way. mylist[:] = [] -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for o

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Rustom Mody
On Thursday, March 24, 2016 at 7:46:55 PM UTC+5:30, Marko Rauhamaa wrote: > BartC : > > > And forgetting Python for a minute and concentrating only on its > > byte-code as a language in its own right, how would you go about the > > job of streamlining it? > Really, your optimization efforts shoul

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread BartC
On 24/03/2016 14:01, Chris Angelico wrote: I don't, until it's pointed out. At that point, someone who respects the language will at least pay *some* heed to the changed recommendations; what we're seeing here is that he continues to use C idioms and then complain that Python is slow. I don't ex

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Jussi Piitulainen
BartC writes: > On 24/03/2016 14:08, Jon Ribbens wrote: >> On 2016-03-24, BartC wrote: >>> I'd presumably have to do: >>> >>>for i in range(len(L)): >>> L[i]=0 >> >> That's kind've a weird thing to want to do; > > The thing I'm trying to demonstrate is changing an element of a list > that

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Marko Rauhamaa
BartC : > And forgetting Python for a minute and concentrating only on its > byte-code as a language in its own right, how would you go about the > job of streamlining it? CPython's bytecode is not crucial for CPython's execution speed. The bytecode is mainly a method of improving the performance

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Matt Wheeler
On 24 March 2016 at 14:04, BartC wrote: >On 24/03/2016 13:50, Steven D'Aprano wrote: >> for i in range(len(mylist)-1, -1, 0): >> del mylist[i] > > That's wouldn't be I'd call clearing a list, more like destroying it > completely! Look more closely. The semantics of using the del keyword with

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread BartC
On 24/03/2016 14:08, Jon Ribbens wrote: On 2016-03-24, BartC wrote: On 24/03/2016 13:50, Steven D'Aprano wrote: Likewise clearing a list: for i in range(len(mylist)-1, -1, 0): del mylist[i] That's wouldn't be I'd call clearing a list, more like destroying it completely! How would you

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Jon Ribbens
On 2016-03-24, BartC wrote: > On 24/03/2016 13:50, Steven D'Aprano wrote: >> Likewise clearing a list: >> >> for i in range(len(mylist)-1, -1, 0): >> del mylist[i] > > That's wouldn't be I'd call clearing a list, more like destroying it > completely! > > How would you actually clear a list b

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread BartC
On 24/03/2016 13:50, Steven D'Aprano wrote: On Thu, 24 Mar 2016 02:24 pm, Chris Angelico wrote: This is how you're currently evaluating Python. Instead of starting with the most simple and obvious code One problem is that what counts as "simple and obvious" depends on what you are used to. C

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Chris Angelico
On Fri, Mar 25, 2016 at 12:50 AM, Steven D'Aprano wrote: > On Thu, 24 Mar 2016 02:24 pm, Chris Angelico wrote: > > >> This is how you're currently evaluating Python. Instead of starting >> with the most simple and obvious code > > One problem is that what counts as "simple and obvious" depends on

Re: newbie question

2016-03-24 Thread Steven D'Aprano
On Thu, 24 Mar 2016 09:49 pm, David Palao wrote: > Hi, > Use "eval": > s = "(1, 2, 3, 4)" > t = eval(s) Don't use eval unless you absolutely, categorically, 100% trust the source of the string. Otherwise, you are letting the person who provided the string run any code they like on your computer.

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Steven D'Aprano
On Thu, 24 Mar 2016 02:24 pm, Chris Angelico wrote: > This is how you're currently evaluating Python. Instead of starting > with the most simple and obvious code One problem is that what counts as "simple and obvious" depends on what you are used to. Coming from a background of Pascal, iteratin

Re: newbie question

2016-03-24 Thread Matt Wheeler
On Thu, 24 Mar 2016 11:10 Sven R. Kunze, wrote: > On 24.03.2016 11:57, Matt Wheeler wrote: > import ast > s = "(1, 2, 3, 4)" > t = ast.literal_eval(s) > t > > (1, 2, 3, 4) > > I suppose that's the better solution in terms of safety. > It has the added advantage that the enqui

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread BartC
On 24/03/2016 03:24, Chris Angelico wrote: On Thu, Mar 24, 2016 at 12:41 AM, BartC wrote: To extend this analogy better, executing byte-code to directly perform a task itself might be equivalent to travelling on foot, while everyone is suggesting taking the bus, tube or taxi. It's easy to se

Re: Connect to Default Printer

2016-03-24 Thread Grant Edwards
On 2016-03-24, Bryon Fawcett wrote: > Could you please advise me how to connect the python software to my default > printer. import os os.popen("lpr","w").write("Hi there, this just got printed!\r\n") -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: newbie question

2016-03-24 Thread Steven D'Aprano
On Thu, 24 Mar 2016 09:39 pm, ast wrote: > Hi > > I have a string which contains a tupe, eg: > > s = "(1, 2, 3, 4)" > > and I want to recover the tuple in a variable t > > t = (1, 2, 3, 4) > > how would you do ? py> import ast py> ast.literal_eval("(1, 2, 3, 4)") (1, 2, 3, 4) -- Steven

Re: newbie question

2016-03-24 Thread Sven R. Kunze
On 24.03.2016 11:57, Matt Wheeler wrote: import ast s = "(1, 2, 3, 4)" t = ast.literal_eval(s) t (1, 2, 3, 4) I suppose that's the better solution in terms of safety. -- https://mail.python.org/mailman/listinfo/python-list

Re: newbie question

2016-03-24 Thread Tim Chase
On 2016-03-24 11:49, David Palao wrote: >> s = "(1, 2, 3, 4)" >> >> and I want to recover the tuple in a variable t >> >> t = (1, 2, 3, 4) >> >> how would you do ? > > Use "eval": > s = "(1, 2, 3, 4)" > t = eval(s) Using eval() has security implications. Use ast.literal_eval for safety instead:

Re: newbie question

2016-03-24 Thread Matt Wheeler
>>> import ast >>> s = "(1, 2, 3, 4)" >>> t = ast.literal_eval(s) >>> t (1, 2, 3, 4) On 24 March 2016 at 10:39, ast wrote: > Hi > > I have a string which contains a tupe, eg: > > s = "(1, 2, 3, 4)" > > and I want to recover the tuple in a variable t > > t = (1, 2, 3, 4) > > how would you do ? > >

Re: newbie question

2016-03-24 Thread ast
"David Palao" a écrit dans le message de news:mailman.86.1458816553.2244.python-l...@python.org... Hi, Use "eval": s = "(1, 2, 3, 4)" t = eval(s) Best Thank you -- https://mail.python.org/mailman/listinfo/python-list

Re: newbie question

2016-03-24 Thread David Palao
Hi, Use "eval": s = "(1, 2, 3, 4)" t = eval(s) Best 2016-03-24 11:39 GMT+01:00 ast : > Hi > > I have a string which contains a tupe, eg: > > s = "(1, 2, 3, 4)" > > and I want to recover the tuple in a variable t > > t = (1, 2, 3, 4) > > how would you do ? > > > -- > https://mail.python.org/mailma

newbie question

2016-03-24 Thread ast
Hi I have a string which contains a tupe, eg: s = "(1, 2, 3, 4)" and I want to recover the tuple in a variable t t = (1, 2, 3, 4) how would you do ? -- https://mail.python.org/mailman/listinfo/python-list

netrc and password containing whitespace

2016-03-24 Thread Lele Gaifax
Hi all, I tried to insert an entry in my ~/.netrc for an account having a password that contains a space, something like: machine my-host-name login myname password "My Password" The standard library netrc module does not seem able to parse it, raising a NetrcParseError. Other programs (Emacs,

Re: Bug in python34 package struct

2016-03-24 Thread Marko Rauhamaa
Rudi Lopez Lopez : > from struct import pack > > print(hex(126)) > print(pack('>H',126)) I can't see any bug. The tilde (~) has an ASCII code 126. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug in python34 package struct

2016-03-24 Thread Chris Angelico
On Thu, Mar 24, 2016 at 7:17 PM, Rudi Lopez Lopez wrote: > from struct import pack > > print(hex(126)) > print(pack('>H',126)) Explain the bug? ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Bug in python34 package struct

2016-03-24 Thread Rudi Lopez Lopez
from struct import pack print(hex(126)) print(pack('>H',126)) Rudi G. Lopez -- https://mail.python.org/mailman/listinfo/python-list

Re: Python to do CDC on XML files

2016-03-24 Thread Peter Otten
Bruce Kirk wrote: > Does anyone know of any existing projects on how to generate a change data > capture on 2 very large xml files. > > The xml structures are the same, it is the data within the files that may > differ. > > I need to take a XML file from yesterday and compare it to the XML file

Re: Python to do CDC on XML files

2016-03-24 Thread Chris Angelico
On Thu, Mar 24, 2016 at 10:57 AM, Bruce Kirk wrote: > I agree, the challenge is the volume of the data to compare is 13. Million > records. So it needs to be very fast 13M records is a good lot. To what extent can the data change? You may find it easiest to do some sort of conversion to text, th