[issue42075] Verbose/confusing default format on warnings

2020-10-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

An application *can* change warnings.  See lib/idlelib/run for an example.  
Library code should not make changes as they will be global or overwritten.  A 
project that is both can restrict the changes to when run as main module.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42075] Verbose/confusing default format on warnings

2020-10-18 Thread Mithil


Mithil  added the comment:

I also ran this on Fedora 32, python 3.8.6 and still got the same result.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42075] Verbose/confusing default format on warnings

2020-10-18 Thread Mithil


Mithil  added the comment:

I ran the file that you linked and this is what it printed.

C:\Users\mithi\p\test\file.py:3: UserWarning: Danger danger danger Will 
Robinson!!!
  warnings.warn(

As you see, the warnings.warn( line is not desirable.
More details about my machine -
Windows 10
python 3.9.0

I have also tried running this with Python 3.10.0a1. Same result.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42075] Verbose/confusing default format on warnings

2020-10-18 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

3.9 and older are all in feature freeze, so no changes in behaviour will be 
considered for them.

I'm afraid I cannot replicate the behaviour you describe. When I try, the full 
warning message is correctly displayed. See the attached file.

Importing it from the interactive interpreter gives:

>>> import warntest
/home/steve/warntest.py:5: UserWarning: Danger danger danger Will 
Robinson!!!
  "Danger danger danger Will Robinson!!!"


and running it from the commandline:


$ python3 ~/warntest.py 
/home/steve/warntest.py:5: UserWarning: Danger danger danger Will Robinson!!!
  "Danger danger danger Will Robinson!!!"


Can you provide a minimal working example of the issue?

--
nosy: +steven.daprano
versions:  -Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49526/warntest.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42075] Verbose/confusing default format on warnings

2020-10-18 Thread Mithil


New submission from Mithil :

The default format prints a lot of details like filename, line number, and the 
source code on that line. A particular case where the warn message is written 
on the next line like -
warn(
   "Message here")
Will only print warn( as the source code and not the entire block.
My concern is, can this formatting be less detailed by default. Or, can this 
format be freely changed in a project A without worrying about affecting the 
global usage in any other project B that imports it.
Or at the very least, can this be made to print the entire block of code and 
not just the one line, because that makes it very confusing for the user.

More takes on the issue here - https://github.com/PyCQA/isort/issues/1568

--
components: Library (Lib)
messages: 378906
nosy: Mithil
priority: normal
severity: normal
status: open
title: Verbose/confusing default format on warnings
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com