def point_type(name, fields, srid_map):
def srid(self):<EOL><INDENT>try:<EOL><INDENT>return srid_map[len(self)]<EOL><DEDENT>except KeyError:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>attributes = {"<STR_LIT>": property(srid)}<EOL>for index, subclass_field in enumerate(fields):<EOL><INDENT>def accessor(self, i=index, f=subclass_field):<EOL><INDENT>try:<EOL><INDENT>return self[i]<EOL><DEDENT>except IndexError:<EOL><INDENT>raise AttributeError(f)<EOL><DEDENT><DEDENT>for field_alias in {subclass_field, "<STR_LIT>"[index]}:<EOL><INDENT>attributes[field_alias] = property(accessor)<EOL><DEDENT><DEDENT>cls = type(name, (Point,), attributes)<EOL>with __srid_table_lock:<EOL><INDENT>for dim, srid in srid_map.items():<EOL><INDENT>__srid_table[srid] = (cls, dim)<EOL><DEDENT><DEDENT>return cls<EOL>
Dynamically create a Point subclass.