Project: python/cpython
File: Lib/test/test_importlib/util.py:75
def specialize_class(cls, kind, base=None, **kwargs): # XXX Support passing in submodule names--load (and cache) ...
SVG: dark, light
File: Lib/test/test_importlib/util.py:75
def specialize_class(cls, kind, base=None, **kwargs): # XXX Support passing in submodule names--load (and cache) ...
SVG: dark, light
November 7, 2025 at 5:38 PM
Everybody can reply
lol another fun kwargs bug.
def foo(a, b=2):
return (a, b)
print(foo(1, b=4)) # (1, 2) YIKES!
def foo(a, b=2):
return (a, b)
print(foo(1, b=4)) # (1, 2) YIKES!
October 27, 2025 at 4:22 PM
Everybody can reply
Here is the mental model for TextAssociations.jl users:
Raw Text / Corpus
↓
ContingencyTable
↓
CorpusContingencyTable
↓
assoc_score(::Type{<:AssociationMetric}, x::AssociationDataFormat; kwargs...)
↓
Metric evaluator (eval_pmi, …)
↓
Result as DataFrame (or Vector if scores_only=true)
Raw Text / Corpus
↓
ContingencyTable
↓
CorpusContingencyTable
↓
assoc_score(::Type{<:AssociationMetric}, x::AssociationDataFormat; kwargs...)
↓
Metric evaluator (eval_pmi, …)
↓
Result as DataFrame (or Vector if scores_only=true)
October 26, 2025 at 10:17 PM
Everybody can reply
Oh yeah, kwargs work too:
dict(one=1, two=2, three=3)
dict({'one': 1, 'three': 3}, two=2)
dict(one=1, two=2, three=3)
dict({'one': 1, 'three': 3}, two=2)
October 3, 2025 at 6:39 PM
Everybody can reply
have you ever annotated a TypedDict onto the **kwargs fuction and want Sphinx to automatically add it to the function's docstring?
class GreetingKwargs(TypedDict):
name: Annotated[str, Doc("the name of the person to greet")]
def greet(**kwargs […]
[Original post on scholar.social]
class GreetingKwargs(TypedDict):
name: Annotated[str, Doc("the name of the person to greet")]
def greet(**kwargs […]
[Original post on scholar.social]
October 3, 2025 at 3:30 PM
Everybody can reply
2 reposts
Project: python/cpython
File: Lib/argparse.py:1661
def _get_optional_kwargs(self, *args, **kwargs): # determine short and long option strings
SVG: dark, light
File: Lib/argparse.py:1661
def _get_optional_kwargs(self, *args, **kwargs): # determine short and long option strings
SVG: dark, light
October 1, 2025 at 6:43 PM
Everybody can reply
Forgive me, I memAI'd again
October 1, 2025 at 5:27 PM
Everybody can reply
2 likes
Project: python/cpython
File: Objects/methodobject.c:544
static PyObject * cfunction_call(PyObject *func, PyObject *args, PyObject *kwargs)
SVG: dark, light
File: Objects/methodobject.c:544
static PyObject * cfunction_call(PyObject *func, PyObject *args, PyObject *kwargs)
SVG: dark, light
October 1, 2025 at 12:50 PM
Everybody can reply
October 1, 2025 at 11:15 AM
Everybody can reply
1 likes
Community highlights ✨
- @robpalmer.bsky.social on fresh ECMAScript proposals
- @pi0.io announces Jiti 2.6 perf improvements
- @jasnell.me on Cloudflare's Node.js compatibility improvements
- @xavd.id explains Python-style kwargs in TS
- @stefanjudis.com shares tiny-helpers.dev tools
- @robpalmer.bsky.social on fresh ECMAScript proposals
- @pi0.io announces Jiti 2.6 perf improvements
- @jasnell.me on Cloudflare's Node.js compatibility improvements
- @xavd.id explains Python-style kwargs in TS
- @stefanjudis.com shares tiny-helpers.dev tools
September 30, 2025 at 9:23 PM
Everybody can reply
2 likes
Today on the pod, TS 6.0 defaults, fresh ECMAScript proposals (no frozen privates, Array.pushAll, iterator chunking), Cap'n Web RPC, Python kwargs in TS, and running TS on DOS (and PlayStation?)!
share.transistor.fm/s/db6f3035
#typescript
share.transistor.fm/s/db6f3035
#typescript
New ECMAScript Proposals, Cap'n Web, and TS on DOS/PlayStation | News | Ep 37 | TypeScript.fm - The Friendly Show for TypeScript Developers | Episode 37
News of the week of September 22, 2025: new default option in TS 6.0, Jiti upgrade, and Cloudflare's on a tear. Plus, npm's security roadmap. From the community: Python-style kwargs, running TS on MS-DOS,...
share.transistor.fm
September 30, 2025 at 9:23 PM
Everybody can reply
2 reposts
1 quotes
8 likes
Project: python/cpython
File: Lib/test/test_argparse.py:144
def stderr_to_parser_error(parse_args, *args, **kwargs): # if this is being called recursively and stderr or stdout is...
SVG: dark, light
File: Lib/test/test_argparse.py:144
def stderr_to_parser_error(parse_args, *args, **kwargs): # if this is being called recursively and stderr or stdout is...
SVG: dark, light
September 27, 2025 at 2:05 AM
Everybody can reply
Python-style kwargs in TypeScript xavd.id/blog/post/py...
Python-style kwargs in TypeScript
A pain-free way to write expressive, readable typed option bags in TypeScript.
xavd.id
September 25, 2025 at 12:37 PM
Everybody can reply
📰 Python-Style Kwargs in TypeScript
💬 Sentiment: Mixed 🤔
Vibe: Developers debate the merits of default arguments vs. options objects. Clunky solutions come under fire.
https://news.ycombinator.com/item?id=45330560
💬 Sentiment: Mixed 🤔
Vibe: Developers debate the merits of default arguments vs. options objects. Clunky solutions come under fire.
https://news.ycombinator.com/item?id=45330560
September 25, 2025 at 11:00 AM
Everybody can reply
1 likes
Python-Style Kwargs in TypeScript | Discussion
Python-style kwargs in TypeScript
A pain-free way to write expressive, readable typed option bags in TypeScript.
xavd.id
September 25, 2025 at 11:00 AM
Everybody can reply
1 likes
1 saves
September 25, 2025 at 10:30 AM
Everybody can reply
2 likes
Python-style kwargs in TypeScript
My TypeScript function signatures always start small. There's usually an optional argument or two, but the call sites are easy to reason about: const greet = (name: string, prefix = "Hello") => `${prefix}, ${name}.`; greet("Alice"); greet("Bob", "!"); But as these…
My TypeScript function signatures always start small. There's usually an optional argument or two, but the call sites are easy to reason about: const greet = (name: string, prefix = "Hello") => `${prefix}, ${name}.`; greet("Alice"); greet("Bob", "!"); But as these…
Python-style kwargs in TypeScript
My TypeScript function signatures always start small. There's usually an optional argument or two, but the call sites are easy to reason about: const greet = (name: string, prefix = "Hello") => `${prefix}, ${name}.`; greet("Alice"); greet("Bob", "!"); But as these functions grow, it's cumbersome to specify the last optional argument while using defaults for the rest: const greet = ( name: string, prefix = "Hello", ending = ".", extraNames: string[] | undefined = undefined ) => `${prefix}, ${name}${ extraNames?.length ? `, ${extraNames.join(", ")}` : "" }${ending}`; greet("Alice", undefined, "!"); greet("Alice", undefined, undefined, ["Bob", "Charlie"]); …
n24usa.com
September 25, 2025 at 10:26 AM
Everybody can reply
1 likes
September 25, 2025 at 10:04 AM
Everybody can reply
1 likes
Python-Style Kwargs in TypeScript
L: https://xavd.id/blog/post/python-kwargs-in-typescript/
C: https://news.ycombinator.com/item?id=45330560
posted on 2025.09.22 at 04:25:53 (c=0, p=3)
L: https://xavd.id/blog/post/python-kwargs-in-typescript/
C: https://news.ycombinator.com/item?id=45330560
posted on 2025.09.22 at 04:25:53 (c=0, p=3)
September 25, 2025 at 10:03 AM
Everybody can reply
1 likes
Wrote a little #blog post over the weekend about my favorite #TypeScript pattern: #Python kwargs! It's a great little pattern.
xavd.id/blog/post/py...
xavd.id/blog/post/py...
Python-style kwargs in TypeScript
A pain-free way to write expressive, readable typed option bags in TypeScript.
xavd.id
September 22, 2025 at 4:56 PM
Everybody can reply
5 likes
Something that I've bumped my head against too often in `transformers` is how kwargs are sometimes dealt with. Just popping what's needed from kwargs but as a user it's then unclear if an argument is unexpectedly unused (and no good code editor support). Nice to see changes here!
September 22, 2025 at 11:53 AM
Everybody can reply
1 likes
ith self.request("POST", url, **kwargs) as response:
yield response
async def __aenter__(self):
self.session = await self.session.__aenter__()
return self
async def __aexit__(self, exc_type, exc_val, exc_tb):
await self.session.close()
async def main()
yield response
async def __aenter__(self):
self.session = await self.session.__aenter__()
return self
async def __aexit__(self, exc_type, exc_val, exc_tb):
await self.session.close()
async def main()
September 18, 2025 at 5:28 PM
Everybody can reply
async def get(self, url: str, **kwargs: Any) -> aiohttp.ClientResponse:
async with self.request("GET", url, **kwargs) as response:
yield response
@contextlib.asynccontextmanager
async def post(self, url: str, **kwargs: Any) -> aiohttp.ClientResponse:
async w
September 18, 2025 at 5:28 PM
Everybody can reply
ath=ath,
)
headers["DPoP"] = retry_proof
kwargs["headers"] = headers
snoop.pp(headers)
response_after_retry = await astack.enter_async_context(
self.session.request(method, url, **kwargs),
)
)
headers["DPoP"] = retry_proof
kwargs["headers"] = headers
snoop.pp(headers)
response_after_retry = await astack.enter_async_context(
self.session.request(method, url, **kwargs),
)
September 18, 2025 at 5:28 PM
Everybody can reply
tial_nonce,
ath=ath,
)
headers["DPoP"] = initial_proof
kwargs["headers"] = headers
async with contextlib.AsyncExitStack() as astack:
response = await astack.enter_async_context(
self.session.request(method, url, **kwargs),
ath=ath,
)
headers["DPoP"] = initial_proof
kwargs["headers"] = headers
async with contextlib.AsyncExitStack() as astack:
response = await astack.enter_async_context(
self.session.request(method, url, **kwargs),
September 18, 2025 at 5:27 PM
Everybody can reply