Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

話題のAIアシストブラウザを試す その4:シンボル機能で公式ドキュメントを参照したヒントをもらう

怖いモホークも絶賛する機能

実際のところ

チャット枠で"@"

File

関数の選択

試しにコメントを生成させてみる

こんな感じ

/**
 * @brief Sets the color of the LED
 * 
 * This function sets the color of the single NeoPixel LED connected to the M5Stamp S3.
 * It updates the LED array with the specified color and calls FastLED.show() to display the change.
 * 
 * @param color The CRGB color to set the LED to
 */

公式リファも参照できる

チャット側でも、この構文が使えます

@Python 3
How to implement "delay" role in scripts?

There are a few ways to implement delays in Python scripts:

1. Using the `time.sleep()` function:

```python
import time

print("Hello")
time.sleep(2)  # Delay for 2 seconds
print("World")
```

2. Using `asyncio.sleep()` for asynchronous delays:

```python
import asyncio

async def main():
    print("Hello")
    await asyncio.sleep(2)  # Asynchronous delay for 2 seconds
    print("World")

asyncio.run(main())
```

3. Using a simple loop (less precise but doesn't require imports):

```python
import time

print("Hello")
start_time = time.time()
while time.time() - start_time < 2:
    pass  # Do nothing for 2 seconds
print("World")
```

4. For GUI applications, many frameworks have their own delay functions, like `after()` in Tkinter:

```python
import tkinter as tk

root = tk.Tk()
root.after(2000, lambda: print("World"))  # Print "World" after 2000 ms
print("Hello")
root.mainloop()
```

The `time.sleep()` method is the most straightforward and commonly used for simple scripts([1](https://docs.python.org/3/library/time.html#time.sleep)). However, for more complex applications, especially those involving asynchronous programming, `asyncio.sleep()` might be more appropriate([2](https://docs.python.org/3/library/asyncio-task.html#asyncio.sleep)).

独自フレームワークでも使える??

独自のドキュメント(たとえば自社の独自フレームワーク)みたいなのもイケる……らしい?

参考もと

www.cursor.com