Re: Is it possible to get the Physical memory address of a variable in python?

2017-01-24 Thread dieter
Sourabh Kalal writes: > how we can access the value from using id.. > like x=10 > id(x) > 3235346364 > > how i can read value 10 using id 3235346364 You should not do this (read the value instead by looking at "x") -- unless you are debugging at "C" level. For "C" level debugging, there is a set

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 24/01/2017 04:41, Chris Angelico wrote: On Tue, Jan 24, 2017 at 3:22 PM, Steven D'Aprano wrote: But more seriously, it's easy to typo an extra indent. It's harder to typo "endif" when you actually meant to type, oh, "ending = 1 if condition else 3", say. So faced with ambiguity, and the insi

Re: How coding in Python is bad for you

2017-01-24 Thread Chris Angelico
On Tue, Jan 24, 2017 at 10:52 PM, BartC wrote: >> Remember: If you have only one clock, it might be right and it might >> be wrong, but it's consistent. If you have two clocks and they >> disagree, you have no clue what the time is. > > > I've actually got three wall clocks. Usually only one will

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 24/01/2017 04:22, Steven D'Aprano wrote: On Tuesday 24 January 2017 13:38, Chris Angelico wrote: On Tue, Jan 24, 2017 at 12:47 PM, BartC wrote: if 0 then print ("one") print ("two") endif My point is that you *assume* that showing just "three" is the correct behaviour. Why? Why do

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 24/01/2017 11:58, Chris Angelico wrote: On Tue, Jan 24, 2017 at 10:52 PM, BartC wrote: Remember: If you have only one clock, it might be right and it might be wrong, but it's consistent. If you have two clocks and they disagree, you have no clue what the time is. I've actually got three w

Re: How coding in Python is bad for you

2017-01-24 Thread Skip Montanaro
I have nothing to add to the discussion other than too note that Gmail marks many of the messages as spam. :-) Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: How coding in Python is bad for you

2017-01-24 Thread MRAB
On 2017-01-24 12:12, BartC wrote: On 24/01/2017 04:22, Steven D'Aprano wrote: On Tuesday 24 January 2017 13:38, Chris Angelico wrote: On Tue, Jan 24, 2017 at 12:47 PM, BartC wrote: if 0 then print ("one") print ("two") endif My point is that you *assume* that showing just "three" is

Re: PhotoImage.paste

2017-01-24 Thread MRAB
On 2017-01-24 07:09, rryan@gmail.com wrote: I'm trying to build a tkinter GUI with python 3.5, and would like to interactively adjust the color palette for an image by moving the mouse in the canvas using PIL. In pseudo-code, I have something like palette=color_map(x,y) # x,y are scalar

Re: How coding in Python is bad for you

2017-01-24 Thread alister
On Tue, 24 Jan 2017 08:11:02 +1100, Chris Angelico wrote: > On Tue, Jan 24, 2017 at 8:04 AM, Adam M > wrote: >> On Monday, January 23, 2017 at 3:41:17 PM UTC-5, Jon Ribbens wrote: >>> On 2017-01-23, alister wrote: >>> > On Tue, 24 Jan 2017 07:19:42 +1100, Chris Angelico wrote: >>> >> I believe t

Re: How coding in Python is bad for you

2017-01-24 Thread alister
On Mon, 23 Jan 2017 20:39:26 +, Jon Ribbens wrote: > On 2017-01-23, alister wrote: >> On Tue, 24 Jan 2017 07:19:42 +1100, Chris Angelico wrote: >>> I believe that's "bad for you" in the sense that chocolate is bad for >>> you. >>> >>> It isn't. >> >> chocolate is a poison (lethal dose for a

Re: How coding in Python is bad for you

2017-01-24 Thread Jon Ribbens
On 2017-01-24, alister wrote: > On Mon, 23 Jan 2017 20:39:26 +, Jon Ribbens wrote: >> That's a meaningless statement. *Everything* is a poison in sufficient >> quantities. > > indees when I here someone saying "I won't have any xyz because they have > heard that too much is bad for them" I in

Re: PhotoImage.paste

2017-01-24 Thread rryan . asu
Hi MRAB Yes, I am pasting every time the mouse moves (or every time the tk event handler gets called). I thought about the after method, and I guess i can try to implement that. It seems like that would help in the "jerkiness" of the GUI's response, but it leaves me kinda disappointed. I obv

Re: How coding in Python is bad for you

2017-01-24 Thread Ben Bacarisse
Chris Angelico writes: > ... I teach JavaScript as well as Python, and I've seen some > pretty horrendous indentation flaws (examples available if people ask > privately, but I will anonymize them because I'm not here to shame > students) - but there have been nearly as many cases where the > ind

Re: How coding in Python is bad for you

2017-01-24 Thread Chris Angelico
On Wed, Jan 25, 2017 at 2:51 AM, Ben Bacarisse wrote: > Chris Angelico writes: > >> ... I teach JavaScript as well as Python, and I've seen some >> pretty horrendous indentation flaws (examples available if people ask >> privately, but I will anonymize them because I'm not here to shame >> stude

Re: How coding in Python is bad for you

2017-01-24 Thread alister
On Tue, 24 Jan 2017 14:28:55 +, Jon Ribbens wrote: > On 2017-01-24, alister wrote: >> On Mon, 23 Jan 2017 20:39:26 +, Jon Ribbens wrote: >>> That's a meaningless statement. *Everything* is a poison in sufficient >>> quantities. >> >> indees when I here someone saying "I won't have any xyz

Re: How coding in Python is bad for you

2017-01-24 Thread Ben Bacarisse
Chris Angelico writes: > On Wed, Jan 25, 2017 at 2:51 AM, Ben Bacarisse wrote: >> Chris Angelico writes: >> >>> ... I teach JavaScript as well as Python, and I've seen some >>> pretty horrendous indentation flaws (examples available if people ask >>> privately, but I will anonymize them becaus

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 24/01/2017 15:51, Ben Bacarisse wrote: Chris Angelico writes: ... I teach JavaScript as well as Python, and I've seen some pretty horrendous indentation flaws (examples available if people ask privately, but I will anonymize them because I'm not here to shame students) - but there have been

Re: How coding in Python is bad for you

2017-01-24 Thread Steve D'Aprano
On Wed, 25 Jan 2017 03:21 am, Ben Bacarisse wrote: > Chris Angelico writes: > >> On Wed, Jan 25, 2017 at 2:51 AM, Ben Bacarisse >> wrote: [...] >>> Can I ask what editor(s) your students have available? I ask because >>> I've not given a moment's thought to indentation or what bracket matches

Re: How coding in Python is bad for you

2017-01-24 Thread Grant Edwards
On 2017-01-24, Chris Angelico wrote: > No no no. You have two orthogonal styles (indentation and tokens), but > then you added another of the same style (another pair of tokens). You > need a third orthogonal style. I suggest that each nesting level be > heralded by an increase in indentation, an

Re: PhotoImage.paste

2017-01-24 Thread Peter Otten
rryan@gmail.com wrote: > I'm trying to build a tkinter GUI with python 3.5, and would like to > interactively adjust the color palette for an image by moving the mouse in > the canvas using PIL. In pseudo-code, I have something like > > palette=color_map(x,y) # x,y are scalars indicating t

Re: How coding in Python is bad for you

2017-01-24 Thread Steve D'Aprano
On Tue, 24 Jan 2017 10:52 pm, BartC wrote: >> if condition: >> statement >> endif >> statement >> endif >> >> What's this code meant to do? Can't know. > > But whatever it does, a language that enforces 'endif' would report an > error, so requiring further investigation. Without the 'endi

Re: How coding in Python is bad for you

2017-01-24 Thread Chris Angelico
On Wed, Jan 25, 2017 at 3:21 AM, Ben Bacarisse wrote: > Chris Angelico writes: > >> On Wed, Jan 25, 2017 at 2:51 AM, Ben Bacarisse wrote: >>> Chris Angelico writes: >>> ... I teach JavaScript as well as Python, and I've seen some pretty horrendous indentation flaws (examples availabl

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 24/01/2017 17:07, Steve D'Aprano wrote: On Tue, 24 Jan 2017 10:52 pm, BartC wrote: if condition: statement endif statement endif What's this code meant to do? Can't know. But whatever it does, a language that enforces 'endif' would report an error, so requiring further investigati

Re: String Replacement

2017-01-24 Thread Peter Pearson
On Mon, 23 Jan 2017 13:23:38 -0800 (PST), subhabangal...@gmail.com wrote: > I have a string like > > "Trump is $ the president of USA % Obama was $ the president > of USA % Putin is $ the premier of Russia%" > > Here, I want to extract the portions from $...%, which would be > > "the president of

Re: How coding in Python is bad for you

2017-01-24 Thread Ben Bacarisse
Steve D'Aprano writes: > On Wed, 25 Jan 2017 03:21 am, Ben Bacarisse wrote: > >> Chris Angelico writes: >> >>> On Wed, Jan 25, 2017 at 2:51 AM, Ben Bacarisse >>> wrote: > [...] Can I ask what editor(s) your students have available? I ask because I've not given a moment's thought to

Re: How coding in Python is bad for you

2017-01-24 Thread Ben Bacarisse
BartC writes: > On 24/01/2017 15:51, Ben Bacarisse wrote: >> Chris Angelico writes: >> >>> ... I teach JavaScript as well as Python, and I've seen some >>> pretty horrendous indentation flaws (examples available if people ask >>> privately, but I will anonymize them because I'm not here to sham

Re: PhotoImage.paste

2017-01-24 Thread rryan . asu
Hi Peter, Yes, that was the first thing I did, even before using the paste method. I read the warning on effbot and other sites, and simply coded it up as new_image.putpalette(palette) photo=ImageTk.PhotoImage(image=new_image) canvas_object=canvas.create_iamge(x,y,image=photo) And this was a s

Re: How coding in Python is bad for you

2017-01-24 Thread Ben Bacarisse
Chris Angelico writes: > On Wed, Jan 25, 2017 at 3:21 AM, Ben Bacarisse wrote: >> Chris Angelico writes: >> >>> On Wed, Jan 25, 2017 at 2:51 AM, Ben Bacarisse wrote: Chris Angelico writes: > ... I teach JavaScript as well as Python, and I've seen some > pretty horrendous in

How an editor can help with block nesting (was Re: How coding in Python is bad for you)

2017-01-24 Thread Chris Angelico
On Wed, Jan 25, 2017 at 6:31 AM, Ben Bacarisse wrote: > I'm not talking about detecting errors -- that's for the programmer -- > but the editor can help the programmer to be sure they wrote what they > meant by doing things like matching brackets and auto-indenting code in > {}s. (I'm replying to

With class as contextmanager

2017-01-24 Thread This Wiederkehr
Hellou having a class definition: class Test(): @classmethod def __enter__(cls): pass @classmethod def __exit__(cls, exception_type, execption_value, callback): pass now using this as a contextmanager does not work, even though Test is an object and has the two required methods __enter

Re: With class as contextmanager

2017-01-24 Thread Ian Kelly
On Tue, Jan 24, 2017 at 2:31 PM, This Wiederkehr wrote: > Hellou > > having a class definition: > > class Test(): > > @classmethod > def __enter__(cls): > pass > > @classmethod > def __exit__(cls, exception_type, execption_value, callback): > pass > > now using this as a contextmanager doe

Re: With class as contextmanager

2017-01-24 Thread Ethan Furman
On 01/24/2017 01:31 PM, This Wiederkehr wrote: having a class definition: class Test(): @classmethod def __enter__(cls): pass @classmethod def __exit__(cls, exception_type, execption_value, callback): pass now using this as a contextmanager does not work, even though Test is an obj

Re: With class as contextmanager

2017-01-24 Thread Ethan Furman
On 01/24/2017 02:35 PM, Ethan Furman wrote: On 01/24/2017 01:31 PM, This Wiederkehr wrote: having a class definition: class Test(): @classmethod def __enter__(cls): pass @classmethod def __exit__(cls, exception_type, execption_value, callback): pass now using this as a contextman

Referencing section name by interpolation in ConfigParser

2017-01-24 Thread Hans-Peter Jansen
Hi, I would like to use a interpolated section name, e.g.: [Section] secref: %{section}s/whatever should result in: >>> config['Section']['secref'] 'Section/whatever' Any idea anybody, how to archive this with minimum fuzz? Thanks, Pete -- https://mail.python.org/mailman/listinfo/python-list

Re: How an editor can help with block nesting (was Re: How coding in Python is bad for you)

2017-01-24 Thread Steve D'Aprano
On Wed, 25 Jan 2017 08:19 am, Chris Angelico wrote: > I kinda like the idea of showing what the innermost active block > heading is for any given line of code. That would be fairly > straight-forward: scroll up till you find a non-blank line with less > indentation than the one you're on, and put

Re: How an editor can help with block nesting (was Re: How coding in Python is bad for you)

2017-01-24 Thread Chris Angelico
On Wed, Jan 25, 2017 at 12:31 PM, Steve D'Aprano wrote: >> With my JavaScript students, the greatest help is probably a keystroke >> beautifier. You edit your code with sloppy indentation, and then bam, >> it reindents for you. > > Really? I wouldn't want that, or find it helpful to type badly for

Re: How an editor can help with block nesting (was Re: How coding in Python is bad for you)

2017-01-24 Thread Dan Sommers
On Wed, 25 Jan 2017 12:31:11 +1100, Steve D'Aprano wrote: > But now I type something which cannot possibly be indented there: > > def func(a, b): > if condition: > spam() > elif something: | > > and hit ENTER again. There's nothing ambiguous about this, and th

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 25/01/2017 01:04, Dennis Lee Bieber wrote: On Tue, 24 Jan 2017 17:50:56 +, BartC declaimed the following: If I've accidentally lost a space or tab while messing about with it, and it's significant, I would rather the compiler reported it! As I'm not going to spot it by perusing the 15,

Re: How coding in Python is bad for you

2017-01-24 Thread Tim Chase
On 2017-01-24 20:04, Dennis Lee Bieber wrote: >>You don't know that. If this has been pasted from elsewhere, you >>need to match up the indentation level with the current code. > > So? The editor(s) I tend to use have the ability to shift > indent in/out for selected blocks. Do the paste, hi

Re: With class as contextmanager

2017-01-24 Thread Terry Reedy
On 1/24/2017 4:31 PM, This Wiederkehr wrote: having a class definition: class Test(): @classmethod def __enter__(cls): pass @classmethod def __exit__(cls, exception_type, execption_value, callback): pass now using this as a contextmanager does not work, even though Test is an object

Re: How coding in Python is bad for you

2017-01-24 Thread Gregory Ewing
Dennis Lee Bieber wrote: While I'm trying to figure out what significance Centrum vitamins have with being "non-GMO"... Possibly they're just complying with some legal requirement or other to declare whether the product has any GMO components. If so, bit of a silly regulation, I'll agre

Re: PhotoImage.paste

2017-01-24 Thread Gregory Ewing
Dennis Lee Bieber wrote: But practically everything these days uses true/high color, in which each pixel encodes the exact color to be displayed. This means that changing all matching pixels from one given color to another given color requires rewriting those pixels color data. Yes, and

any one used moviepy please come in!!! I need help, thanks!

2017-01-24 Thread Tony Chen
I have to use moviepy in one of my project. So I downloaded it, and tried the example code on the website. It gives me this error. Anyone can give me some help? Thank you very much! it gives this error: [MoviePy] This command returned an error !Traceback (most recent call last): File "tst.py",

Re: any one used moviepy please come in!!! I need help, thanks!

2017-01-24 Thread Chris Angelico
On Wed, Jan 25, 2017 at 6:22 PM, Tony Chen wrote: > This error can be due to the fact that ImageMagick is not installed on your > computer, or (for Windows users) that you didn't specify the path to the > ImageMagick binary in file conf.py, or.that the path you specified is > incorrect So... i

Hide text in entry box when i click on it.(GUI using Tkinter in python)

2017-01-24 Thread hmmeeranrizvi18
Hello Guys, Here i am creating a entry box with some text,i need to hide the text when i click on it. Here is my code from Tkinter import * obj = Tk() b = Entry(obj,width=100) b.insert(0,"Enter the value to search") b.pack() mainloop() -- https://mail.python.org/mailman/listinfo/python-list

Re: How coding in Python is bad for you

2017-01-24 Thread Bob Martin
in 770220 20170124 070853 Chris Angelico wrote: >On Tue, Jan 24, 2017 at 6:00 PM, Bob Martin wrote: >> in 770207 20170124 005601 Chris Angelico wrote: >> >>>REXX has even less structure than Python - it doesn't even have >>>functions, just labels, so yo