0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

めざせpythonライブラリマスター (55)namespaces

Posted at

#【ライブラリ説明】
 クラスメンバーに対してのgetとset可不可

#【プログラム】

namespaces.py
# -*- coding: utf-8 -*-

import namespaces

ns = namespaces.Namespace(a=1, b=2)
fns = namespaces.FrozenNamespace(ns)
print fns.b
# 2
ns.c
# AttributeError: 'Namespace' object has no attribute 'c'
ns.c = 3
print ns.c
# 3
fns.c = 3
# AttributeError: 'FrozenNamespace' object has no attribute '__setattr__'

#【参考サイト】
 pypi
 github

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?