Skip to content

Conversation

@ntBre
Copy link
Contributor

@ntBre ntBre commented Dec 12, 2025

Summary

Following #8179, we now format long lambda expressions a bit more like Black, preferring to keep long parameter lists on a single line, but we go one step further to break the body itself across multiple lines and parenthesize it if it's still too long. This PR documents both the stable deviation that breaks parameters across multiple lines, and the new preview deviation that breaks the body instead.

I also fixed a couple of typos in the section immediately above my addition.

Test Plan

I tested all of the snippets here against main for the preview behavior, our playground for the stable behavior, and Black's playground for their behavior

Summary
--

Following #8179, we now format long lambda expressions a bit more like Black,
preferring to keep long parameter lists on a single line, but we go one step
further to break the body itself across multiple lines and parenthesize it if
it's still too long. This PR documents both the stable deviation that breaks
parameters across multiple lines, and the new preview deviation that breaks the
body instead.

I also fixed a couple of typos in the section immediately above my addition.

Test Plan
--

I tested all of the snippets here against `main` for the preview behavior, our
playground for the stable behavior, and Black's playground for their behavior
@ntBre ntBre requested a review from MichaReiser December 12, 2025 17:26
@ntBre ntBre added the documentation Improvements or additions to documentation label Dec 12, 2025
@ntBre ntBre merged commit dec4154 into main Dec 12, 2025
35 checks passed
@ntBre ntBre deleted the brent/lambda-deviation branch December 12, 2025 17:57
dcreager added a commit that referenced this pull request Dec 13, 2025
* origin/main: (22 commits)
  [ty] Allow gradual lower/upper bounds in a constraint set (#21957)
  [ty] disallow explicit specialization of type variables themselves (#21938)
  [ty] Improve diagnostics for unsupported binary operations and unsupported augmented assignments (#21947)
  [ty] update implicit root docs (#21955)
  [ty] Enable even more goto-definition on inlay hints (#21950)
  Document known lambda formatting deviations from Black (#21954)
  [ty] fix hover type on named expression target (#21952)
  Bump benchmark dependencies (#21951)
  Keep lambda parameters on one line and parenthesize the body if it expands (#21385)
  [ty] Improve resolution of absolute imports in tests (#21817)
  [ty] Support `__all__ += submodule.__all__`
  [ty] Change frequency of invalid `__all__` debug message
  [ty] Add `KnownUnion::to_type()` (#21948)
  [ty] Classify `cls` as class parameter (#21944)
  [ty] Stabilize rename (#21940)
  [ty] Ignore `__all__` for document and workspace symbol requests
  [ty] Attach db to background request handler task (#21941)
  [ty] Fix outdated version in publish diagnostics after `didChange` (#21943)
  [ty] avoid fixpoint unioning of types containing current-cycle Divergent (#21910)
  [ty] improve bad specialization results & error messages (#21840)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants