[Python-Dev] PEP 362 Third Revision

R. David Murray rdmurray at bitdance.com
Fri Jun 15 20:46:09 CEST 2012


On 2012年6月15日 11:17:09 -0700, Larry Hastings <larry at hastings.org> wrote:
> On 06/15/2012 04:32 AM, Nick Coghlan wrote:
> > Since I don't believe your proposed flag will answer any question that
> > actually matters in practice, I consider it useless noise that should
> > be dropped from the proposal.
>> I can cite a situation where it matters in practice: the implementation 
> of os.fwalk is effectively gated on hasattr(posix, "openat"). I expect 
> to remove openat() in favor of adding a dir_fd parameter to open (see 
> issue 14626).

I don't think that justifies adding an attribute to __signature__,
though. As someone pointed out, it isn't part of the function's
signature, it is part of the function's function.
Adding a os.have_openat seems more reasonable than adding is_implemented
to every __signature__ object. And more useful, as well; it provides
a much more specific piece of information.
> > Now, what a function *could* do is set __signature__ to a Signature
> > subclass that provided an additional "validate()" method, or provided
> > arbitrary additional information about supported features. That's a
> > perfectly reasonable option.
>> What would the validate() function for os.close do?

Why would you need one?
--David


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /