O ponto de vista do __main__ pode te confundir em módulos e pacotes Python
This commit is contained in:
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -17,7 +17,7 @@
|
|||||||
"[python]": {
|
"[python]": {
|
||||||
"editor.defaultFormatter": "ms-python.python",
|
"editor.defaultFormatter": "ms-python.python",
|
||||||
"editor.tabSize": 4,
|
"editor.tabSize": 4,
|
||||||
"editor.insertSpaces": true,
|
"editor.insertSpaces": false,
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
// "editor.codeActionsOnSave": {
|
// "editor.codeActionsOnSave": {
|
||||||
// "source.fixAll": true,
|
// "source.fixAll": true,
|
||||||
|
|||||||
26
aula99.py
26
aula99.py
@@ -1,14 +1,18 @@
|
|||||||
from sys import path
|
# from sys import path
|
||||||
|
|
||||||
import aula99_package.modulo
|
# import aula99_package.modulo
|
||||||
from aula99_package import modulo
|
# from aula99_package import modulo
|
||||||
from aula99_package.modulo import *
|
# from aula99_package.modulo import *
|
||||||
|
|
||||||
# from aula99_package.modulo import soma_do_modulo
|
# # from aula99_package.modulo import soma_do_modulo
|
||||||
|
|
||||||
# print(*path, sep='\n')
|
# # print(*path, sep='\n')
|
||||||
print(soma_do_modulo(1, 2))
|
# print(soma_do_modulo(1, 2))
|
||||||
print(aula99_package.modulo.soma_do_modulo(1, 2))
|
# print(aula99_package.modulo.soma_do_modulo(1, 2))
|
||||||
print(modulo.soma_do_modulo(1, 2))
|
# print(modulo.soma_do_modulo(1, 2))
|
||||||
print(variavel)
|
# print(variavel)
|
||||||
print(nova_variavel)
|
# print(nova_variavel)
|
||||||
|
from aula99_package.modulo import fala_oi, soma_do_modulo
|
||||||
|
|
||||||
|
print(__name__)
|
||||||
|
fala_oi()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
# 'soma_do_modulo',
|
# 'soma_do_modulo',
|
||||||
# 'nova_variavel',
|
# 'nova_variavel',
|
||||||
# ]
|
# ]
|
||||||
|
from aula99_package.modulo_b import fala_oi
|
||||||
|
|
||||||
variavel = 'Alguma coisa'
|
variavel = 'Alguma coisa'
|
||||||
|
|
||||||
@@ -12,3 +13,4 @@ def soma_do_modulo(x, y):
|
|||||||
|
|
||||||
|
|
||||||
nova_variavel = 'OK'
|
nova_variavel = 'OK'
|
||||||
|
# fala_oi()
|
||||||
|
|||||||
2
aula99_package/modulo_b.py
Normal file
2
aula99_package/modulo_b.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
def fala_oi():
|
||||||
|
print('oi')
|
||||||
Reference in New Issue
Block a user