C++ では、「using」キーワードを慎重に使用することで、コードの可読性を大幅に改善できることがよくあります。次に例を示します。
void foo()
{
std::vector< std::map <int, std::string> > crazyVector;
std::cout << crazyVector[0].begin()->first;
}
になる
void foo()
{
using namespace std; // limited in scope to foo
vector< map <int, string> > crazyVector;
cout << crazyVector[0].begin()->first;
}
Pythonにも同様のものが存在しますか、それともすべてを完全に修飾する必要がありますか?
使用には落とし穴があり、範囲を適切に制限する必要があることを知っているという免責事項を追加します。