Re: Oh gods can we get any more off-topic *wink* [was Re: [Python-ideas] Inconsistencies]

2016-09-13 Thread Rustom Mody
On Wednesday, September 14, 2016 at 10:52:48 AM UTC+5:30, Steven D'Aprano wrote: > (Unlike *our* divine revelation, which is clearly the truth, the whole truth, > and nothing but the truth, *their* divine revolution is illusion, error and > lies. All of the gods are myth and superstition, except

Re: [Python-ideas] Inconsistencies

2016-09-13 Thread Lawrence D’Oliveiro
On Monday, September 12, 2016 at 2:26:21 PM UTC+12, Chris Angelico wrote: > On Mon, Sep 12, 2016 at 12:04 PM, Lawrence D’Oliveiro wrote: >> On Monday, September 12, 2016 at 1:11:39 PM UTC+12, Chris Angelico wrote: >>> I have some _extremely_ strong views about absolutes (they come from the >>> Crea

Re: [Python-ideas] Inconsistencies

2016-09-13 Thread Gregory Ewing
Marko Rauhamaa wrote: It has been prophesied that God will eventually write a Version 2 of the universe which will have most of the known glitches in Version 1 fixed. Well, He did release a Religion 2.0 and sent His son to install it, but some users resisted the upgrade and crucified him before

Oh gods can we get any more off-topic *wink* [was Re: [Python-ideas] Inconsistencies]

2016-09-13 Thread Steven D'Aprano
On Monday 12 September 2016 12:26, Chris Angelico wrote: > On Mon, Sep 12, 2016 at 12:04 PM, Lawrence D’Oliveiro > wrote: >> On Monday, September 12, 2016 at 1:11:39 PM UTC+12, Chris Angelico wrote: >>> I have some _extremely_ strong views about absolutes (they come from the >>> Creator of the Un

Re: Expression can be simplified on list

2016-09-13 Thread Steven D'Aprano
On Wednesday 14 September 2016 13:59, Lawrence D’Oliveiro wrote: > On Wednesday, September 14, 2016 at 2:25:48 PM UTC+12, Ben Finney wrote: >> Lawrence D’Oliveiro writes: >> >> > It would be better if all such conversions were explicit >> >> Why? It's entirely unambiguous ... > >

Re: Expression can be simplified on list

2016-09-13 Thread Jussi Piitulainen
Lawrence D’Oliveiro writes: > On Wednesday, September 14, 2016 at 2:25:48 PM UTC+12, Ben Finney wrote: >> Lawrence D’Oliveiro writes: >> >> > It would be better if all such conversions were explicit >> >> Why? It's entirely unambiguous ... > > That's the story

Re: Expression can be simplified on list

2016-09-13 Thread Steven D'Aprano
On Wednesday 14 September 2016 12:16, Lawrence D’Oliveiro wrote: > On Tuesday, September 13, 2016 at 2:33:40 PM UTC+12, Ned Batchelder wrote: >> Why do you object to the type conversion to bool? > > It would be better if all such conversions were explicit, e.g. > > if bool(«non-bool expr») :

Re: Expression can be simplified on list

2016-09-13 Thread Ben Finney
Lawrence D’Oliveiro writes: > On Wednesday, September 14, 2016 at 2:25:48 PM UTC+12, Ben Finney wrote: > > Lawrence D’Oliveiro writes: > > > > > It would be better if all such conversions were explicit > > > > Why? It's entirely unambiguous: the expression of an ‘if’ statement > > *can only be*

Python reverse debugger

2016-09-13 Thread Steven D'Aprano
PyPy has recently released a reverse debugger for Python: https://mail.python.org/pipermail/pypy-dev/2016-September/014661.html Armin Rigo wrote: [quote] It is my pleasure to announce the first beta release of RevDB: a "reverse debugger" for Python. A reverse debugger is a debug

Re: Expression can be simplified on list

2016-09-13 Thread Lawrence D’Oliveiro
On Wednesday, September 14, 2016 at 2:25:48 PM UTC+12, Ben Finney wrote: > Lawrence D’Oliveiro writes: > > > It would be better if all such conversions were explicit > > Why? It's entirely unambiguous ... -- https://mail.python.org/mailman/listinfo/python-list

Re: Python inner function parameter shadowed

2016-09-13 Thread Lawrence D’Oliveiro
On Wednesday, September 14, 2016 at 4:34:34 AM UTC+12, Daiyue Weng wrote: > PyCharm warns about "Shadows name 'func' from outer scope" Typical piece of software trying to be too helpful and just getting in the way. Can you turn off such warnings? -- https://mail.python.org/mailman/listinfo/pytho

Re: Expression can be simplified on list

2016-09-13 Thread Chris Angelico
On Wed, Sep 14, 2016 at 12:25 PM, Ben Finney wrote: > Lawrence D’Oliveiro writes: > >> On Tuesday, September 13, 2016 at 2:33:40 PM UTC+12, Ned Batchelder wrote: >> > Why do you object to the type conversion to bool? >> >> It would be better if all such conversions were explicit > > Why? It's ent

Re: Expression can be simplified on list

2016-09-13 Thread Ben Finney
Lawrence D’Oliveiro writes: > On Tuesday, September 13, 2016 at 2:33:40 PM UTC+12, Ned Batchelder wrote: > > Why do you object to the type conversion to bool? > > It would be better if all such conversions were explicit Why? It's entirely unambiguous: the expression of an ‘if’ statement *can onl

Re: Expression can be simplified on list

2016-09-13 Thread Lawrence D’Oliveiro
On Tuesday, September 13, 2016 at 2:33:40 PM UTC+12, Ned Batchelder wrote: > Why do you object to the type conversion to bool? It would be better if all such conversions were explicit, e.g. if bool(«non-bool expr») : if not bool(«non-bool expr») : instead of if «non-bool expr» :

Re: Why don't we call the for loop what it really is, a foreach loop?

2016-09-13 Thread Steve D'Aprano
On Wed, 14 Sep 2016 06:57 am, rgrigo...@gmail.com wrote: > It would help newbies and prevent confusion. No it wouldn't. Claims-which-are-made-without-evidence-can-be-rejected-without-evidence-ly y'rs, -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Tkinter file dialog screwed

2016-09-13 Thread Steve D'Aprano
On Wed, 14 Sep 2016 06:08 am, kerbingamer376 wrote: > The tkinter file dialog is, for me, unusable. Whenever I try to use it, it > opens, but all the text is white on a white background (see this > http://xomf.com/qzhgy) making it unusable. This has happened on 2 linux > systems, both KDE plasma 5

Re: Expression can be simplified on list

2016-09-13 Thread Chris Angelico
On Wed, Sep 14, 2016 at 9:16 AM, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: > >> […] Thomas 'PointedEars' Lahn […] wrote: >>> If I knew that it is always going to be a list or a tuple, I would check >>> its length instead: >>> >>> if len(errors) == 0: >> >> I wouldn't. I'd use bool

Re: Expression can be simplified on list

2016-09-13 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > […] Thomas 'PointedEars' Lahn […] wrote: >> If I knew that it is always going to be a list or a tuple, I would check >> its length instead: >> >> if len(errors) == 0: > > I wouldn't. I'd use boolification here too. Only if I had to > distinguish between None, [], and [1,

Re: Why don't we call the for loop what it really is, a foreach loop?

2016-09-13 Thread BartC
On 13/09/2016 22:20, Ian Kelly wrote: On Tue, Sep 13, 2016 at 2:57 PM, wrote: It would help newbies and prevent confusion. Ada uses "for". C++11 uses "for". Dart uses "for". Go uses "for". Groovy uses "for". Java uses "for". JavaScript uses "for". MATLAB uses "for". Objective-C uses "for". P

Re: How to extend a tuple of tuples?

2016-09-13 Thread Thomas 'PointedEars' Lahn
John Gordon wrote: > […] Thomas 'PointedEars' Lahn […] writes: It is supposed to be an attribution *line*, _not_ an attribution novel. >> >> The obvious way does not work - >> >> >> >> a += (5, 6) >> ^^ >> > Right, because a tuple is immutable. > >> How did you get that

Re: DLL Error from a beginner

2016-09-13 Thread Irmen de Jong
On 13-9-2016 23:59, srfp...@gmail.com wrote: > Running Pyscripter and Python version 2.7.12 on Win10 Home on a 64bit Laptop > 1. A simple Python application runs successfully. > 2. WxPython(wxPython3.0-win64-3.0.2.0-py27(1).exe executed successfully > 3. To the simple app above, I add import wx

Re: Why don't we call the for loop what it really is, a foreach loop?

2016-09-13 Thread Grant Edwards
On 2016-09-13, Ian Kelly wrote: > On Tue, Sep 13, 2016 at 2:57 PM, wrote: >> It would help newbies and prevent confusion. > > Ada uses "for". [a dozen or so other langages] > Swift uses "for". > > Why do you think it's confusing that Python uses the same keyword in > its foreach loops that all t

DLL Error from a beginner

2016-09-13 Thread srfpala
Running Pyscripter and Python version 2.7.12 on Win10 Home on a 64bit Laptop 1. A simple Python application runs successfully. 2. WxPython(wxPython3.0-win64-3.0.2.0-py27(1).exe executed successfully 3. To the simple app above, I add import wx and an Error Dialog occurs: ImportError: D

Re: Why don't we call the for loop what it really is, a foreach loop?

2016-09-13 Thread Ian Kelly
On Tue, Sep 13, 2016 at 2:57 PM, wrote: > It would help newbies and prevent confusion. Ada uses "for". C++11 uses "for". Dart uses "for". Go uses "for". Groovy uses "for". Java uses "for". JavaScript uses "for". MATLAB uses "for". Objective-C uses "for". Pasceal uses "for". Perl moved from "fore

Re: Why don't we call the for loop what it really is, a foreach loop?

2016-09-13 Thread Jerry Hill
On Tue, Sep 13, 2016 at 4:57 PM, wrote: > It would help newbies and prevent confusion. Are you asking why Guido didn't call it foreach back in 1989, or why the core developers don't change it now, 27 years later? I can't speak for the historical perspective, but I'm sure there's basically no ch

Why don't we call the for loop what it really is, a foreach loop?

2016-09-13 Thread rgrigonis
It would help newbies and prevent confusion. -- https://mail.python.org/mailman/listinfo/python-list

Re: Tkinter file dialog screwed

2016-09-13 Thread martinjp376
yes, I can make the labels turn black by selecting them with the arrow keys. -- https://mail.python.org/mailman/listinfo/python-list

Re: Tkinter file dialog screwed

2016-09-13 Thread Christian Gollwitzer
Am 13.09.16 um 22:08 schrieb kerbingamer376: The tkinter file dialog is, for me, unusable. Whenever I try to use it, it opens, but all the text is white on a white background (see this http://xomf.com/qzhgy) making it unusable. This has happened on 2 linux systems, both KDE plasma 5. Any help?

Tkinter file dialog screwed

2016-09-13 Thread kerbingamer376
The tkinter file dialog is, for me, unusable. Whenever I try to use it, it opens, but all the text is white on a white background (see this http://xomf.com/qzhgy) making it unusable. This has happened on 2 linux systems, both KDE plasma 5. Any help? -- https://mail.python.org/mailman/listinfo/p

Re: Python inner function parameter shadowed

2016-09-13 Thread Brendan Abel
Yeah, you could change the name, but it shouldn't matter, the "func" in the inner function will always be the one passed into it, it won't be the "func" from the outer function, which in this specific case, would always be None (at least as far as the second inner function is concerned.) On Tue, S

Re: Python inner function parameter shadowed

2016-09-13 Thread Chris Angelico
On Wed, Sep 14, 2016 at 4:28 AM, Brendan Abel <007bren...@gmail.com> wrote: > This looks like a decorator function that optionally accepts arguments to > change the behavior. Oh, I get it. So, yeah, it is one function doing two jobs - legitimately. In that case, I'd just rename one of the 'func' a

Re: Python inner function parameter shadowed

2016-09-13 Thread Brendan Abel
This looks like a decorator function that optionally accepts arguments to change the behavior. You can safely ignore the warning form PyCharm. the variable won't be shadowed it's included in the function signature of the inner function. A lot of times, the outside decorator will just use the *ar

Re: Python inner function parameter shadowed

2016-09-13 Thread Chris Angelico
On Wed, Sep 14, 2016 at 2:34 AM, Daiyue Weng wrote: > Hi, I am using inner function like this, > > def timeit(func=None, loops=1, verbose=False): > if func is not None: > def inner(*args, **kwargs): > > # some code > > return inner > else: > def partial_

Python inner function parameter shadowed

2016-09-13 Thread Daiyue Weng
Hi, I am using inner function like this, def timeit(func=None, loops=1, verbose=False): if func is not None: def inner(*args, **kwargs): # some code return inner else: def partial_inner(func): return timeit(func, loops, verbose) re

Re: How to extend a tuple of tuples?

2016-09-13 Thread Random832
On Mon, Sep 12, 2016, at 17:29, Chris Angelico wrote: > old_id = id(a) > a += something > if id(a) == old_id: > print("We may have an optimization, folks!") > > But that can have false positives. If two objects do not concurrently > exist, they're allowed to have the same ID number. But the t

Re: Global variable is undefined at the module level

2016-09-13 Thread dieter
Daiyue Weng writes: > Hi, I defined a global variable in some function like this, > > def some_function(self): > > global global_var > > PyCharm inspection gave me, > > Global variable is undefined at the module level > > How to fix this? You define the global variable at the module level.

Re: Global variable is undefined at the module level

2016-09-13 Thread Ned Batchelder
On Tuesday, September 13, 2016 at 6:42:56 AM UTC-4, Daiyue Weng wrote: > Hi, I defined a global variable in some function like this, > > def some_function(self): > > global global_var > > PyCharm inspection gave me, > > Global variable is undefined at the module level > > How to fix this?

Re: Global variable is undefined at the module level

2016-09-13 Thread Peter Otten
Daiyue Weng wrote: > Hi, I defined a global variable in some function like this, > > def some_function(self): > > global global_var > > PyCharm inspection gave me, > > Global variable is undefined at the module level There is no single way to silence that complaint and actually improve y

Re: Expected type 'optional[bytes]' got 'str' instead

2016-09-13 Thread Peter Otten
Daiyue Weng wrote: > Hi, I have the following piece of code, > > rootPath = os.path.abspath(__file__) > > rootPath = (rootPath.rsplit('\\', 1)[0]).rsplit('\\', 1)[0] > > > PyCharm inspection gave me warning on argument '\\' of the 2nd rsplit, > > Expected type 'optional[bytes]' got 'str' inst

Re: Expected type 'optional[bytes]' got 'str' instead

2016-09-13 Thread Chris Angelico
On Tue, Sep 13, 2016 at 9:19 PM, Daiyue Weng wrote: > Could you give me an example of doing this using os.path.split and > os.path.join? > > thanks Sure, but I'm keeping this on list. os.path.split basically does the same thing you do. # maintaining your non-PEP-8 names rootPath = os.path.abspa

Re: Expected type 'optional[bytes]' got 'str' instead

2016-09-13 Thread Chris Angelico
On Tue, Sep 13, 2016 at 9:06 PM, Daiyue Weng wrote: > Hi, I have the following piece of code, > > rootPath = os.path.abspath(__file__) > > rootPath = (rootPath.rsplit('\\', 1)[0]).rsplit('\\', 1)[0] > > > PyCharm inspection gave me warning on argument '\\' of the 2nd rsplit, > > Expected type 'opt

Expected type 'optional[bytes]' got 'str' instead

2016-09-13 Thread Daiyue Weng
Hi, I have the following piece of code, rootPath = os.path.abspath(__file__) rootPath = (rootPath.rsplit('\\', 1)[0]).rsplit('\\', 1)[0] PyCharm inspection gave me warning on argument '\\' of the 2nd rsplit, Expected type 'optional[bytes]' got 'str' instead If I changed it to, rootPath = (r

Re: How to extend a tuple of tuples?

2016-09-13 Thread Sibylle Koczian
Am 13.09.2016 um 12:09 schrieb Chris Angelico: On Tue, Sep 13, 2016 at 8:01 PM, Antoon Pardon wrote: Then python seems to be broken: ]]] a = range(3) ]]] old_a = a ]]] a += [8, 13] ]]] id(a), id(old_a) (140062018784792, 140062018784792) ]]] a, old_a ([0, 1, 2, 8, 13], [0, 1, 2, 8, 13]) A r

Global variable is undefined at the module level

2016-09-13 Thread Daiyue Weng
Hi, I defined a global variable in some function like this, def some_function(self): global global_var PyCharm inspection gave me, Global variable is undefined at the module level How to fix this? cheers -- https://mail.python.org/mailman/listinfo/python-list

Re: [RELEASE] Python 3.6.0b1 is now available

2016-09-13 Thread Lele Gaifax
Ned Deily writes: > On behalf of the Python development community and the Python 3.6 release > team, I'm happy to announce the availability of Python 3.6.0b1. Kudos to everybody involved! > Among the new major new features in Python 3.6 are: > > * PEP 468 - Preserving the order of **kwargs in a

Re: How to extend a tuple of tuples?

2016-09-13 Thread Chris Angelico
On Tue, Sep 13, 2016 at 8:01 PM, Antoon Pardon wrote: >>> You could do the following: >>> >>> old_a = a >>> a += something >>> if old_a is a: >>> print("We have an optimization, folks!") >>> >> Uhm... that defeats the whole point of it being an optimization. See >> above, "there are no other r

Re: How to extend a tuple of tuples?

2016-09-13 Thread Antoon Pardon
Op 13-09-16 om 11:27 schreef Chris Angelico: > On Tue, Sep 13, 2016 at 5:25 PM, Antoon Pardon > wrote: >> Op 12-09-16 om 23:29 schreef Chris Angelico: >>> On Tue, Sep 13, 2016 at 7:19 AM, BartC wrote: By the same argument, then strings and ints are also mutable. Here, the original

Re: How to extend a tuple of tuples?

2016-09-13 Thread Chris Angelico
On Tue, Sep 13, 2016 at 5:25 PM, Antoon Pardon wrote: > Op 12-09-16 om 23:29 schreef Chris Angelico: >> On Tue, Sep 13, 2016 at 7:19 AM, BartC wrote: >>> By the same argument, then strings and ints are also mutable. >>> >>> Here, the original tuple that a refers to has been /replaced/ by a new on

Re: [Python-ideas] Inconsistencies

2016-09-13 Thread Marko Rauhamaa
Rustom Mody : > And in the same vein, a non-messianic interpretation of the core > Christian teaching: > http://themindunleashed.org/2015/11/you-are-god-the-true-teachings-of-jesus.html The link's message ("You are God") comes close to theosis (https://en.wikipedia.org/wiki/Theosis_(Eastern_Ortho

Re: How to extend a tuple of tuples?

2016-09-13 Thread Antoon Pardon
Op 12-09-16 om 23:29 schreef Chris Angelico: > On Tue, Sep 13, 2016 at 7:19 AM, BartC wrote: >> By the same argument, then strings and ints are also mutable. >> >> Here, the original tuple that a refers to has been /replaced/ by a new one. >> The original is unchanged. (Unless, by some optimisatio