タグ

Pythonとpythonに関するrawwellのブックマーク (440)

  • Alex Clemesha | Full-stack software engineer.

    Full-stack software engineer based in San Diego, California. I input ideas, mix them with code and expertise, and output dynamic modern applications for mobile and the web. Alex Clemesha has extensive experience with full-stack web & mobile software development, in topics such as mathematics software, science based platforms, location-based mobile applications, and interactive educational web game

    rawwell
    rawwell 2009/07/10
    "You have a Django project that you want to do automated deployment to both your staging and production environment (Fabric). The project has several dependencies the need to be exactly met at deploy time (pip), and the remote production environment disallows global site-package installation, so you
  • Deferred Reference — Twisted 21.2.0 documentation

    Deferred Reference¶ This document is a guide to the behaviour of the twisted.internet.defer.Deferred object, and to various ways you can use them when they are returned by functions. This document assumes that you are familiar with the basic principle that the Twisted framework is structured around: asynchronous, callback-based programming, where instead of having blocking code in your program or

    rawwell
    rawwell 2009/07/10
    "After reading this document, the reader should expect to be able to deal with most simple APIs in Twisted and Twisted-using code that return Deferreds. * what sorts of things you can do when you get a Deferred from a function call; and * how you can write your code to robustly handle errors
  • Pythonの文字列連結(join)にまつわる議論 まとめと考察(2) - Mixnuts@BetaNews

    だいぶ時間が開いてしまったけれど、Pythonの文字列joinの不思議について、さらに突っ込んだ解釈を試みてみましょう。 あくまでBetaNews的な解釈だけれど、 ", ".join([...])というのは、元々は次の形をしていると考えるべきなんじゃないか、っていうこと。 str(", ").join([...])この解釈に基づいて、セパレータを省略すると、次の書き方が初期に存在したのではないか、と推測できる。 "".join([...]) この解釈が、BetaNews的な理解の第1段階なのだ。ここでは、strクラスを例に出したが、次のように定義されたクラスを導出してみよう。 class Joiner(object): @classmethod def join(classObj, iterativeSequence): tmpInstance = classObj() #[Ommit]

    Pythonの文字列連結(join)にまつわる議論 まとめと考察(2) - Mixnuts@BetaNews
    rawwell
    rawwell 2009/07/07
    "strクラスのセパレータを使ったjoinメソッドと、まったく使い方のお作法が違わないにも関わらず、得られるインスタンスがきちんとminidomによるXML文書になっていることが分かります。Pythonにおけるjoinメソッドは、「シー
  • Python vs C++ vs C# @ 7bit

    前回のエントリでは多数のファイルに対して正規表現をかける処理をC++Pythonで書いき、Pythonのほうが圧倒的に速いという結果になりました。 Pythonは書き方が収斂するので大してチューニングなどはしませんが、 C++では自由度が高いため書き殴ったコードを数万回繰り返すのでは、パフォーマンスを大きく落としそうです。 今回はC++の方の実装を少し修正し、またC#版も書いてみました。 結果は以下のようになりました。(単位は秒) 実験設定生grepPython + reC++ + boost.regex + ICUC# + RegexA-18.9729.46813.25028.6875A-216.86616.40718.82863.796875A-321.85715.07827.76575.0625B-11.1511.5624.5001.796875B-23.2923.3285.812

    rawwell
    rawwell 2009/06/27
    "よく見たら生のgrepよりもPythonの方が速い…"
  • C++がPythonより重い… @ 7bit

    GUI grepツールの調査過程は一応一段落し、当初のもくろみ通り製作に入ろうとしています。 今は特に苦もなく使えそうなPython, C++, C#のどれを用いるか検討中。 大量のファイルへのアクセスと正規表現のマッチは割と重い処理になりそうなので、実際にコードを書いて比較しています。 まず生grep。find | xargs grep '...'。直接Cで書かれていることを考えると、最速の基準として考えて良さそうです。日英対訳文対応付けデータ [1]をデータセットとして実験していますが、1.1秒くらいで2000ファイル近くのスキャンが終わる。 次に、書きやすそうなところでPython (re)でやってみました。所詮LLだし、結果には全然期待していません。 ところがところが、何故かこれが滅茶苦茶速い。 特に最適化したコードの書き方でもないんですが、1.6秒くらいで終わる。殆どC同等の速さ

    rawwell
    rawwell 2009/06/27
    "正規表現はboost.regex、Unicodeのエンコーディング変換はICU。"
  • Intermediate and Advanced Software Carpentry in Python

    Intermediate and Advanced Software Carpentry in Python Author: Welcome! You have stumbled upon the class handouts for a course I taught at Lawrence Livermore National Lab, June 12-June 14, 2007. These notes are intended to accompany my lecture, which was a demonstration of a variety of "intermediate" Python features and packages. Because the demonstration was interactive, these notes are not compl

    rawwell
    rawwell 2009/06/25
    "class handouts for a course I taught at Lawrence Livermore National Lab, June 12-June 14, 2007."
  • Pydra Python Clustering

    About Pydra Pydra is a new project. We are working towards our first public release. What is Pydra? Pydra is a parallel computing framework for python. Pydra aims to provide an easy to use framework for writing and running parallelized programs for developers, and an easy to manage cluster for the administrators. some of the main features that are implemented or will be implemented in 1.0: Easily

    rawwell
    rawwell 2009/06/24
    "# Map-Reduce support - Map-Reduce is a concept introduced by google. Pydra currently supports most of the Map-Reduce concept. The only missing piece is parallelizing the map function."
  • Concurrency and Distributed Computing with Python Today (#49) - PyCon 2009 - Chicago - A Conference for the Python Community

    rawwell
    rawwell 2009/06/24
    "This talk will cover the recent changes to Python 2.6, including a brief introduction to the threading module and multiprocessing inclusion and changes but will primarily focus on the concurrent and distributed ecosystem for Python today."
  • Introduction to Multiprocessing in Python (#6) - PyCon 2009 - Chicago - A Conference for the Python Community

    rawwell
    rawwell 2009/06/24
    "This talk will cover the new multiprocessing package included with Python 2.6 (and 3.0) focusing on design, benefits, practical usage, application construction, gotchas and how to use it to build multi-core and distributed applications."
  • Genetic Programming meets Python | Terra Incognita

    I’m proud to announce that the new versions of Pyevolve will have Genetic Programming support; after some time fighting with these evil syntax trees, I think I have a very easy and flexible implementation of GP in Python. I was tired to see people giving up and trying to learn how to implement a simple GP using the hermetic libraries for C/C++ and Java (unfortunatelly I’m a Java web developer hehe

    rawwell
    rawwell 2009/06/23
    "I’m proud to announce that the new versions of Pyevolve will have Genetic Programming support"
  • Pythonでtwitterの最新20件を表示してみる - QuestingVisionaryLunacy

    twitterAPI制限でいろいろうるさいので、APIを使わずにhtmlを解析するってのが何やら流行ってる(?)っぽかったんで、自分もPythonでそれっぽいの書いてみた。 クッキーを利用してログインしようとか考えてたけど、いろいろ調べて試してるうちにmechanizeっていうウェブサイトのアクセスを自動化してくれるモジュールが便利そうだったんで使ってみた。 あと、htmlの解析にはBeautifulSoupってのが良さげな感じ。 ちなみに俺の開発環境のUbuntu8.04では、mechanizeもBeautifulSoupもパッケージであったんで、aptなりsynapticなりで入れるだけ。他の環境の方はもっと詳しいところで調べてください。 # -*- coding: utf-8 -*- import sys import mechanize from BeautifulSoup im

    rawwell
    rawwell 2009/06/23
    "twitterがAPI制限でいろいろうるさいので、APIを使わずにhtmlを解析するってのが何やら流行ってる(?)っぽかったんで、自分もPythonでそれっぽいの書いてみた。 クッキーを利用してログインしようとか考えてたけど、いろいろ
  • ECサイト構築、オウンドメディア作成で儲ける。大阪、神戸、姫路のSEO会社!

    もしもSEO対策をするならどのような方法でしますか。 記事の内容によってはSEO対策になりますが、どのように書けばいいのでしょうか。 まずは検索で上位に表示されたいキーワードを一つ決めます。このキーワードは適度に多くちりばめておく必要があります。あまり多すぎるとスパム行為とされてしまいますので順位を下げられてしまう可能性がありますのでほどほどにしておきましょう。他にもリンクを設置する必要もあります。 しかしこれも被リンク先のサイトが信頼のできないサイトですと検索順位が上がりませんので、信頼のできるサイトとリンクする必要があるのです。信頼のできる被リンク先は自分で作るのも方法です。 被リンク先サイトを作るのは面倒な作業ですが、これもかなり対策をする上ではいい方法なのです。 また記事を書くときには太い文字を入れるのも一つの方法です。キーワードを強調するために使われる表現ですが、実は対策にもなる

    ECサイト構築、オウンドメディア作成で儲ける。大阪、神戸、姫路のSEO会社!
    rawwell
    rawwell 2009/06/23
    "このサイトでは、プログラミング言語PythonとPythonのゲーム用ライブラリPygameを用いてゲーム制作の過程やテクニックをまとめています。"
  • PythonでTwitter Bot - QVLの雑記

    PythonTwitterApiの叩き方が下のサイトでわかりやすく書かれていたので 簡単なBotを作ってみる。 python-twitterまとめ 〜導入まで - テックノート@ama-ch simplejsonとpython-twitterが最低限必要なもの。 説明が面倒なので導入はぜひ上のリンク先を参照してほしい。 今回はさらにBeautifulSoupを使ってHTMLを解析し、その情報を流してみる。 BeautifulSoupは、自分の環境(Ubuntu)ならapt-getで手に入る。 他の環境はちょっと解らないんでググッてください。 以下、ソースとか実装方法とか。 #!/usr/bin/python # -*- coding:utf-8 -*- import twitter import urllib2 from BeautifulSoup import BeautifulS

  • 面白そうなtwitter botをPythonでやってみたよ。 - Humming Via Kitchen

    まめこ さんの「 ロックンロールニュースの今日のつぶやきをポストするtwitter bot 」が面白そうだったので、 Pythonで100%パクりもんを作ってみたよ。 やりたいってホザいてから、だいぶ時間経っちゃったけども気にしない。 まずはルールをおさらいから。 今日のつぶやき/ロックンロールニュース を取ってくる。 そこから div.txt なテキストだけ取りだす。 twitter に放り込む。 とりあえずは動くところまでやってみる。 まずは一通り使うものをインストール。って言っても easy_install 経由なんだけども。 BeautifulSoup とか python-twitter とか。 $ sudo easy_install -UZ BeautifulSoup $ sudo easy_install -UZ python-twitter で、出来たのがコチラ。 #!/us

  • Ruby,Perl,Pythonのメモ〜文字コードと文字列長〜 - numozoの日記

    メモ: ・日語の取り扱いのめも その2(文字列長、バイト長について) ・バージョンはruby 1.9.1p129,perl v5.10.0,Python 3.0.1 ・バージョンが古いと動かない ・ついでに 404 Blog Not Found:perl, python & ruby - chr() vs. Unicode と 404 Blog Not Found:perl, python & ruby - ord() vs. Unicode の情報は古いので、今の書き方を書いとく ruby perl python 文字列長 文字コード指定が正しいなら文字数 utfフラグ付きなら文字数 code unit数(文字数でない)*1 configureで--with-wide-unicodeすれば文字数 ※1ただし、コンパイル時のオプションで変えられるらしい 参照:DSAS開発者の部屋:Pyt

    Ruby,Perl,Pythonのメモ〜文字コードと文字列長〜 - numozoの日記
    rawwell
    rawwell 2009/06/22
    "ruby perl python 文字列長 文字コード指定が正しいなら文字数 utfフラグ付きなら文字数 code unit数(文字数でない)*1 configureで--with-wide-unicodeすれば文字数"
  • Ruby,Perl,Pythonのメモ〜ソースの文字コード指定〜 - numozoの日記

    メモ: ・日語の取り扱いのめも (ソースコードについて) ・バージョンはruby 1.9.1p129,perl v5.10.0,Python 3.0.1 ・バージョンが古いと動かない ruby perl python ソースコード コード冒頭に文字コード指定 基的にUTF8で書く コード冒頭に文字コード指定 文字列 オブジェクト毎に文字コード定義 バイナリとUTF8フラグ付き文字列 Unicode文字列のみ 参考 bitclust M17N の設計と実装 Encode入門 perl - use encoding; #は黒歴史 @IT記事 ファイル:utf-8、コンソール:utf-8 Ruby #!/usr/bin/ruby1.9 # coding: utf-8 str = "Rubyで日語表示。" puts str Perl #!/usr/bin/perl use strict; u

    Ruby,Perl,Pythonのメモ〜ソースの文字コード指定〜 - numozoの日記
    rawwell
    rawwell 2009/06/22
    "ruby perl python ソースコード コード冒頭に文字コード指定 基本的にUTF8で書く コード冒頭に文字コード指定 文字列 オブジェクト毎に文字コード定義 バイナリとUTF8フラグ付き文字列 Unicode文字列のみ"
  • Twitter-APIを使わずにTL取得 in Python - kyeeva blog!

    TwitterAPIでTL(タイムライン)を取得するとき、回数制限が設けられています。 しかしuser_timelineRSSで取得する際には、この制限がありません。 なので、この独立したいくつかのuser_timelineを組み合わせ、TLを再構築させてみたいと思います。 準備: Python処理系(俺は2.6系) feedparser([ubuntu] slicehostでpython-mecabとかの インストール - shohu33's diaryを参考にしてインストール) #!/usr/bin/python # -*- encoding: utf-8 -*- # coding: utf-8 import sys import urllib import feedparser def get_rss_url(id): url = "http://twitter.com/%s"

    Twitter-APIを使わずにTL取得 in Python - kyeeva blog!
    rawwell
    rawwell 2009/06/22
    "TwitterのAPIでTL(タイムライン)を取得するとき、回数制限が設けられています。 しかしuser_timelineをRSSで取得する際には、この制限がありません。 なので、この独立したいくつかのuser_timelineを組み合わせ、TLを再構築させ
  • Getting started with Python - Couchdb Wiki

    Getting started with Python and the CouchDB API. Library couchdbkit http://couchdbkit.org/ Start using Couchdbkit by reading the Getting Started tutorial. For django use the django extension of couchdbkit. Other extension exists for formalchemy. couchdb-python The code for the Python library can be obtained from: http://code.google.com/p/couchdb-python From a terminal window: $ wget http://peak.te

    rawwell
    rawwell 2009/06/20
    "couchdbkit * [WWW] http://couchdbkit.org/ Start using Couchdbkit by reading the [WWW] Getting Started tutorial. couchdb-python The code for the Python library can be obtained from: * [WWW] http://code.google.com/p/couchdb-python"
  • Using Simpycity in Pylons

    rawwell
    rawwell 2009/06/19
    "Simpycity's core philosophy is that the DBA is going to perform the vast majority of the schema design without the aid of a conventional ORM."
  • Simpycity - Trac

    rawwell
    rawwell 2009/06/19
    "Simpycity is a simple mapping system for PostgreSQL stored procedures and queries, enabling easy usage of PG procedures using standard Python call semantics."