Richard van der Hoff wrote: > Thanks Tom, Glyph. > I raised an issue for the `host` parameter at > https://twistedmatrix.com/trac/ticket/10251. Who knows, I might even get > round to opening a PR for it real soon now. > On 08/08/2021 03:22, Glyph wrote: > > On Aug 7, 2021, at 2:15 PM, Tom Most <t...@freecog.net > > mailto:t...@freecog.net> wrote: > > This one seems less clear-cut to me. I think that you could use > > connectTCP through and endpoint like IHostnameEndpoint and they'd > > always be passed. > > Perhaps optional parameters are usually not a good idea for > > interfaces? I'm thinking of IAgent.request [3], where the optionality > > of the headers parameter leads to a lot of similar-looking > > conditional code in every implementer. Best to hoist that logic to a > > top-level facade (e.g., Treq). > > I agree with the general point about optionality, but I would say that > > a zillion clients would break with your implementation if you required > > bindAddress and timeout, so in this case let's just make IReactorTCP > > reflect actual reality. > > Is there a way to define a parameter as optional in an Interface, > without forcing the Interface to define what the default values are? It > seems reasonable to me that different implementations might want to have > different defaults for these parameters, so the default values should be > properties of the implementation, not the interface. > R
I think you can use an ellipsis: `def ham(spam: Typ = ...):` _______________________________________________ Twisted mailing list -- twisted@python.org To unsubscribe send an email to twisted-le...@python.org https://mail.python.org/mailman3/lists/twisted.python.org/ Message archived at https://mail.python.org/archives/list/twisted@python.org/message/ZFTSMOD6AIXLZLA7PXK6HDAVZU2L3KOI/ Code of Conduct: https://twisted.org/conduct