並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 40 件 / 47件

新着順 人気順

break and continue in if statement pythonの検索結果1 - 40 件 / 47件

  • ソースコード & ドキュメントに対応したGraph RAGの実装(Tree-sitter + LightRAG)

    (module (function_definition (identifier) # ← ここに関数名「sample_func」が含まれます (parameters) (block (expression_statement (call (identifier) (argument_list (string)))))) (expression_statement (call (identifier) (argument_list)))) ノードが色々取れましたが、「function_definition」が関数、その子である「identifier」が関数名を表すため、 function_definition == 子ノード ==> identifier となっている箇所を探索すれば抽出できます(関数ではあっても「lambda」など異なる場合もあります)。 今回は上記のようにTree-si

      ソースコード & ドキュメントに対応したGraph RAGの実装(Tree-sitter + LightRAG)
    • Python 3.10から導入されたBetter error messagesの深掘り | gihyo.jp

      鈴木たかのりです。今月のPython Monthly Topicsでは、Python 3.10から導入されたBetter error messagesについて紹介します。Better error messagesがどういったものであるかの紹介と、どのようにこのエラーメッセージが出力されているか、Python内部の処理についても触れようと思います。 Better error messagesとは Python 3.10からBetter error messagesという機能が追加されました。この機能は名前のとおり「エラーメッセージを改善」するものです。「⁠エラーメッセージの改善」により以前よりもわかりやすいエラーメッセージが出力され、ユーザーがエラーの意味に気づきやすくなりました。 例として、以下のようなリストの閉じカッコ(])を忘れたコードを実行し、出力されるエラーメッセージを見比べてみま

        Python 3.10から導入されたBetter error messagesの深掘り | gihyo.jp
      • Rewriting the Ruby parser

        At Shopify, we have spent the last year writing a new Ruby parser, which we’ve called YARP (Yet Another Ruby Parser). As of the date of this post, YARP can parse a semantically equivalent syntax tree to Ruby 3.3 on every Ruby file in Shopify’s main codebase, GitHub’s main codebase, CRuby, and the 100 most popular gems downloaded from rubygems.org. We recently got approval to merge this work into C

          Rewriting the Ruby parser
        • Agents

          Intelligent agents are considered by many to be the ultimate goal of AI. The classic book by Stuart Russell and Peter Norvig, Artificial Intelligence: A Modern Approach (Prentice Hall, 1995), defines the field of AI research as “the study and design of rational agents.” The unprecedented capabilities of foundation models have opened the door to agentic applications that were previously unimaginabl

            Agents
          • Weird Lexical Syntax

            I just learned 42 programming languages this month to build a new syntax highlighter for llamafile. I feel like I'm up to my eyeballs in programming languages right now. Now that it's halloween, I thought I'd share some of the spookiest most surprising syntax I've seen. The languages I decided to support are Ada, Assembly, BASIC, C, C#, C++, COBOL, CSS, D, FORTH, FORTRAN, Go, Haskell, HTML, Java,

              Weird Lexical Syntax
            • Golang Mini Reference 2022: A Quick Guide to the Modern Go Programming Language (REVIEW COPY)

              Golang Mini Reference 2022 A Quick Guide to the Modern Go Programming Language (REVIEW COPY) Harry Yoon Version 0.9.0, 2022-08-24 REVIEW COPY This is review copy, not to be shared or distributed to others. Please forward any feedback or comments to the author. • feedback@codingbookspress.com The book is tentatively scheduled to be published on September 14th, 2022. We hope that when the release da

              • April 2022 (version 1.67)

                Join a VS Code Dev Days event near you to learn about AI-assisted development in VS Code. Update 1.67.1: The update addresses this security issue. Update 1.67.2: The update addresses these issues. Downloads: Windows: x64 Arm64 | Mac: Universal Intel silicon | Linux: deb rpm tarball Arm snap Welcome to the April 2022 release of Visual Studio Code. There are many updates in this version that we hope

                  April 2022 (version 1.67)
                • Font with Built-In Syntax Highlighting

                  Note: I received a lot of great feedback from the discussions at Mastodon and Hacker News, so I've updated the post with some improvements to the font! I've also added some further examples and acknowledgements at the end. Syntax Highlighting in Hand-Coded Websites The problem I have been trying to identify practical reasons why hand-coding websites with HTML and CSS is so hard (by hand-coding, I

                  • Kalyn: a self-hosting compiler for x86-64

                    Over the course of my Spring 2020 semester at Harvey Mudd College, I developed a self-hosting compiler entirely from scratch. This article walks through many interesting parts of the project. It’s laid out so you can just read from beginning to end, but if you’re more interested in a particular topic, feel free to jump there. Or, take a look at the project on GitHub. Table of contents What the pro

                    • February 2021 (version 1.54)

                      Join a VS Code Dev Days event near you to learn about AI-assisted development in VS Code. Update 1.54.1: The update addresses an issue with an extension dependency. Update 1.54.2: The update addresses these issues. Update 1.54.3: The update addresses this issue. Downloads: Windows: x64 Arm64 | Mac: Universal Intel silicon | Linux: deb rpm tarball Arm snap Welcome to the February 2021 release of Vi

                        February 2021 (version 1.54)
                      • Patterns for Building LLM-based Systems & Products

                        Patterns for Building LLM-based Systems & Products [ llm engineering production 🔥 ] · 66 min read Discussions on HackerNews, Twitter, and LinkedIn “There is a large class of problems that are easy to imagine and build demos for, but extremely hard to make products out of. For example, self-driving: It’s easy to demo a car self-driving around a block, but making it into a product takes a decade.”

                          Patterns for Building LLM-based Systems & Products
                        • Accelerating Generative AI with PyTorch II: GPT, Fast – PyTorch

                          Blog Accelerating Generative AI with PyTorch II: GPT, Fast This post is the second part of a multi-series blog focused on how to accelerate generative AI models with pure, native PyTorch. We are excited to share a breadth of newly released PyTorch performance features alongside practical examples to see how far we can push PyTorch native performance. In part one, we showed how to accelerate Segmen

                            Accelerating Generative AI with PyTorch II: GPT, Fast – PyTorch
                          • Why People are Angry over Go 1.23 Iterators - gingerBill

                            NOTE: This is based on, but completely rewritten, from a Twitter post: https://x.com/TheGingerBill/status/1802645945642799423 TL;DR It makes Go feel too “functional” rather than being an unabashed imperative language. I recently saw a post on Twitter showing the upcoming Go iterator design for Go 1.23 (August 2024). From what I can gather, many people seem to dislike the design. I wanted to give m

                            • The Go Programming Language and Environment – Communications of the ACM

                              Go is a programming language created at Google in late 2007 and released as open source in November 2009. Since then, it has operated as a public project, with contributions from thousands of individuals and dozens of companies. Go has become a popular language for building cloud infrastructure: Docker, a Linux container manager, and Kubernetes, a container deployment system, are core cloud techno

                              • Andrej Karpathy — AGI is still a decade away

                                The Andrej Karpathy episode. Andrej explains why reinforcement learning is terrible (but everything else is much worse), why model collapse prevents LLMs from learning the way humans do, why AGI will just blend into the previous ~2.5 centuries of 2% GDP growth, why self driving took so long to crack, and what he sees as the future of education. Watch on YouTube; listen on Apple Podcasts or Spotify

                                  Andrej Karpathy — AGI is still a decade away
                                • Eliciting Reasoning in Language Models with Cognitive Tools

                                  arXiv:2506.12115v1 [cs.CL] 13 Jun 2025 Eliciting Reasoning in Language Models with Cognitive Tools Brown Ebouky IBM Research - Zurich ETH Zurich Brown.Ebouky@ibm.com Andrea Bartezzaghi IBM Research - Zurich abt@zurich.ibm.com Mattia Rigotti IBM Research - Zurich mrg@zurich.ibm.com Abstract The recent advent of reasoning models like OpenAI’s o1 was met with excited spec- ulation by the AI community

                                  • Introducing PyTorch Monarch – PyTorch

                                    We now live in a world where ML workflows (pre-training, post training, etc) are heterogeneous, must contend with hardware failures, are increasingly asynchronous and highly dynamic. Traditionally, PyTorch has relied on an HPC-style  multi-controller model, where multiple copies of the same script are launched across different machines, each running its own instance of the application (often refer

                                    • prompts.chat

                                      Welcome to the “Awesome ChatGPT Prompts” repository! While this collection was originally created for ChatGPT, these prompts work great with other AI models like Claude, Gemini, Hugging Face Chat, Llama, Mistral, and more. ChatGPT is a web interface created by OpenAI that provides access to their GPT (Generative Pre-trained Transformer) language models. The underlying models, like GPT-4o and GPT-o

                                      • We Spent $20 To Achieve RCE And Accidentally Became The Admins Of .MOBI

                                        Welcome back to another watchTowr Labs blog. Brace yourselves, this is one of our most astounding discoveries. SummaryWhat started out as a bit of fun between colleagues while avoiding the Vegas heat and $20 bottles of water in our Black Hat hotel rooms - has now seemingly become a major incident. We recently performed research that started off "well-intentioned" (or as well-intentioned as we ever

                                          We Spent $20 To Achieve RCE And Accidentally Became The Admins Of .MOBI
                                        • Proto Best Practices

                                          Clients and servers are never updated at exactly the same time - even when you try to update them at the same time. One or the other may get rolled back. Don’t assume that you can make a breaking change and it’ll be okay because the client and server are in sync. Don’t Re-use a Tag NumberNever re-use a tag number. It messes up deserialization. Even if you think no one is using the field, don’t re-

                                          • What's New in Emacs 28.1?

                                            Try Mastering Emacs for free! Are you struggling with the basics? Have you mastered movement and editing yet? When you have read Mastering Emacs you will understand Emacs. It’s that time again: there’s a new major version of Emacs and, with it, a treasure trove of new features and changes. Notable features include the formal inclusion of native compilation, a technique that will greatly speed up y

                                            • Vim9 script for Python Developers · GitHub

                                              vim9script4pythondevelopers.md Vim9 script for Python Developers Vim9 script�Vim script��������������������������������������������������系��� def������義����������Vim script��vim9script�����使����������(vim9script���

                                                Vim9 script for Python Developers · GitHub
                                              • Type Parameters Proposal

                                                Ian Lance Taylor Robert Griesemer August 20, 2021 StatusThis is the design for adding generic programming using type parameters to the Go language. This design has been proposed and accepted as a future language change. We currently expect that this change will be available in the Go 1.18 release in early 2022. AbstractWe suggest extending the Go language to add optional type parameters to type an

                                                • Emacs Tree-sitter custom highlighting, part 1

                                                  A few years ago I blogged about custom tree-sitter-based syntax highlighting in emacs. I started out with highlighting certain keywords in red. I wanted to show the keywords that interrupt control flow: Screenshot showing syntax highlighting of keywords in black or red I highlight regular keywords (while, if) in bold. I highlight control flow interrupting keywords (return, continue) in red. That's

                                                    Emacs Tree-sitter custom highlighting, part 1
                                                  • Best Practices for Writing Step Functions Terraform Projects | Amazon Web Services

                                                    AWS DevOps & Developer Productivity Blog Best Practices for Writing Step Functions Terraform Projects Terraform by HashiCorp is one of the most popular infrastructure-as-code (IaC) platforms. AWS Step Functions is a visual workflow service that helps developers use AWS services to build distributed applications, automate processes, orchestrate microservices, and create data and machine learning (M

                                                      Best Practices for Writing Step Functions Terraform Projects | Amazon Web Services
                                                    • Python behind the scenes #11: how the Python import system works

                                                      If you ask me to name the most misunderstood aspect of Python, I will answer without a second thought: the Python import system. Just remember how many times you used relative imports and got something like ImportError: attempted relative import with no known parent package; or tried to figure out how to structure a project so that all the imports work correctly; or hacked sys.path when you couldn

                                                      • Gregory Szorc's Digital Home | Rust is for Professionals

                                                        A professional programmer delivers value through the authoring and maintaining of software that solves problems. (There are other important ways for professional programmers to deliver value but this post is about programming.) Programmers rely on various tools to author software. Arguably the most important and consequential choice of tool is the programming language. In this post, I will articul

                                                        • October 2022 (version 1.73)

                                                          Join a VS Code Dev Days event near you to learn about AI-assisted development in VS Code. Update 1.73.1: The update addresses these issues. Downloads: Windows: x64 Arm64 | Mac: Universal Intel silicon | Linux: deb rpm tarball Arm snap Welcome to the October 2022 release of Visual Studio Code. There are many updates in this version that we hope you'll like, some of the key highlights include: Searc

                                                            October 2022 (version 1.73)
                                                          • Plan 9 Desktop Guide

                                                            PLAN 9 DESKTOP GUIDE INDEX What is Plan 9? Limitations and Workarounds Connecting to Other Systems VNC RDP SSH 9P Other methods Porting Applications Emulating other Operating Systems Virtualizing other Operating Systems Basics Window Management Copy Pasting Essential Programs Manipulating Text in the Terminal Acme - The Do It All Application Multiple Workspaces Tiling Windows Plumbing System Admin

                                                            • Object-oriented Programming in Python

                                                              You must know the power of Object-oriented programming if you have ever worked with object-oriented languages like Java, C#, and much more. Python also supports object-oriented programming, and we can define a class in Python. Let’s explore more about how to achieve this in Python. In the post Getting Started with Python, I have covered the essentials required before becoming a data scientist. In

                                                                Object-oriented Programming in Python
                                                              • Jailbreaking RabbitOS: Uncovering Secret Logs, and GPL Violations | Blog

                                                                Welcome to my ::'########::'##::::::::'#######:::'######::: :: ##.... ##: ##:::::::'##.... ##:'##... ##:: :: ##:::: ##: ##::::::: ##:::: ##: ##:::..::: :: ########:: ##::::::: ##:::: ##: ##::'####: :: ##.... ##: ##::::::: ##:::: ##: ##::: ##:: :: ##:::: ##: ##::::::: ##:::: ##: ##::: ##:: :: ########:: ########:. #######::. ######::: ::........:::........:::.......::::......:::: CTF writeups, prog

                                                                • April 2021 (version 1.56)

                                                                  Join a VS Code Dev Days event near you to learn about AI-assisted development in VS Code. Update 1.56.1: The update addresses these security issues. Update 1.56.2: The update addresses these issues. Downloads: Windows: x64 Arm64 | Mac: Universal Intel silicon | Linux: deb rpm tarball Arm snap Welcome to the April 2021 release of Visual Studio Code. The VS Code team has been busy this month working

                                                                    April 2021 (version 1.56)
                                                                  • Handling Concurrency Without Locks

                                                                    Concurrency is not very intuitive. You need to train your brain to consider what happens when multiple processes execute a certain code block at the same time. There are several issues I often encounter: Failing to recognize potential concurrency issues: It's not uncommon for both beginner and seasoned developers to completely miss a potential concurrency problem. When this happens, and the concur

                                                                    • cuneicode, and the Future of Text in C

                                                                      Following up from the last post, there is a lot more we need to cover. This was intended to be the post where we talk exclusively about benchmarks and numbers. But, I have unfortunately been perfectly taunted and status-locked, like a monster whose “aggro” was pulled by a tank. The reason, of course, is due to a few folks taking issue with my outright dismissal of the C and C++ APIs (and not showi

                                                                        cuneicode, and the Future of Text in C
                                                                      • The Pitchfork Story

                                                                        A bit more than two years ago, as part of my work in Shopify’s Ruby and Rails Infrastructure team, I released a new Ruby HTTP server called Pitchfork. It has a bit of an unusual design and makes hard tradeoffs, so I’d like to explain the thought process behind these decisions and how I see the future of that project. Unicorn’s Design Is Fine Ever since I joined Shopify over 11 years ago, the main

                                                                        • If Not React, Then What? - Infrequently Noted

                                                                          Over the past decade, my work has centred on partnering with teams to build ambitious products for the web across both desktop and mobile. This has provided a ring-side seat to a sweeping variety of teams, products, and technology stacks across more than 100 engagements. While I'd like to be spending most of this time working through improvements to web APIs, the majority of time spent with partne

                                                                            If Not React, Then What? - Infrequently Noted
                                                                          • Flipping Pages: An analysis of a new Linux vulnerability in nf_tables and hardened exploitation techniques

                                                                            This blogpost is the next instalment of my series of hands-on no-boilerplate vulnerability research blogposts, intended for time-travellers in the future who want to do Linux kernel vulnerability research. Specifically, I hope beginners will learn from my VR workflow and the seasoned researchers will learn from my techniques. In this blogpost, I'm discussing a bug I found in nf_tables in the Linux

                                                                            • Holiday Book Recommendations for Software Engineers, Engineering Managers and Product Managers

                                                                              Books perfect as reading or gifts during the end-of-year break for those working in tech. More than 100 book recommendations. I’ve always found books are an underrated way to learn something new. Great books contain years of hard-earned experiences compressed into what you can read in hours. However, you do need to give hours-long attention to them. This allows books to convey ideas that shorter-f

                                                                                Holiday Book Recommendations for Software Engineers, Engineering Managers and Product Managers
                                                                              • How to Get or Create in PostgreSQL

                                                                                "Get or create" is a very common operation for syncing data in the database, but implementing it correctly may be trickier than you may expect. If you ever had to implement it in a real system with real-life load, you may have overlooked potential race conditions, concurrency issues and even bloat! In this article I explore ways to "get ot create" in PostgresSQL. Illustration by Abstrakt Design Ta

                                                                                  How to Get or Create in PostgreSQL
                                                                                • Python behind the scenes #12: how async/await works in Python

                                                                                  Mark functions as async. Call them with await. All of a sudden, your program becomes asynchronous – it can do useful things while it waits for other things, such as I/O operations, to complete. Code written in the async/await style looks like regular synchronous code but works very differently. To understand how it works, one should be familiar with many non-trivial concepts including concurrency,