You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And then, we can represent the type of a function like::
35
+
35
36
def func(
36
37
a: int,
37
38
/,
@@ -169,6 +170,19 @@ We also have helpers for extracting those names; they are all definable in terms
169
170
TODO: How should GetAttr interact with descriptors/classmethod? I am leaning towards it should apply the descriptor...
170
171
171
172
173
+
--------------------------------
174
+
Callable inspection and creation
175
+
--------------------------------
176
+
177
+
* TODO: Should ``GetArg`` on a callable automatically convert ``[int, str]`` or whatever into something using ``Param``? Or should a separate operator be needed?
178
+
179
+
* ``GetParamName[T: Param]``
180
+
* ``GetParamType[T: Param]``
181
+
* ``GetParamQuals[T: Param]``
182
+
183
+
This is unsatisfying; maybe they all need to be just ``ParamName`` and also ``MemberName`` above.
184
+
We could also merge the getters for ``Param`` and ``Member``.
185
+
172
186
----
173
187
174
188
* ``Length[T: tuple]`` - get the length of a tuple as an int literal (or ``Literal[None]`` if it is unbounded)
We can put more in, but this is what typescript has.
180
194
``Slice`` and ``Concat`` are a poor man's literal template.
181
195
We can actually implement the case functions in terms of them and a
182
-
bunch of conditionals.
196
+
bunch of conditionals, but shouldn't (especially if we want it to work for all unicode!).
183
197
184
198
-------------------
185
199
String manipulation
@@ -197,6 +211,7 @@ String manipulation
197
211
----
198
212
199
213
Two possibilities for creating parameterized functions/types. They are kind of more syntax than functions exactly. I like the lambda one more.
214
+
200
215
* ``NewParameterized[V, Ty]`` - ``V`` should be a ``TypeVar`` (ugh!) and ``Ty`` should be a ``Callable`` or a ``NewProtocol`` or some such.
201
216
* ``NewParameterized[lambda v: Ty]`` - The lambda could take multiple params, and introduce multiple variables. The biggest snag is how to specify bounds; one option is via default arguments.
0 commit comments