1
In PHP, we can use a PHP script to just return values, which is very useful for creating configuration files for an application.
Example DB.php
return array(
'host' => 'localhost',
'username' => 'username',
...
);
index.php
$config = include 'DB.php';
print_r($config);
// Retorna o array contendo os valores retornados em "DB.php"
While trying to "imitate" this in Python
, I was unsuccessful because I made a mistake.
Example db.py
return [
1, 2, 3
]
Upshot:
'Return' Outside Function
In this case, if I wanted to upload a file to python
, only for data return purpose for configuration, as I could do?
Thinking about your answer, it kind of looks like the way it’s done in Django
– Wallace Maxters