タグ

関連タグで絞り込む (0)

  • 関連タグはありません

タグの絞り込みを解除

pythonとPythonとpython3に関するBigFatCatのブックマーク (9)

  • Python 2.7.x と 3.x の決定的な違いを例とともに | POSTD

    Pythonを始めたばかりのユーザーの多くが、どちらのバージョンを使えばいいのか迷っています。私の答えは、「気に入ったチュートリアルに書かれているバージョンにしましょう。そして、あとで違いを調べてください」という言葉につきます。 それでは、新しいプロジェクトを始めるときにはどちらを選べばいいのでしょうか? 使おうとしているライブラリを全てサポートしているなら、2.7.x系と3.x系のどちらを使ってもよいでしょう。そうはいっても、この2つのメジャーバージョンについて大きな違いを見ておくのは良いでしょう。どちらかのみでコードを書いたり、プロジェクトに使おうとしている時によくある落とし穴を避けられるからです。 __future__ モジュール Python 3.x で導入されていて Python 2 で使えないキーワードについては、 __furute__ モジュールをインポートすることで Pyt

    Python 2.7.x と 3.x の決定的な違いを例とともに | POSTD
    BigFatCat
    BigFatCat 2016/11/21
    __future__の説明が詳しい。
  • Python のバージョン毎の違いとその吸収方法について - CUBE SUGAR CONTAINER

    この記事の目指すところ 現在 Python はバージョン 2.x 系と 3.x 系という、一部に互換性のないふたつのメジャーバージョンが併用されている。 その上で、この記事にはふたつの目的がある。 ひとつ目は、2.x 系と 3.x 系の違いについてまとめること。 現状、それぞれのバージョン毎の違いはまとまっているところが少ない。 自分用に、このページだけ見ればひと通り分かる!っていうものがほしかった。 ふたつ目は、2.x 系と 3.x 系の違いを吸収するソースコードの書き方についてまとめること。 こちらも Web 上にナレッジがあまりまとまっていない。 これについては今 python-future というパッケージがアツい。 尚、サポートするバージョンは以下の通り。 2.x 系: 2.6 と 2.7 3.x 系: 3.3 と 3.4 題に入る前に、最近の Python 事情についてまとめ

    Python のバージョン毎の違いとその吸収方法について - CUBE SUGAR CONTAINER
  • Pythonを書き始める前に見るべきTips - Qiita

    Pythonを使ってこの方さまざまな点につまずいたが、ここではそんなトラップを回避して快適なPython Lifeを送っていただくべく、書き始める前に知っておけばよかったというTipsをまとめておく。 Python2系と3系について Pythonには2系と3系があり、3系では後方互換性に影響のある変更が入れられている。つまり、Python3のコードはPython2では動かないことがある(逆もしかり)。 Python3ではPython2における様々な点が改善されており、今から使うなら最新版のPython3で行うのが基だ(下記でも、Python3で改善されるものは明記するようにした)。何より、Python2は2020年1月1日をもってサポートが終了した。よって今からPython2を使う理由はない。未だにPython2を使う者は、小学生にもディスられる。 しかし、世の中にはまだPython3に

    Pythonを書き始める前に見るべきTips - Qiita
    BigFatCat
    BigFatCat 2015/12/08
    singledispatch
  • Writing Forwards Compatible Python Code

    written on January 22, 2011 For web applications the safest bet currently is to stick with Python 2.x even for new projects. For the simple reason that right now we don’t have enough supporting libraries for Python 3 yet and porting some of them over is a huge step. But with all the people telling one that it’s hard and painful to upgrade to Python 3, how does one make this upgrade easier? For hig

    Writing Forwards Compatible Python Code
    BigFatCat
    BigFatCat 2012/04/01
    前方互換を持ったコードを書く方法。つまり、Python3互換のPython2コードを書く方法。
  • 登場! Python 3.0 - 2系との違いを比較

    3.0はこれまでのリリースの中で唯一意図的に後方互換性が失われたバージョンだ。移行には従来よりも手間が必要になる。推奨されている移行手順は次のとおり。 従来のPythonソースコードをPython 2.6へ移植する。この段階ではほとんど手間はかからない Python 2.6で -3 オプションを指定してワーニングを出力させ、ワーニングがなくなるように編集を実施する Python 3.0の2to3ソースコードトランスレータ(2to3-3.0)を使って自動変換を実施する 移行用のブランチとして用意されている2.6系に移行してから、2.6でワーニングがでないように調整し、最後にPython 3.0で提供されているトランスレートスクリプト2to3-3.0(1)を使って変換だ。2to3-3.0(1)は指定されたPythonソースコードを3.0対応に変換するための差分を出力してくれるので、これを参考に

    BigFatCat
    BigFatCat 2012/04/01
    Python2からPython3への移行方法の具体例が挙げられている。
  • SimplePrograms - Python Wiki

    The examples below will increase in number of lines of code and difficulty: 1 line: Output print ('Hello, world!') 2 lines: Input, assignment name = input('What is your name?\n') print ('Hi, %s.' % name) 3 lines: For loop, built-in enumerate function, new style formatting friends = ['john', 'pat', 'gary', 'michael'] for i, name in enumerate(friends): print ("iteration {iteration} is {name}".format

    BigFatCat
    BigFatCat 2012/04/01
    Python3.0からの機能であるformatを使用している例がある。3番目の例はstr.format使用しているのにprintが2系の書き方になっている…バグ?。str.formatについて: http://news.mynavi.jp/articles/2009/01/01/python3/003.html
  • Python2orPython3 - Python Wiki

    Should I use Python 2 or Python 3 for my development activity? Python 3 is strongly recommended for any new development. As of January 2020, Python 2 has reached End Of Life status, meaning it will receive no further updates or bugfixes, including for security issues. Many frameworks and other add on projects are following a similar policy. As such, we can only recommend learning and teaching Pyth

    BigFatCat
    BigFatCat 2012/04/01
    Python2とPython3どちらを使えばよいか?メジャーなパッケージでもまだPython3に対応していないものが多数あるのがネック。キレイに書かれたPython2コードはPython3コードに変換するのも楽なはずとのこと。
  • getpython3.com

    Introduction Welcome to getpython3.com - this site aims to be a resource for Python 3 for developers. This includes guides, videos, tutorials and other resources to help you and your team achieve a successful Python 3 port of your application, library, framework or tool. It also covers Python Software Foundation financial grants for porting to Python 3. What is Python 3? Short summary Although mos

    BigFatCat
    BigFatCat 2012/04/01
    python3への移行補助サイト。"On Python 3 Yet?"では各モジュールのpython3対応状況を確認できる(依存しているPython2モジュールを確認できる)。
  • Dive Into Python 3

    Dive Into Python 3 covers Python 3 and its differences from Python 2. Compared to Dive Into Python, it’s about 20% revised and 80% new material. The book is now complete, but feedback is always welcome. Table of Contents (expand) Also available on dead trees! What’s New in “Dive Into Python 3” Installing Python Your First Python Program Native Datatypes Comprehensions Strings Regular Expressions C

    BigFatCat
    BigFatCat 2012/04/01
    python2とpython3の違いを学ぶ。
  • 1