TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Python with do..end in place of strict indentation

12 点作者 humility4 个月前

8 条评论

driggs4 个月前
Anyone who can&#x27;t see past Python&#x27;s indentation-based syntax is a person who doesn&#x27;t understand Python.<p>(Both literally and figuratively!)<p>When &quot;significant whitespace&quot; is at the top of someone&#x27;s complaints about Python, I&#x27;m immediately done hearing about their superficial criticism of the language.
评论 #42691488 未加载
评论 #42692253 未加载
评论 #42691547 未加载
评论 #42692136 未加载
评论 #42691752 未加载
评论 #42692362 未加载
评论 #42691432 未加载
评论 #42691410 未加载
animal_spirits4 个月前
&gt; I built this to learn more about python&#x2F;interpreter language syntax in general, but not interested in pursuing this further.<p>Good job trying something new out! There is always room for experimentation, if any reason to try to learn something new.
评论 #42691854 未加载
gus_massa4 个月前
Sorry, I have to ask...<p>Does it support also braces? :)<p>IIUC the source is writen as a long heresting and then executed.<p>Does it have the same speed than normal Python?<p>Does it suppont numpy, numba and other similar packages that use jit?<p>Can a function inside the modified code call a function outside? (It may be helpful for porting conde one function at a time.)<p>Is it possible to do something similar with a decorator instead of a herestring?
评论 #42662235 未加载
评论 #42657816 未加载
airstrike4 个月前
I used to code in Python for everything in the late aughts and loved meaningful whitespace. Whenever I used a language with braces like JavaScript, for instance, I felt like I was still indenting code meaningfully but now I had the extra hurdle of also caring about the braces. It felt unnecessary and stone-agey.<p>But back then I was just using vim with a nicely configured .vimrc. Linters weren&#x27;t really a thing, or at least not neatly integrated into my editing experience.<p>Nowadays I write Rust in vscode and I love braces. Rustfmt just formats my code every time anyway, so I don&#x27;t have to care about indentation and braces are placed where they should be. I spend zero time caring about code formatting, outside of configuring rustfmt.toml once per project or the occasional #[rustfmt::skip] for codeblocks which I really want to format in a specific way outside of the linter&#x27;s configured rules. I also have the benefit of the compiler screaming at me if I forget a brace, pointing to the exact error including telling me when indentation is suggesting a brace is missing! :O<p>Moreover, I&#x27;m much more proficient in vim, and the single hotkey % is reason enough to want to favor braces. Coupled with how often I paste code into Claude, V$%,y has become muscle memory (visually select this whole line, go to the end of the line, then expand the selection to the line matching the closing delimiter under the cursor, then yank everything into the system clipboard with &lt;leader&gt;y)...<p>On occasion, I go back to Python for some side project and the whole experience feels... weird. If braces before LSPs and linters was the stone age, then Python feels like the iron age and I&#x27;m living in the future with a compiler that is incredibly talkative and helpful. I&#x27;m never going back.
评论 #42692175 未加载
评论 #42691731 未加载
评论 #42692496 未加载
scotty794 个月前
Seeing code blocks as braced or meaningfully indented should be a switch in your IDE.
评论 #42692258 未加载
kazinator4 个月前
Please make the corner&#x2F;base cases more prominent. For instance, the question obviously arises: can we have this:<p><pre><code> def function(x) do end </code></pre> without writing &quot;pass&quot;?
1oooqooq4 个月前
i imagine the thought process went &quot;oh, indentation is much inferior to braces. i know, let me use the second worst option to braces.&quot;
relyks4 个月前
Make Python look like Ruby
评论 #42691763 未加载
评论 #42691744 未加载