1*a0428e9eSAndrew Rist#************************************************************** 2cdf0e10cSrcweir# 3*a0428e9eSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 4*a0428e9eSAndrew Rist# or more contributor license agreements. See the NOTICE file 5*a0428e9eSAndrew Rist# distributed with this work for additional information 6*a0428e9eSAndrew Rist# regarding copyright ownership. The ASF licenses this file 7*a0428e9eSAndrew Rist# to you under the Apache License, Version 2.0 (the 8*a0428e9eSAndrew Rist# "License"); you may not use this file except in compliance 9*a0428e9eSAndrew Rist# with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir# 11*a0428e9eSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir# 13*a0428e9eSAndrew Rist# Unless required by applicable law or agreed to in writing, 14*a0428e9eSAndrew Rist# software distributed under the License is distributed on an 15*a0428e9eSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*a0428e9eSAndrew Rist# KIND, either express or implied. See the License for the 17*a0428e9eSAndrew Rist# specific language governing permissions and limitations 18*a0428e9eSAndrew Rist# under the License. 19cdf0e10cSrcweir# 20*a0428e9eSAndrew Rist#************************************************************** 21cdf0e10cSrcweir 22cdf0e10cSrcweir# Pseudo const 23cdf0e10cSrcweirclass _const: 24cdf0e10cSrcweir class ConstError(TypeError): pass 25cdf0e10cSrcweir def __setattr__(self, name, value): 26cdf0e10cSrcweir if self.__dict__.has_key(name): 27cdf0e10cSrcweir raise self.ConstError, "Can't rebind const(%s)"%name 28cdf0e10cSrcweir self.__dict__[name] = value 29cdf0e10cSrcweir 30cdf0e10cSrcweirimport sys 31cdf0e10cSrcweirsys.modules[__name__] = _const() 32cdf0e10cSrcweir 33cdf0e10cSrcweir 34