<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>potisan</author_name>
  <author_url>https://blog.hatena.ne.jp/potisan/</author_url>
  <blog_title>potisanのプログラミングメモ</blog_title>
  <blog_url>https://potisan-programming-memo.hatenablog.jp/</blog_url>
  <categories>
    <anon>Python 3</anon>
  </categories>
  <description>型指定してコードを書く場合、for構文でひとつひとつ要素を追加するよりも[...]*nや内包表記、ジェネレーター式＋tuple()を使った方が要素の型指定も省略できます。 VSCodeでは次のコードでlist[int]やtuple[int, ...]などが推論されます。 #list1は型指定しなくてもlist[int] list1 = [0]*5 #tuple1は型指定しなくてもtuple[Literal[0], ...] tuple1 = (0,)*5 #list2は型指定しなくてもlist[int] list2 = [x for x in range(5) if x % 2 == 0] #…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpotisan-programming-memo.hatenablog.jp%2Fentry%2F2022%2F09%2F20%2F174512&quot; title=&quot;Python3 リストやタプルの作成はfor構文を[...]*n or 内包表記に変えると要素の型指定が省略できる - potisanのプログラミングメモ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2022-09-20 17:45:12</published>
  <title>Python3 リストやタプルの作成はfor構文を[...]*n or 内包表記に変えると要素の型指定が省略できる</title>
  <type>rich</type>
  <url>https://potisan-programming-memo.hatenablog.jp/entry/2022/09/20/174512</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
