[Python-3000] Abilities / Interfaces and security

Jim Jewett jimjjewett at gmail.com
Mon Nov 27 20:19:22 CET 2006


On 11/22/06, Phillip J. Eby <pje at telecommunity.com> wrote:

> While this is more verbose than sticking an 'if' into the original
> sendmail(), note that it can also be added by a third party, via:

>      overload smtpblib.SMTP.sendmail(
>          self, from_addr, to_addrs:str, msg,
>          mail_options=[], rcpt_options=[]
>      ):
>          self.sendmail(from_addr, [to_addrs], msg, mail_options, rcpt_options)

> So, someone who didn't want to wait for the patch to add your "if" could
> just add their own fix on the fly.  :)

Hey, cool, can I also do

    overload smtplib.SMTP.sendmail(self, from_addr:str, to_addrs:str, msg, ...)
        if stalkee == from_addr:
            archive_and_randomly_rewrite_before_sending(...)

Since this is more specific on the from_addr, it should always be called.

Also, can I

    overload __builtins__.str(arg:object)

to effectively extend (or replace) the builtin type?

There is certainly value in open classes, and it can make writing code
easier.  But it can also make maintaining code much harder.  Today,
almost all classes are open, but those coded in C are typically closed
-- and Brett is relying on this for security.
How-it-happened-to-be-implemented may not be the best way to decide
open/closed, but I think there needs to be *some* way of keeping a
class closed.

-jJ


More information about the Python-3000 mailing list