Feature
In TypeScript you can say Partial<X> and get an object whose attributes are all Optional; I would like this in some form for Mypy.
See https://www.typescriptlang.org/docs/handbook/utility-types.html
Pitch
This is incredibly useful for any situation where you need a delta, or a partially-constructed / curried form of an object. For example, when processing a PATCH request in an HTTP framework, a Partial object lets you avoid re-defining a class or working with unstructured JSON because you already know all the attributes you might receive and now you can just test them for None-ness. Or in a test framework where 90% of the attributes are initialized with the same defaults, you can provide a function that takes a partial type which populates only the attributes which are unspecified.
The absence of object literals makes this slightly less useful in Python, but maybe if we added **kw to object.__init__ to assign as attributes, it would be even better :).
Feature
In TypeScript you can say
Partial<X>and get an object whose attributes are allOptional; I would like this in some form for Mypy.See https://www.typescriptlang.org/docs/handbook/utility-types.html
Pitch
This is incredibly useful for any situation where you need a delta, or a partially-constructed / curried form of an object. For example, when processing a
PATCHrequest in an HTTP framework, aPartialobject lets you avoid re-defining a class or working with unstructured JSON because you already know all the attributes you might receive and now you can just test them forNone-ness. Or in a test framework where 90% of the attributes are initialized with the same defaults, you can provide a function that takes a partial type which populates only the attributes which are unspecified.The absence of object literals makes this slightly less useful in Python, but maybe if we added
**kwtoobject.__init__to assign as attributes, it would be even better :).