[issue41616] Global variable in whole project and Relative imports problem

2020-08-24 Thread Guido van Rossum


Change by Guido van Rossum :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue41616] Global variable in whole project and Relative imports problem

2020-08-22 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

One issue per ticket please.

Versions 3.9 and older are all in feature freeze, they will not get new 
features.

Combining a global declaration with an assignment has been requested before, 
and rejected. If you want to discuss that feature again, you should raise it on 
the Python-Ideas mailing list first, but unless you have a stronger reason than 
just saving a line of code, it probably won't be accepted.

Project-wide globals has not, as far as I can remember, been requested before, 
but again it needs to be discussed on Python-Ideas first.

Your comments about relative imports don't seem to be either a feature request 
or a bug report, but just a vague complaint that it often causes problems. 
Please be more precise.

Problems with global variables are nearly always problems with global 
variables, not bugs with Python. Global variables are very easy to misuse and 
often cause problems.

https://weblogs.asp.net/wallen/6750

http://wiki.c2.com/?GlobalVariablesAreBad

--
nosy: +steven.daprano
versions:  -Python 3.5, 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



[issue41616] Global variable in whole project and Relative imports problem

2020-08-22 Thread ManPython


New submission from ManPython :

1. Curently we have easy option to declare global variable (GV) 
a) like this:
global var1
var1 = 'whatever'

b) with some improved version like this:
global var1 'whatever'
or:
global var1,var2, 'whatever1','whatever2'

c) The Python is in way to produce small lines of code but this philosophy 
around GV not offering this.


2. Can we have easy option to delclare global variable for whole project 
including MVC?
a) By this is requiments to call GV in any place like in Model, View or 
Controler and change thits var globaly.

b) I noticed that programers many often calling module in main to operate with, 
where this way made many problems withs Relative imports
https://stackoverflow.com/questions/30669474/beyond-top-level-package-error-in-relative-import
https://stackoverflow.com/questions/14132789/relative-imports-in-python-2-7/
https://stackoverflow.com/questions/35166821/valueerror-attempted-relative-import-beyond-top-level-package
https://stackoverflow.com/questions/4000/attempted-relative-import-beyond-toplevel-package

b) In my test the Relative imports made often problems (As imposible to load - 
most often Django, but similar with Pyside2) and I noticed that exist some 
relation with global var. In some of P36 version most often due to libs. Wan't 
checking this, expecting other way (more easy) to solve typical problems with 
GV.
1) in Django most often is meeting in config.py
2) in Pyside2 most often is meeting in main.py where we calling 
model,view,controler (or other liek utils) and we trying working in some core 
variables that limitig projects to easy manage GV

--
components: Interpreter Core
messages: 375799
nosy: ManPython
priority: normal
severity: normal
status: open
title: Global variable in whole project and Relative imports problem
type: enhancement
versions: Python 3.10, Python 3.5, 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