[Python-Dev] Exception for setting attributes of built-in type

2009-06-14 Thread Seo Sanghyeon
Exception for setting attributes of built-in type differs between
CPython and IronPython. This is not purely theoretical, as
zope.interface tries to set Implements declaration as __implemented__
attribute of built-in type object, and excepts TypeError.

Python 2.6.1
 object.flag = True
TypeError: can't set attributes of built-in/extension type 'object'

IronPython 2.6
 object.flag = True
AttributeError: 'object' object has no attribute 'flag'

I was surprised that CPython raises TypeError. Library Reference seems
to mention it here:

exception AttributeError
Raised when an attribute reference or assignment fails. (When an
object does not support attribute references or attribute assignments
at all, TypeError is raised.)
http://docs.python.org/library/exceptions.html

What does it mean that an object does not support attribute
references or attribute assignments at all?

-- 
Seo Sanghyeon
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Request for review

2006-04-12 Thread Seo Sanghyeon
Can someone have a look at #860326? I got bitten by it today, and I can
see no reason not to apply suggested patch.

Thanks!

Seo Sanghyeon
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] PEP 247 and hashlib

2006-01-15 Thread Seo Sanghyeon
PEP 247 -- API for Cryptographic Hash Functions specifies a standard
API for hashing modules.

new([string])
... the optional 'string' parameter, if supplied, will be immediately
hashed into the object's starting state, as if obj.update(string) was
called.

But hashlib.new() takes the algorithm name... Does PEP need an update?

By the way, I am thinking about mapping .NET's
System.Security.Cryptography.HashAlgorithm.Create and created object's
ComputeHash method to Python's hash API for IronPython. For that, I'd
like to see a clarification.

Seo Sanghyeon
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com