RE: learning python ...

2021-05-24 Thread Avi Gross via Python-list
I have studied many programming languages and am amused when people attack python as if every other language is somehow more optimal. Cameron and others have provided examples but look at positives AND negatives. Yes code like: num = int(num) does look a tad off as it reuses the same name for s

Re: learning python ...

2021-05-24 Thread Cameron Simpson
On 25May2021 06:08, hw wrote: >On 5/25/21 12:37 AM, Greg Ewing wrote: >>If you rebind a name, and it held the last reference to an >>object, there is no way to get that object back. > >Are all names references? Yes. >When I pass a name as a parameter to a function, does the object the >name is

Re: learning python ...

2021-05-24 Thread Cameron Simpson
On 25May2021 05:53, hw wrote: >That seems like an important distinction. I've always been thinking of >variables that get something assigned to them, not as something that is >being assigned to something. They are what you thought. But it's references to objects what are being passed around.

Re: learning python ...

2021-05-24 Thread hw
On 5/25/21 12:37 AM, Greg Ewing wrote: On 25/05/21 9:27 am, Cameron Simpson wrote: On 24May2021 16:17, hw wrote: > Or it doesn't forget about the old one and the old one becomes inaccessible (unless you have a reference to it, if there is such a thing in python).  How do you call that? You

Re: learning python ...

2021-05-24 Thread hw
On 5/24/21 4:28 PM, Michael Torrie wrote: On 5/24/21 8:17 AM, hw wrote: What does python actually do in the first example? Does it overshadow a variable or does it change one? If it overshadows a variable, it would be dubious, if it doesn't, it won't be dubious. Are you referring to this?

Re: learning python ...

2021-05-24 Thread hw
On 5/24/21 4:37 PM, Chris Angelico wrote: On Tue, May 25, 2021 at 12:31 AM Michael Torrie wrote: On 5/24/21 8:24 AM, Chris Angelico wrote: On Tue, May 25, 2021 at 12:18 AM hw wrote: There are more alternatives: Python might create a new variable with the same name and forget about the old

Re: learning python ...

2021-05-24 Thread hw
On 5/24/21 4:41 PM, Michael Torrie wrote: On 5/24/21 8:21 AM, Michael Torrie wrote: Given your posts thus far, hw, I don't think Python is a good fit for you. You're better off learning a language that more closely aligns with the statically-typed languages you already know. Maybe it is, maybe

Re: learning python ...

2021-05-24 Thread hw
On 5/24/21 3:54 PM, Chris Angelico wrote: On Mon, May 24, 2021 at 11:35 PM hw wrote: On 5/24/21 9:52 AM, Chris Angelico wrote: Does C give you a warning if you create a function-local variable called "printf"? No, and it shouldn't. Does any other language complain if you use its scoping rules

Re: learning python ...

2021-05-24 Thread Jon Ribbens via Python-list
On 2021-05-24, Alan Gauld wrote: > On 24/05/2021 16:54, Michael F. Stemper wrote: > >> In my early days of writing python, I created lists named "list", >> dictionaries named "dict", and strings named "str". I mostly know better >> now, but sometimes still need to restrain my fingers. > > I think

Re: learning python ...

2021-05-24 Thread Alan Gauld via Python-list
On 24/05/2021 19:48, Grant Edwards wrote: >> Traceback ( File "", line 1 >> if = 1.234 >>^ >> SyntaxError: invalid syntax > > I must admit it might be nice if the compiler told you _why_ the > syntax is invalid (e.g. "expected conditional expression while parsing > 'if' statement").

RE: Question for potential python development contributions on Windows

2021-05-24 Thread pjfarley3
> -Original Message- > From: Terry Reedy > Sent: Sunday, May 23, 2021 10:05 PM > To: python-list@python.org > Subject: Re: Question for potential python development contributions on > Windows > I am pretty sure that VS2019 output is binary compatible with with output from > VS2017 and VS

Re: learning python ...

2021-05-24 Thread Alan Gauld via Python-list
On 24/05/2021 16:54, Michael F. Stemper wrote: > In my early days of writing python, I created lists named "list", > dictionaries named "dict", and strings named "str". I mostly know better > now, but sometimes still need to restrain my fingers. I think most newbie programmers make that mistake.

Re: learning python ...

2021-05-24 Thread Dan Stromberg
On Sun, May 23, 2021 at 12:35 PM hw wrote: > I don't know about shadowing. If I have defeated a whole variable type > by naming a variable like a variable type, I would think it is a bad > idea for python to allow this without warning. It seems like a recipie > for creating chaos. > It strikes

Re: learning python ...

2021-05-24 Thread Greg Ewing
On 25/05/21 9:27 am, Cameron Simpson wrote: On 24May2021 16:17, hw wrote: > Or it doesn't forget about the old one and the old one becomes inaccessible (unless you have a reference to it, if there is such a thing in python). How do you call that? You're conflating values (objects, such as a

Re: learning python ...

2021-05-24 Thread Cameron Simpson
On 24May2021 16:17, hw wrote: >On 5/24/21 11:33 AM, Cameron Simpson wrote: >>Note that in this function: >> >> x = 1 >> y = 2 >> >> def f(a): >> x = 3 >> print(x, y) >> >>"x" is local, because the function contains an assignment to it. "y" >>comes from an outer scope (i

Re: Question for potential python development contributions on Windows

2021-05-24 Thread Terry Reedy
On 5/23/2021 10:05 PM, Terry Reedy wrote: On 5/23/2021 12:20 PM, pjfarl...@earthlink.net wrote: I asked this question on python-dev last week but did not get an answer.  If anyone here know the answer I would appreciate it. The Python Developers Guide specifically states to get VS2017 for dev

Re: f-strings and internationalisation.

2021-05-24 Thread Barry Scott
> On 24 May 2021, at 19:30, Antoon Pardon wrote: > > I have now come across several occasion where an author advice the use > of f-strings above the %-formatting and the format method. However it > seems these authors were only thinking about rather straight forward > english communication. >

Re: learning python ...

2021-05-24 Thread Grant Edwards
On 2021-05-24, Dennis Lee Bieber wrote: > Attempting to rebind a keyword in Python will produce an error... > if = 1.234 > Traceback ( File "", line 1 > if = 1.234 >^ > SyntaxError: invalid syntax I must admit it might be nice if the compiler told you _why_ the syntax is

f-strings and internationalisation.

2021-05-24 Thread Antoon Pardon
I have now come across several occasion where an author advice the use of f-strings above the %-formatting and the format method. However it seems these authors were only thinking about rather straight forward english communication. So what if you want your application to work with multiple langua

Re: learning python ...

2021-05-24 Thread Alan Gauld via Python-list
On 24/05/2021 07:21, hw wrote: >> Inside the function f() the name 'x" shadows the global "x"; references >> to "x" are to the function's local vairable. Which is very desireable. > > If it works that way, I would consider it an entirely different > variable. Remember that in Python variables

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-24 Thread max pothier
Found this: https://pastebin.com/fvLkSJRp with use-select tags. I'll try to use selenium and select the page. But using the JSON packet that's sent will still be more practical. -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python ...

2021-05-24 Thread Michael F. Stemper
On 24/05/2021 09.32, Rob Cliffe wrote: One day you may want to write (as you can in Python)     class int(int):         . to shadow the built-in 'int' type with a modified version.  I'm not suggesting this has many real world applications, but it can be fun to play with.  Python has a

Re: Use Chrome's / Firefox's dev-tools in python

2021-05-24 Thread max pothier
Ok, So here's a screenshot: https://ibb.co/2dtGr3c 1 is the website's scrollbar and 2 is Firefox's scrollbar. Seems like it uses a strange embed thing. The packet follows: https://pastebin.com/2qEkhZMN @Martin Di Paola: I sent you the pastebin password per email so that you're the only one who can

Re: learning python ...

2021-05-24 Thread Rob Cliffe via Python-list
Please don't be put off by your experience so far.  Everyone stumbles along the way and runs into "gotchas" when learning a new language.  Python is a fantastic language for development.  One of my early "epiphany" moments was experimenting with different algorithms to try to find the right one

Re: learning python ...

2021-05-24 Thread Michael Torrie
On 5/24/21 8:42 AM, Schachner, Joseph wrote: > OMG that is awful abuse of Python! You have overloaded two Python > keywords by making variables of that name. Nitpick. hw did not overload keywords. Python does not allow keywords to be overloaded. Instead hw overwrote type names. Upon learning th

Re: learning python ...

2021-05-24 Thread Rob Cliffe via Python-list
On 24/05/2021 14:34, hw wrote: Your claim that I'm insulting python or anoyone is ridiculous. According to your logic, C is insulting python.  I suggest you stop making assumptions. Calling a mature, widely used language "unfinished" because of what *you* see as a defect *is* insulting. (Of

Re: learning python ...

2021-05-24 Thread Michael Torrie
On 5/24/21 8:37 AM, Chris Angelico wrote: > We're talking about many different things. Indeed. The context of that original question about whether this was shadowing or not seemed to be specifically about the num=input(); num=int(num) example that Cameron Simpson posted. Although hw was not cle

RE: learning python ...

2021-05-24 Thread Schachner, Joseph
OMG that is awful abuse of Python! You have overloaded two Python keywords by making variables of that name. As a result, float is no longer a type name, it is a variable name that refers to the value 6.67 ! Type(int) is int; type(float) is float, but isinstance(int,float) doesn't work becaus

Re: learning python ...

2021-05-24 Thread Michael Torrie
On 5/24/21 8:21 AM, Michael Torrie wrote: > Given your posts thus far, hw, I don't think Python is a good fit for > you. You're better off learning a language that more closely aligns with > the statically-typed languages you already know. That was unnecessarily harsh; my apologies. I can see now

Re: learning python ...

2021-05-24 Thread Chris Angelico
On Tue, May 25, 2021 at 12:31 AM Michael Torrie wrote: > > On 5/24/21 8:24 AM, Chris Angelico wrote: > > On Tue, May 25, 2021 at 12:18 AM hw wrote: > >> There are more alternatives: Python might create a new variable with > >> the same name and forget about the old one. Or it doesn't forget abo

Re: learning python ...

2021-05-24 Thread Michael Torrie
On 5/24/21 8:17 AM, hw wrote: > What does python actually do in the first example? Does it overshadow a > variable or does it change one? If it overshadows a variable, it would > be dubious, if it doesn't, it won't be dubious. Are you referring to this? num = input("Enter a number: ")

Re: learning python ...

2021-05-24 Thread Michael Torrie
On 5/24/21 8:24 AM, Chris Angelico wrote: > On Tue, May 25, 2021 at 12:18 AM hw wrote: >> There are more alternatives: Python might create a new variable with >> the same name and forget about the old one. Or it doesn't forget about >> the old one and the old one becomes inaccessible (unless you

Re: learning python ...

2021-05-24 Thread Chris Angelico
On Tue, May 25, 2021 at 12:18 AM hw wrote: > There are more alternatives: Python might create a new variable with > the same name and forget about the old one. Or it doesn't forget about > the old one and the old one becomes inaccessible (unless you have a > reference to it, if there is such a t

Re: learning python ...

2021-05-24 Thread Michael Torrie
On 5/24/21 7:34 AM, hw wrote: > Perhaps you can't see how both examples are different because you're > looking at things from a python perspective. Sorry but they aren't all that different. In both cases you're shadowing printf. The difference is that C is a statically-typed, compiled language,

Re: learning python ...

2021-05-24 Thread hw
On 5/24/21 11:33 AM, Cameron Simpson wrote: On 24May2021 08:21, hw wrote: On 5/24/21 12:03 AM, Cameron Simpson wrote: On 23May2021 21:02, Stestagg wrote: On Sun, 23 May 2021 at 20:37, hw wrote: I don't know about shadowing. Shadowing is effectively saying “within this bit of code, (scope

Re: learning python ...

2021-05-24 Thread Chris Angelico
On Mon, May 24, 2021 at 11:35 PM hw wrote: > > On 5/24/21 9:52 AM, Chris Angelico wrote: > > Does C give you a warning if you create a function-local variable > > called "printf"? No, and it shouldn't. Does any other language > > complain if you use its scoping rules to reuse a name? Nope. Does >

Re: learning python ...

2021-05-24 Thread hw
On 5/24/21 9:52 AM, Chris Angelico wrote: On Mon, May 24, 2021 at 3:25 PM hw wrote: On 5/23/21 10:02 PM, Stestagg wrote: On Sun, 23 May 2021 at 20:37, hw mailto:h...@adminart.net>> wrote: On 5/23/21 7:28 PM, Peter Otten wrote: > On 23/05/2021 06:37, hw wrote: >> >> H

Re: learning python ...

2021-05-24 Thread Cameron Simpson
On 24May2021 08:21, hw wrote: >On 5/24/21 12:03 AM, Cameron Simpson wrote: >>On 23May2021 21:02, Stestagg wrote: >>>On Sun, 23 May 2021 at 20:37, hw wrote: I don't know about shadowing. >>> >>>Shadowing is effectively saying “within this bit of code, (scope) I’m going >>>to use an already-us

Re: learning python ...

2021-05-24 Thread Peter J. Holzer
On 2021-05-24 07:20:39 +0200, hw wrote: > python is too unfinished to be used. You have to realize that different programming languages have different goals and develop in different directions. Python is not an "unfinished Java" (and neither is Java an "unfinished Python"). The scoping and binding

Re: learning python ...

2021-05-24 Thread Chris Angelico
On Mon, May 24, 2021 at 3:25 PM hw wrote: > > On 5/23/21 10:02 PM, Stestagg wrote: > > > > > > On Sun, 23 May 2021 at 20:37, hw > > wrote: > > > > On 5/23/21 7:28 PM, Peter Otten wrote: > > > On 23/05/2021 06:37, hw wrote: > > >> > > >> Hi, > > >>