Re: Is there a simple way to wrap a built-in function for the whole package?

2019-08-01 Thread jfong
Cameron Simpson於 2019年8月2日星期五 UTC+8上午6時25分00秒寫道: > On 31Jul2019 19:16, Jach Fong wrote: > >I get a package from Pypi. The package has many modules using built-in > >open() function. I like to redefine all the open() there with the default > >encoding 'utf-8', but not for code outside the package

Re: Is there a simple way to wrap a built-in function for the whole package?

2019-08-01 Thread Cameron Simpson
On 31Jul2019 19:16, Jach Fong wrote: I get a package from Pypi. The package has many modules using built-in open() function. I like to redefine all the open() there with the default encoding 'utf-8', but not for code outside the package. Maybe I can put my def statement at the beginning of ev

Re: PEP: add a `no` keyword as an alias for `not`

2019-08-01 Thread Ethan Furman
On 08/01/2019 01:06 PM, Daniel Okey-Okoro wrote: [an idea] Two things: 1) please do not cross-post. 2) a PEP is a very particular thing* -- please do not say you have one unless you do. ;) -- ~Ethan~ * https://www.python.org/dev/peps/pep-0001/ -- https://mail.python.org/mailman/listinfo/

Re: Fwd: PEP: add a `no` keyword as an alias for `not`

2019-08-01 Thread Grant Edwards
On 2019-08-01, Daniel Okey-Okoro wrote: > But in many cases, when people write `if not val` they're checking if the > val is `None` > > i.e. `if val is None`, `if val == None` If they want to know if val is None, then they should be typing 'val is None'. IMO, it's not an improvement to let them

Re: Fwd: PEP: add a `no` keyword as an alias for `not`

2019-08-01 Thread Karsten Hilbert
On Thu, Aug 01, 2019 at 01:25:21PM -0700, Daniel Okey-Okoro wrote: > Good point Calvin, > > But in many cases, when people write `if not val` they're checking if the > val is `None` > > i.e. `if val is None`, `if val == None` > > (so in

Re: help with tkinter

2019-08-01 Thread Wildman via Python-list
On Thu, 01 Aug 2019 16:31:02 +0300, adam kabbara wrote: > Hello I am having trouble with tkinter when I enter the command from tkinter > import* I get an error message > What was the error and what version of Python are you using? For Python 2 you need... from Tkinter import* -- GNU/Linux u

Fwd: [Python-ideas] Re: PEP: add a `no` keyword as an alias for `not`

2019-08-01 Thread Daniel Okey-Okoro
-- Forwarded message - From: Daniel Okey-Okoro Date: Thu, Aug 1, 2019 at 1:37 PM Subject: Re: [Python-ideas] Re: PEP: add a `no` keyword as an alias for `not` To: Chris Angelico > not a strong enough justification for breaking any code that uses "no" in any other way. This is a

Fwd: PEP: add a `no` keyword as an alias for `not`

2019-08-01 Thread Daniel Okey-Okoro
-- Forwarded message - From: Daniel Okey-Okoro Date: Thu, Aug 1, 2019 at 1:24 PM Subject: Re: PEP: add a `no` keyword as an alias for `not` To: Calvin Spealman Good point Calvin, But in many cases, when people write `i

Re: PEP: add a `no` keyword as an alias for `not`

2019-08-01 Thread Calvin Spealman
I think they actually read like they would mean slightly different things, which would make them existing as aliases confusing. I read `if not val` as "If val isn't true" but i would read `if no val` as "if val does not exist" On Thu, Aug 1, 2019 at 4:07 PM Daniel Okey-Okoro wrote: > I think th

PEP: add a `no` keyword as an alias for `not`

2019-08-01 Thread Daniel Okey-Okoro
I think that adding a `no` keyword as an alias for `not` would make for more readable, simple, pythonic code. Take the below: ``` if not val: do_thing_because_value_is_falsy() ``` could be (is actually understood as): ``` if no val: do_thing_because_value_is_falsy() ``` I think this PEP i

Re: help with tkinter

2019-08-01 Thread Rhodri James
On 01/08/2019 19:06, Chris Angelico wrote: On Fri, Aug 2, 2019 at 2:30 AM Rhodri James wrote: Hi there, Adam! On 01/08/2019 14:31, adam kabbara wrote: Hello I am having trouble with tkinter when I enter the command from tkinter import* I get an error message What *exactly* did you type?

Re: help with tkinter

2019-08-01 Thread Chris Angelico
On Fri, Aug 2, 2019 at 2:30 AM Rhodri James wrote: > > Hi there, Adam! > > On 01/08/2019 14:31, adam kabbara wrote: > > Hello I am having trouble with tkinter when I enter the command from > > tkinter import* I get an error message > > What *exactly* did you type? Please cut-and-paste from your

Re: help with tkinter

2019-08-01 Thread Rhodri James
Hi there, Adam! On 01/08/2019 14:31, adam kabbara wrote: Hello I am having trouble with tkinter when I enter the command from tkinter import* I get an error message What *exactly* did you type? Please cut-and-paste from your console/editor into the email, don't just retype it. If you did

help with tkinter

2019-08-01 Thread adam kabbara
Hello I am having trouble with tkinter when I enter the command from tkinter import* I get an error message Sent from Mail for Windows 10 -- https://mail.python.org/mailman/listinfo/python-list

Re: Create Logging module

2019-08-01 Thread Sinardy Xing
Sorry for spamming this is suppose send to tutor-ow...@python.org On Thu, Aug 1, 2019 at 5:08 PM Sinardy Xing wrote: > Hi, > > I am learning to create python logging. > > My goal is to create a logging module where I can use as decorator in my > main app > > following is the logging code > > ---

Create Logging module

2019-08-01 Thread Sinardy Xing
Hi, I am learning to create python logging. My goal is to create a logging module where I can use as decorator in my main app following is the logging code start here--- import logging #DEBUG: Detailed information, typically of interest only when diagnosing problems. #INFO : Conf

Re: newbie question

2019-08-01 Thread Sidney Langweil
On Thursday, August 1, 2019 at 7:57:31 AM UTC-7, Calvin Spealman wrote: > Sorry, but you can't. If you have two python modules, neither has access to > things in the other without an import. > > That's the whole point of an import. > > On Thu, Aug 1, 2019 at 10:30 AM Sidney Langweil > wrote: >

Re: newbie question

2019-08-01 Thread Calvin Spealman
Sorry, but you can't. If you have two python modules, neither has access to things in the other without an import. That's the whole point of an import. On Thu, Aug 1, 2019 at 10:30 AM Sidney Langweil wrote: > A Python script invokes a function in another file in the same directory. > > I would

newbie question

2019-08-01 Thread Sidney Langweil
A Python script invokes a function in another file in the same directory. I would like to invoke that function without the need for an import. I think I read that having an empty __init__.py is sufficient. But it does not seem to work for me. I'm sure this is obvious to many of you. Thanks in

Re: Why won't the run-time error reporter point to the error position with a caret like the syntax error reporter does? It knows exactly where the error is.

2019-08-01 Thread Chris Angelico
On Thu, Aug 1, 2019 at 4:34 PM Terry Reedy wrote: > > On 7/31/2019 11:19 PM, jsals...@gmail.com wrote: > > Honestly this is the only thing in over half a decade of daily python use > > which has disappointed me enough to want to ask the devs: > > > print(1/) > >File "", line 1 > > p