Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-08 Thread jfong
David於 2019年9月8日星期日 UTC+8下午8時14分03秒寫道: > On Sun, 8 Sep 2019 at 21:05, wrote: > > David於 2019年9月8日星期日 UTC+8下午6時44分55秒寫道: > > > On Sun, 8 Sep 2019 at 20:25, wrote: > > > > > If I have two widgets created this way: > > > > t0 = tkinter.Text() > > > > t1 = tkinter.Text() > > > > How many Tk objects

Re: Color representation as rgb, int and hex

2019-09-08 Thread Chris Angelico
On Mon, Sep 9, 2019 at 6:37 AM Eko palypse wrote: > > > You haven't said whether your machine is big-endian or little-endian. > > Correct, it is little but I'm wondering why this isn't taking into account. > I thought a method called fromhex would imply that bytes for an integer > should be create

Re: Color representation as rgb, int and hex

2019-09-08 Thread Eko palypse
> ChrisA You are correct, but, sorry for not being clear what confused me. I assumed it would use the sys.byteorder but I guess this is simply a AssumedError exception. :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Color representation as rgb, int and hex

2019-09-08 Thread Eko palypse
> You haven't said whether your machine is big-endian or little-endian. Correct, it is little but I'm wondering why this isn't taking into account. I thought a method called fromhex would imply that bytes for an integer should be created and as that it would use the proper byte order to create it.

Re: Color representation as rgb, int and hex

2019-09-08 Thread Chris Angelico
On Mon, Sep 9, 2019 at 6:01 AM Eko palypse wrote: > > I'm confused about the following > > import sys > print(tuple(bytes.fromhex('282C34'))) > print(tuple((0x282C34).to_bytes(3, byteorder=sys.byteorder))) > > which results in > > (40, 44, 52) > (52, 44, 40) > > on my machine. Shouldn't I expect t

Re: [Python-ideas] Re: Automatic translation of Python to assembly language

2019-09-08 Thread Roel Schroeven
Skip Montanaro schreef op 8/09/2019 om 21:17: ChrisA> Your blog breaks the browser's Back button. Please don't do that; if ChrisA> you want people to read your content, make it easy for us to do so. Mark, I didn't even go that far. If you want me to read your blog, please load the individual es

Re: Color representation as rgb, int and hex

2019-09-08 Thread MRAB
On 2019-09-08 20:58, Eko palypse wrote: I'm confused about the following import sys print(tuple(bytes.fromhex('282C34'))) print(tuple((0x282C34).to_bytes(3, byteorder=sys.byteorder))) which results in (40, 44, 52) (52, 44, 40) on my machine. Shouldn't I expect the same result? You haven't s

Color representation as rgb, int and hex

2019-09-08 Thread Eko palypse
I'm confused about the following import sys print(tuple(bytes.fromhex('282C34'))) print(tuple((0x282C34).to_bytes(3, byteorder=sys.byteorder))) which results in (40, 44, 52) (52, 44, 40) on my machine. Shouldn't I expect the same result? Thank you Eren -- https://mail.python.org/mailman/list

Re: Finding lines in .txt file that contain keywords from two different set()

2019-09-08 Thread DL Neil via Python-list
On 9/09/19 4:02 AM, A S wrote: My problem is seemingly profound but I hope to make it sound as simplified as possible.Let me unpack the details..: ... These are the folders used for a better reference ( https://drive.google.com/open?id=1_LcceqcDhHnWW3Nrnwf5RkXPcnDfesq ). The files are

Re: Finding lines in .txt file that contain keywords from two different set()

2019-09-08 Thread MRAB
On 2019-09-08 17:02, A S wrote: My problem is seemingly profound but I hope to make it sound as simplified as possible.Let me unpack the details..: 1. I have one folder of Excel (.xlsx) files that serve as a data dictionary. -In Cell A1, the data source name is written in between brackets

Re: [Python-ideas] Re: Automatic translation of Python to assembly language

2019-09-08 Thread Skip Montanaro
ChrisA> Your blog breaks the browser's Back button. Please don't do that; if ChrisA> you want people to read your content, make it easy for us to do so. Mark, I didn't even go that far. If you want me to read your blog, please load the individual essays into separate pages, not a narrow scrolling

Re: local variable 'p' referenced before assignment

2019-09-08 Thread Pankaj Jangid
David writes: > https://docs.python.org/3/faq/programming.html#what-are-the-rules-for-local-and-global-variables-in-python > > " If a variable is assigned a value anywhere within the function’s body, > it’s assumed to be a local unless explicitly declared as global." > Coming with a baggage of

Re: [Python-ideas] Re: Automatic translation of Python to assembly language

2019-09-08 Thread Chris Angelico
On Mon, Sep 9, 2019 at 4:12 AM Mark @pysoniq wrote: > > "I don't think the ctypes wrapper in itself is very interesting." > > Well, we disagree on that! I think that automatic generation of a ctypes > wrapper to connect Python to assembly is interesting and a huge timesaver. > > "I don't know wh

Re: issue in handling CSV data

2019-09-08 Thread Peter J. Holzer
On 2019-09-08 05:41:07 -0700, Sharan Basappa wrote: > On Sunday, 8 September 2019 04:56:29 UTC-4, Andrea D'Amore wrote: > > On Sun, 8 Sep 2019 at 02:19, Sharan Basappa > > wrote: > > > As you can see, the string "\t"81 is causing the error. > > > It seems to be due to char "\t". > > > > It is n

Finding lines in .txt file that contain keywords from two different set()

2019-09-08 Thread A S
My problem is seemingly profound but I hope to make it sound as simplified as possible.Let me unpack the details..: 1. I have one folder of Excel (.xlsx) files that serve as a data dictionary. -In Cell A1, the data source name is written in between brackets -In Cols C:D, it contains the dat

Re: numpy array - convert hex to int

2019-09-08 Thread Luciano Ramalho
>>> int('C0FFEE', 16) 12648430 There you go! On Sun, Sep 8, 2019 at 12:02 PM Sharan Basappa wrote: > > I have a numpy array that has data in the form of hex. > I would like to convert that into decimal/integer. > Need suggestions please. > -- > https://mail.python.org/mailman/listinfo/python-lis

numpy array - convert hex to int

2019-09-08 Thread Sharan Basappa
I have a numpy array that has data in the form of hex. I would like to convert that into decimal/integer. Need suggestions please. -- https://mail.python.org/mailman/listinfo/python-list

Re: 3 cubes that sum to 42

2019-09-08 Thread אורי
I tried to add one: >>> (-80538738812075975)**3 + 80435758145817515**3 + 12602123297335631**3 -19459465348319378856503251080373909 אורי u...@speedy.net On Sun, Sep 8, 2019 at 3:14 AM Terry Reedy wrote: > >>> (-80538738812075974)**3 + 80435758145817515**3 + > 12602123297335631**3 == 42 > True

Re: 3 cubes that sum to 42

2019-09-08 Thread Michael F. Stemper
On 07/09/2019 19.12, Terry Reedy wrote: (-80538738812075974)**3 + 80435758145817515**3 + > 12602123297335631**3 == 42 > True  # Impressively quickly, in a blink of an eye. Yeah. When I saw the video, I tried it as well. Python's arbitrary-sized integer arithmetic is truly amazing! In fact, I

Re: issue in handling CSV data

2019-09-08 Thread Sharan Basappa
On Sunday, 8 September 2019 04:56:29 UTC-4, Andrea D'Amore wrote: > On Sun, 8 Sep 2019 at 02:19, Sharan Basappa wrote: > This is the error: > > my_data_3 = my_data_2.astype(np.float) > > could not convert string to float: " "81 > > > As you can see, the string "\t"81 is causing the error. > > I

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-08 Thread David
On Sun, 8 Sep 2019 at 21:05, wrote: > David於 2019年9月8日星期日 UTC+8下午6時44分55秒寫道: > > On Sun, 8 Sep 2019 at 20:25, wrote: > > > If I have two widgets created this way: > > > t0 = tkinter.Text() > > > t1 = tkinter.Text() > > > How many Tk objects will there be? > Sorry, didn't make it clear. I mean

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-08 Thread jfong
David於 2019年9月8日星期日 UTC+8下午6時44分55秒寫道: > On Sun, 8 Sep 2019 at 20:25, wrote: > > > > If I have two widgets created this way: > > t0 = tkinter.Text() > > t1 = tkinter.Text() > > How many Tk objects will there be? > > $ python3 > Python 3.5.3 (default, Sep 27 2018, 17:25:39) > [GCC 6.3.0 20170516]

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-08 Thread David
On Sun, 8 Sep 2019 at 20:25, wrote: > > If I have two widgets created this way: > t0 = tkinter.Text() > t1 = tkinter.Text() > How many Tk objects will there be? $ python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" f

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-08 Thread jfong
Terry Reedy於 2019年9月8日星期日 UTC+8下午5時31分34秒寫道: > On 9/7/2019 9:44 PM, jf...@ms4.hinet.net wrote: > > I know it is valid, according to the Tkinter source, every widget > > constructor has a 'master=None' default. What happens on doing this? > > Tkinter creates a default Tk object and uses that as th

Re: local variable 'p' referenced before assignment

2019-09-08 Thread David
On Sun, 8 Sep 2019 at 19:55, Pankaj Jangid wrote: > > Why this code is giving local variable access error when I am accessing > a global variable? > p = 0 > def visit(): >m = 1 >if m > p: >p = m https://docs.python.org/3/faq/programming.html#what-are-the-rules-for-local-and-globa

local variable 'p' referenced before assignment

2019-09-08 Thread Pankaj Jangid
Why this code is giving local variable access error when I am accessing a global variable? p = 0 def visit(): m = 1 if m > p: p = m visit() print(p) If I change the variable assignment inside the function to q = m then it works fine. Like this p = 0 def visit(): m = 1 if

Re: Is it 'fine' to instantiate a widget without parent parameter?

2019-09-08 Thread Terry Reedy
On 9/7/2019 9:44 PM, jf...@ms4.hinet.net wrote: I know it is valid, according to the Tkinter source, every widget constructor has a 'master=None' default. What happens on doing this? Tkinter creates a default Tk object and uses that as the master. >>> t = tkinter.Text() >>> t.master In wha

Re: issue in handling CSV data

2019-09-08 Thread Andrea D'Amore
On Sun, 8 Sep 2019 at 02:19, Sharan Basappa wrote: This is the error: > my_data_3 = my_data_2.astype(np.float) > could not convert string to float: " "81 > As you can see, the string "\t"81 is causing the error. > It seems to be due to char "\t". It is not clear what format do you expect to be