Hatena::Groupfukuoka-py

taketin.py RSSフィード

2012-01-04

初めてのPython 20章 パッケージインポート 21章 モジュールに関連する高度なテクニック

23:54 | 初めてのPython 20章 パッケージインポート 21章 モジュールに関連する高度なテクニック - taketin.py を含むブックマーク はてなブックマーク - 初めてのPython 20章 パッケージインポート 21章 モジュールに関連する高度なテクニック - taketin.py

20章 パッケージインポート

ディレクトリパスを指定して行うインポートの事を「パッケージインポート」と呼ぶ。

Python のコードを納めたディレクトリの事を「パッケージ」と呼ぶ。


パッケージインポートとは、ディレクトリ名前空間にするものとも言える。

import dir1.dir2.mod

from dir1.gir2.mod import x

上記書式だと、モジュールサーチパスが /dir0 に通っていたとして、

/dir0/dir1/dir2/mod.py

を見る。

※reload もディレクトリ単位でできる



21章 モジュールに関連する高度なテクニック

  • データの隠蔽
    • モジュール内データのカプセル化はできない
    • from * ステートメントで読み込む場合のみ、以下のルールで特定の変数をコピー対象から外す事はできる
      • __all__ 属性に、コピー対象の変数名を列挙する。この宣言をされた変数のみ from * ステートメントでコピーされる ex) __all__ = ["foo", "bar", "baz"] 等
      • 変数名の頭にアンダースコアを付ける ex) _hoge 等。__all__ 属性が設定されていない場合、このアンダースコアが頭に無い変数が全てコピーされる
    • import ステートメントを利用した場合このルールは適用されない

  • 拡張機能を有効にする
    • 次世代バージョンで組み込まれる新機能は、まずは「拡張機能」として扱われる
    • from __future__ import 機能名 で、拡張機能を利用できる


import longmodulename as name

# 以下のコードと同じ
import longmodulename
name = longmodulename
del longmodulename

# from ステートメントも同様
from module import longname as name

  • 相対インポートの構文
    • Python2.5 では . を使う事で、fromステートメントが属するパッケージのモジュールインポートサーチパス(sys.path)内のその他の場所にある同じ名前のモジュールよりも優先になる
    • Python2.6までは . を使わない通常のインポートでは、デフォルトで「ステートメントが属するパッケージ > その他のパッケージ」の順に相対インポートが行われる。
    • Python2.7 では ではデフォルトで絶対インポートとなる(あいまいさを避ける為)。なので、2.6 以下のバージョンを利用する場合は、2.7以降のバージョンに合わせ、from __future__ absolute_import 宣言をしておくのが望ましい



  • モジュールについての注意事項
    • トップレベルのコードはステートメントの順序に注意
      • トップレベルコードは前方参照ができないので、defステートメントは全て上に集めて記述し、その後にロジックを書くのが良い
    • import, from に指定するモジュール名は「変数名」である
    • from によって作られる変数と元の変数の間につながりは無い(コピーとなる為)
    • from * を使うと変数の意味がわかりにくくなる
    • from によってコピーされた変数はリロードの影響を受けない
    • リロードは内部でimportしているモジュールまで自動で行われない
    • 再帰インポートに注意(どうしても再帰インポートが必要な場合は、fromステートメントではなく importステートメントを使用する。モジュールのトップレベルではなく関数内、またはモジュールの最後であれば fromステートメントを使用しても良い)

AlexAlex2012/08/21 13:46It's posts like this that make surfing so much plesarue

arfvmjporarfvmjpor2012/08/21 18:425xfI0p <a href="http://ehnxlojxktne.com/">ehnxlojxktne</a>

utszqjjfutszqjjf2012/08/25 01:44iWUrRB , [url=http://oofsuqwxnvfx.com/]oofsuqwxnvfx[/url], [link=http://tlpijuivkaae.com/]tlpijuivkaae[/link], http://mkkqjrwykltz.com/

StevenreataStevenreata2018/03/07 08:02cialis pills <a href=http://kjcialishuef.us/#1735>cialis generic</a> cialis dosage <a href=http://kjcialishuef.us/#6111>cialis generic</a>

TerryAnathTerryAnath2018/03/10 21:39 <a href=http://viagrawithoutdoctorprescr.today/#7719>viagra without a doctor prescription</a> <a href=http://viagrawithoutdoctorprescr.today/#8929>viagra without prescription</a>

MichaelDugMichaelDug2018/03/11 05:44generic Viagra <a href=http://viagra-generics.us/#3928>viagra generic</a> Viagra generic <a href=http://viagra-generics.us/#8>generic viagra</a>

TerryAnathTerryAnath2018/03/11 22:44 <a href=http://viagrawithoutdoctorprescr.today/#8922>viagra without prescription</a> <a href=http://viagrawithoutdoctorprescr.today/#6082>viagra without a doctor prescription</a>

TerryAnathTerryAnath2018/03/13 03:30 <a href=http://viagrawithoutdoctorprescr.today/#899>viagra without a doctor prescription</a> <a href=http://viagrawithoutdoctorprescr.today/#6817>viagra without prescription</a>

TerryAnathTerryAnath2018/03/14 10:45 <a href=http://viagrawithoutdoctorprescr.today/#3265>viagra without prescription</a> <a href=http://viagrawithoutdoctorprescr.today/#1607>viagra without prescription</a>

MichaelDugMichaelDug2018/03/15 12:33Viagra generic <a href=http://viagra-generics.us/#6952>generic viagra</a> generic Viagra pills <a href=http://viagra-generics.us/#6117>generic viagra</a>

TerryAnathTerryAnath2018/03/15 21:52 <a href=http://viagrawithoutdoctorprescr.today/#3627>viagra without prescription</a> <a href=http://viagrawithoutdoctorprescr.today/#2303>viagra without prescription</a>

ThomasaffewThomasaffew2018/03/17 07:17generic Viagra pills <a href=http://viagra-generics.us/#9394>viagra generic</a> generic for Viagra <a href=http://viagra-generics.us/#7216>buy generic viagra</a>

RobertgemRobertgem2018/03/17 10:11viagra without doctor <a href=http://viagrawithoutdoctorprescr.today/#5711>viagra on line no prec</a> viagra without a doctor’s prescription <a href=http://viagrawithoutdoctorprescr.today/#6173>viagra without prescription</a>

ThomasaffewThomasaffew2018/03/18 11:06generic Viagra 100mg <a href=http://viagra-generics.us/#4859>viagra generic</a> Viagra generic 100mg <a href=http://viagra-generics.us/#1541>buy generic viagra</a>

RobertgemRobertgem2018/03/19 08:34viagra without a doctor prescription <a href=http://viagrawithoutdoctorprescr.today/#3994>viagra without prescription</a> viagra without a doctor's prescription <a href=http://viagrawithoutdoctorprescr.today/#5069>viagra without a doctor prescription</a>

DDavidUsageDDavidUsage2018/04/01 06:51<a href=http://1234520mg.com>tadalafil 20 mg</a>

MarkdrackMarkdrack2018/04/17 13:35can erectile dysfunction be permanent
<a href=http://edpils-gg.com/>erectile enhancement pills</a>
erectile hyperfunction
<a href="http://edpils-gg.com/">top erectile dysfunction pills</a>

erectile pillserectile pills2018/04/17 20:21erectile triggers
do erectile pumps work
erectile help

LdrgezorLdrgezor2018/04/18 00:40erectile pills china <a href=http://dc-shuttle.com/>new drugs for ed</a>
erectile hopeless <a href="http://dc-shuttle.com/">erectile dysfunction medications</a> http://dc-shuttle.com/

EarnestHaxEarnestHax2018/04/18 05:07erectile disorder dsm 5
<a href="http://erectiledysfunctionlq.com/">top erectile dysfunction pills</a>
erectile malfunction
<a href="http://erectiledysfunctionlq.com/">buy erectile dysfunction pills online</a>

eddrugsgeneric.comeddrugsgeneric.com2018/04/18 17:58erectile disorder symptoms
<a href=http://eddrugsgeneric.com/#>new ed drugs</a>
erectile dysfunction icd
<a href="http://eddrugsgeneric.com/#">erectile dysfunction treatment</a>

KoldrsnKoldrsn2018/04/18 20:06erectile pump implant
<a href=http://edpilsmystery.com/>erectile enhancement pills</a>
erectile com
<a href="http://edpilsmystery.com/">ed drugs list</a>

MarkdrackMarkdrack2018/04/19 04:44strategia forex trading dubai job
<a href="http://best-platform-options-binary-try.pw/optionshouse-trading-platform-5223.php#">hours of option trading at christmas eve perth</a>
forex tester 2 registration key download
<a href=http://platform-best-options-try-binary.pw/day-trading-simulator-india-4462.php>understanding binary options</a>

MarkdrackMarkdrack2018/04/19 18:23levitra result
<a href="http://levitra-gg.com">generic levitra</a>
levitra brand 10mg
<a href=http://mylevitraok.com#levitra+20+mg+bayer+prezzo>levitra 20 mg</a>

MarkdrackMarkdrack2018/04/20 02:30barra de cereal levitra 20mg
<a href="http://myvardenafilok.com">levitra 20mg</a>
site levitra moveis campo
<a href=http://mylevitraok.com#levitra+20mg>levitra 20 mg</a>

MarkdrackMarkdrack2018/04/20 06:17availability of levitra in denmark
<a href="http://myvardenafilok.com">levitra 20 mg bayer prezzo</a>
levitra auf kassenrezept
<a href=http://levitra-gg.com#vardenafil+20mg>levitra 20mg</a>

JugezorJugezor2018/04/20 08:20cialis official siteBuy Cheap Cialiscialis vs viagracialis generic
<a href="http://jvrimages.com/">buy cialis 20 mg</a>
interactions for cialisdiscount cialis
http://jvrimages.com/#callous

MarkdrackMarkdrack2018/04/20 10:04levitra dosage - 40 mg
<a href="http://myvardenafilok.com">levitra 10 mg prezzo</a>
levitra 10 mg tab
<a href=http://myvardenafilok.com#levitra+rezeptfrei+deutschland>buy levitra</a>

MarkdrackMarkdrack2018/04/20 13:49schmelztabletten levitra for sale
<a href="http://myvardenafilok.com">levitra 20mg</a>
marie silvia levitra
<a href=http://myvardenafilok.com#levitra+generic>levitra 20mg</a>

JugezorJugezor2018/04/20 14:09cialis onlinecialis without a doctor's prescriptioncialis canadatadalafil
<a href="http://jvrimages.com/">buy cialis 20 mg</a>
interactions for cialistadalafil
http://jvrimages.com/#cialis+vs+viagra

MarkdrackMarkdrack2018/04/20 17:47levitra nfl play of the year
<a href="http://levitra-gg.com">generic levitra</a>
miconazole 20mg generic levitra
<a href=http://levitra-gg.com#generic+levitra>levitra generic</a>

MarkdrackMarkdrack2018/04/20 21:42generic levitra super force
<a href="http://mylevitraok.com">levitra coupon</a>
levitra 10 mg filmtabletten beipackzettel sinupret
<a href=http://mylevitraok.com#vardenafil+20mg>vardenafil 20mg</a>

generic cialisgeneric cialis2018/04/20 22:43When I initially commented I clicked the -Notify me when new comments are added- checkbox and now each time a remark is added I get 4 emails with the identical comment. Is there any manner you can remove me from that service? Thanks!

MarkdrackMarkdrack2018/04/21 01:40levitra bloeddrukmeter bol
<a href="http://myvardenafilok.com">generic levitra</a>
sacerdote levitra y samaritano do asfalto
<a href=http://myvardenafilok.com#levitra+20+mg+bayer+prezzo>generic levitra</a>

YterezorYterezor2018/04/21 02:47Buy Cheap Cialis usaBuy Cheap Cialis in uscialis for salecialis online <a href="http://foreigncircles.com/#buy-Trazodone">http://foreigncircles.com/#Trazodone</a> what is cialiscialis online <a href=http://foreigncircles.com/>Trazodone price</a> buy cialischeap cialis http://foreigncircles.com/#Trazodone-50-mg

MarkdrackMarkdrack2018/04/21 04:16cheap levitra online
<a href="http://mylevitraok.com">levitra coupon</a>
levitra side effects back pain
<a href=http://mylevitraok.com#levitra+coupon>levitra 20mg</a>

YterezorYterezor2018/04/21 07:06generic for cialiscialis couponscheap cialisside effects for cialis <a href="http://foreigncircles.com/#buy-Trazodone">http://foreigncircles.com/#Trazodone-50-mg</a> cialis free trialcialis 20 mg best price <a href=http://foreigncircles.com/#Trazodone>buy Trazodone</a> cialis from canadacialis without a doctor's prescription http://foreigncircles.com/#buy-Trazodone

MarkdrackMarkdrack2018/04/21 07:59levitra 20 mg directions from mapquest
<a href="http://levitra-gg.com">levitra rezeptfrei deutschland</a>
svelato il trucco del fachiro che levitra a torino
<a href=http://mylevitraok.com#levitra+rezeptfrei+deutschland>levitra 20 mg bayer prezzo</a>

MarkdrackMarkdrack2018/04/21 11:17levitra orodispersibile ricetta crema
<a href="http://levitra-gg.com">levitra rezeptfrei deutschland</a>
levitra 10 mg prezzo warren
<a href=http://myvardenafilok.com#levitra+rezeptfrei+deutschland>buy levitra</a>

JorgeTamJorgeTam2018/04/21 12:5340 mg cialis what if i take cialis rezeptfrei sterreich

MarkdrackMarkdrack2018/04/21 14:39order levitra online pharmacy
<a href="http://levitra-gg.com">vardenafil 20mg</a>
viagra dosage vs levitra dosage
<a href=http://mylevitraok.com#levitra+10+mg+prezzo>vardenafil 20mg</a>

YterezorYterezor2018/04/21 16:13cialis reviewsBuy Cheap Cialiscialis pillscialis dosage <a href="http://foreigncircles.com/#Trazodone-50-mg">Trazodone 50 mg online</a> cialis reviewscialis tadalafil <a href=http://foreigncircles.com/#Trazodone-50-mg>http://foreigncircles.com/#Trazodone</a> cialis 20 mg best priceBuy Cheap Cialis usa http://foreigncircles.com/#Trazodone-50-mg

2011-12-21

初めてのPython 18章 モジュールとインポート 19章 モジュールのインポート、リロード

00:34 | 初めてのPython 18章 モジュールとインポート 19章 モジュールのインポート、リロード - taketin.py を含むブックマーク はてなブックマーク - 初めてのPython 18章 モジュールとインポート 19章 モジュールのインポート、リロード - taketin.py

18章 モジュールインポート


モジュールファイルをインポートすると、グローバルスコープがモジュールオブジェクトの属性名前空間になる

C, C++,(Jython を使っている場合は Javaも)等の言語で作られたモジュールエクステンションモジュールと呼ばれる。インポート方法は通常と同じ。



import ステートメントに渡すモジュール名は呼び出すモジュールのファイル名であり、モジュールオブジェクトを格納する変数名でもある

import a    # a が変数名でありファイル名である
a.spam('gumby')

この処理が行われるのは、該当モジュールがはじめてインポートされた場合のみである


上記4つを連結したものが sys.path となる。1 と 3 は自動的に設定される。カスタマイズできるのは 2 と 4 の内容となる。


バイトコードファイルはインポートに際して作成される。トップレベルファイルはバイトコードである .pycファイルは作成されない。

ロード済みモジュールは sys.modules にディクショナリとして保存される。インポート処理が行われるとまずここに格納されていないかがチェックされ、既にロードされていれば読み込まれない。明示的にモジュールの再読み込みをする場合は reload関数を使用する。


19章 モジュールインポート、リロード

>>> from module1 import printer
>>> printer('hello world')
hello world

  • from * ステートメント
    • トップレベルの変数が全てコピーされる
    • import ステートメントとの違いは、「すべての変数をコピーする」というところ

from ステートメントは名前空間を混乱させてしまう場合があるので、簡単なモジュールであれば import を使うようにし、from を使う場合は * を使用するのは1ファイルに1回を限度とし、できるだけインポートする変数を指定する様にすれば安全である。




reload関数を定期的に呼び出すようにすれば、プログラム全体を停止せずに随時変更を行うようなプログラムを作成する事ができ、ダイナミックなアプリケーションを組む事ができる。

IvanPiplyIvanPiply2018/02/01 02:55canadianpharmaciesbnt.com
pharmacy online

TrevorFusTrevorFus2018/02/06 05:00cialis generico

<a href="http://cialismsnntx.com/">buy cialis online</a>

cialis for erectile dysfunction

<a href=http://cialismsnntx.com/>buy cialis online</a>

HCSchuhCemHCSchuhCem2018/02/06 06:00quando assumere viagra

<a href="http://viagramestiksoss.com/">buy canadian viagra</a>

does viagra delayed ejaculation

<a href=http://viagramestiksoss.com/>viagra online</a>

TrevorFusTrevorFus2018/02/06 09:08
Nicely put, Regards!
cialismsnntx.com
cialis strength

HCSchuhCemHCSchuhCem2018/02/06 12:49food alternatives for viagra

<a href="http://viagramestiksoss.com/">buy generic viagra</a>

does generic female viagra work

<a href=http://viagramestiksoss.com/>buy canadian viagra</a>

TrevorFusTrevorFus2018/02/06 15:59cialis mexico

<a href="http://cialismsnntx.com/">cialis prices</a>

cialis versus viagra reviews

<a href=http://cialismsnntx.com/>buy cialis online</a>

HCSchuhCemHCSchuhCem2018/02/06 18:57effective viagra in india

<a href="http://viagramestiksoss.com/">viagra congestive heart failure
</a>

beda viagra cialis dan levitra

<a href=http://viagramestiksoss.com/>Generic Viagra</a>

TrevorFusTrevorFus2018/02/06 19:56cialis testimonials

<a href="http://cialismsnntx.com/">cialis without a doctor prescription</a>

cialis under the tongue

<a href=http://cialismsnntx.com/>cialis without a doctor prescription</a>

TrevorFusTrevorFus2018/02/06 23:26cialis 10 mg cost

<a href="http://cialismsnntx.com/">buy cialis online</a>

cialis how long last

<a href=http://cialismsnntx.com/>buy cialis online</a>

TrevorFusTrevorFus2018/02/07 00:09cialis melanoma

<a href="http://cialismsnntx.com/">cialis prices</a>

cialis doses recommended

<a href=http://cialismsnntx.com/>generic cialis</a>

JustinZopJustinZop2018/02/07 02:02
You stated that exceptionally well.
cadastro programa cialis
<a href="http://cialismsnntx.com/">cialis without a doctor prescription</a> cialis 5 mg free coupon
<a href=http://cialismsnntx.com/>cialis generic</a>

TrevorFusTrevorFus2018/02/07 03:32cialis without a doctor prescription usa

<a href="http://cialismsnntx.com/">cialis prices</a>

cialis medication

<a href=http://cialismsnntx.com/>cialis prices</a>

TrevorFusTrevorFus2018/02/07 04:38cialis with food

<a href="http://cialismsnntx.com/">buy cialis online</a>

cialis generic 2017

<a href=http://cialismsnntx.com/>buy cialis online</a>

TrevorFusTrevorFus2018/02/08 01:46
Hello mates, how is all, and what you want to say about this piece of writing, in my view its in fact amazing designed for me.
<a href=http://viagrasildenafilbsl.com/>viagra online</a>
viagra bill
<a href="http://viagrasildenafilbsl.com/">buy sildenafil online</a>

TrevorFusTrevorFus2018/02/08 02:00
Definitely believe that which you stated. Your favorite reason seemed to be on the internet the easiest thing to be aware of. I say to you, I definitely get irked while people consider worries that they just don't know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side-effects , people can take a signal. Will probably be back to get more. Thanks
<a href=http://viagrasildenafilbsl.com/>viagra generic</a>
viagra bitcoin
<a href="http://viagrasildenafilbsl.com/">buy sildenafil</a>

TrevorFusTrevorFus2018/02/08 03:01
I love your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you? Plz respond as I'm looking to design my own blog and would like to know where u got this from. thanks
<a href=http://viagrasildenafilbsl.com/>boots viagra over counter</a>
viagra erectile dysfunction
<a href="http://viagrasildenafilbsl.com/">viagra 100mg pills for sale</a>

TrevorFusTrevorFus2018/02/08 03:15
Hi my friend! I wish to say that this post is awesome, great written and include approximately all vital infos. I would like to peer more posts like this .
<a href=http://viagrasildenafilbsl.com/>buy viagra</a>
viagra deaf
<a href="http://viagrasildenafilbsl.com/">buying viagra</a>

TrevorFusTrevorFus2018/02/08 04:16
Hello, Neat post. There is a problem along with your website in web explorer, would test this? IE nonetheless is the market chief and a huge part of other folks will pass over your great writing due to this problem.
<a href=http://viagrasildenafilbsl.com/>viagra australia</a>
viagra young men
<a href="http://viagrasildenafilbsl.com/">viagra on line</a>

WQSchuhCemWQSchuhCem2018/02/08 05:05efek samping obat cialis tadalafil

<a href="http://cialisworksbins.com/">canadian cialis</a>
quand prendre du cialis 20mg

<a href=http://cialisworksbins.com/>cialis cheap</a>

TrevorFusTrevorFus2018/02/08 05:29
You should take part in a contest for one of the finest sites on the internet. I am going to recommend this web site!
<a href=http://viagrasildenafilbsl.com/>boots viagra over counter</a>
viagra vs
<a href="http://viagrasildenafilbsl.com/">buying viagra online</a>

TrevorFusTrevorFus2018/02/08 05:43
Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to more added agreeable from you! By the way, how could we communicate?
<a href=http://viagrasildenafilbsl.com/>viagra pills for sale</a>
viagra 80 mg
<a href="http://viagrasildenafilbsl.com/">viagra pills</a>

TrevorFusTrevorFus2018/02/08 06:44
always i used to read smaller content which as well clear their motive, and that is also happening with this piece of writing which I am reading at this time.
<a href=http://viagrasildenafilbsl.com/>viagra pills</a>
viagra 4 sale
<a href="http://viagrasildenafilbsl.com/">Viagra</a>

TrevorFusTrevorFus2018/02/08 06:57
Hi! I realize this is kind of off-topic however I had to ask. Does building a well-established website such as yours take a lot of work? I am brand new to operating a blog however I do write in my diary everyday. I'd like to start a blog so I can share my personal experience and views online. Please let me know if you have any kind of recommendations or tips for new aspiring bloggers. Appreciate it!
<a href=http://viagrasildenafilbsl.com/>where can i buy viagra</a>
viagra woman in blue dress
<a href="http://viagrasildenafilbsl.com/">viagra generic</a>

TrevorFusTrevorFus2018/02/08 07:59
I was more than happy to uncover this site. I need to to thank you for your time for this fantastic read!! I definitely loved every bit of it and i also have you book-marked to see new information on your web site.
<a href=http://viagrasildenafilbsl.com/>viagra 100mg</a>
viagra deaf
<a href="http://viagrasildenafilbsl.com/">generic viagra 100mg</a>

TrevorFusTrevorFus2018/02/08 08:11
You ought to take part in a contest for one of the highest quality sites on the net. I am going to highly recommend this web site!
<a href=http://viagrasildenafilbsl.com/>viagra prices</a>
viagra supplement
<a href="http://viagrasildenafilbsl.com/">viagra 100mg</a>

TrevorFusTrevorFus2018/02/08 09:14
Very energetic blog, I loved that bit. Will there be a part 2?
<a href=http://viagrasildenafilbsl.com/>viagra</a>
viagra like drugs
<a href="http://viagrasildenafilbsl.com/">lowest price on viagra</a>

TrevorFusTrevorFus2018/02/08 09:24
You really make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I'll try to get the hang of it!
<a href=http://viagrasildenafilbsl.com/>lowest price on viagra</a>
viagra versus cialis comparison
<a href="http://viagrasildenafilbsl.com/">viagra price</a>

TrevorFusTrevorFus2018/02/08 10:30
I'm truly enjoying the design and layout of your site. It's a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Excellent work!
<a href=http://viagrasildenafilbsl.com/>viagra over the counter</a>
viagra best results
<a href="http://viagrasildenafilbsl.com/">viagra pills</a>

TrevorFusTrevorFus2018/02/08 10:37
Appreciate the recommendation. Will try it out.
<a href=http://viagrasildenafilbsl.com/>buy viagra online</a>
can viagra cause melanoma
<a href="http://viagrasildenafilbsl.com/">free viagra</a>

TrevorFusTrevorFus2018/02/08 11:46
hey there and thank you for your information – I have certainly picked up anything new from right here. I did however expertise several technical issues using this web site, since I experienced to reload the website many times previous to I could get it to load correctly. I had been wondering if your web hosting is OK? Not that I am complaining, but sluggish loading instances times will sometimes affect your placement in google and can damage your high quality score if advertising and marketing with Adwords. Anyway I am adding this RSS to my email and can look out for much more of your respective interesting content. Make sure you update this again soon.
<a href=http://viagrasildenafilbsl.com/>viagra australia</a>
viagra sites
<a href="http://viagrasildenafilbsl.com/">viagra 100mg</a>

TrevorFusTrevorFus2018/02/08 11:52
I like the valuable info you provide in your articles. I will bookmark your weblog and check again here regularly. I'm quite sure I'll learn lots of new stuff right here! Good luck for the next!
<a href=http://viagrasildenafilbsl.com/>viagra</a>
viagra facts information
<a href="http://viagrasildenafilbsl.com/">online viagra</a>

TrevorFusTrevorFus2018/02/08 12:56
If you desire to get a good deal from this article then you have to apply such strategies to your won blog.
<a href=http://viagrasildenafilbsl.com/>viagra for women</a>
viagra and prostate
<a href="http://viagrasildenafilbsl.com/">asda pharmacy viagra prices</a>

TrevorFusTrevorFus2018/02/08 14:58
It's going to be ending of mine day, however before end I am reading this wonderful piece of writing to increase my knowledge.
<a href=http://viagrasildenafilbsl.com/>buy viagra</a>
viagra with flomax
<a href="http://viagrasildenafilbsl.com/">viagra 100mg</a>

TrevorFusTrevorFus2018/02/08 15:04
My spouse and I absolutely love your blog and find a lot of your post's to be precisely what I'm looking for. Does one offer guest writers to write content available for you? I wouldn't mind composing a post or elaborating on a lot of the subjects you write in relation to here. Again, awesome weblog!
<a href=http://viagrasildenafilbsl.com/>where can i buy viagra</a>
when viagra fails
<a href="http://viagrasildenafilbsl.com/">viagra for sale</a>

TrevorFusTrevorFus2018/02/09 03:04
you're actually a excellent webmaster. The website loading pace is incredible. It seems that you are doing any distinctive trick. In addition, The contents are masterwork. you've done a fantastic activity on this matter!
<a href=http://viagrasildenafilbsl.com/>viagra on line</a>
viagra and sotalol
<a href="http://viagrasildenafilbsl.com/">prescription free viagra in australia</a>

TrevorFusTrevorFus2018/02/09 03:18
I do accept as true with all the concepts you have introduced in your post. They're very convincing and will certainly work. Nonetheless, the posts are very brief for newbies. Could you please prolong them a little from subsequent time? Thank you for the post.
<a href=http://viagrasildenafilbsl.com/>buy viagra online</a>
viagra 30 day trial
<a href="http://viagrasildenafilbsl.com/">viagra for sale</a>

TrevorFusTrevorFus2018/02/09 04:19
These are in fact enormous ideas in about blogging. You have touched some fastidious things here. Any way keep up wrinting.
<a href=http://viagrasildenafilbsl.com/>medix</a>
is viagra
<a href="http://viagrasildenafilbsl.com/">prescription free viagra in australia</a>

TrevorFusTrevorFus2018/02/09 04:33
I do not even know how I ended up here, but I thought this put up was once good. I don't recognize who you're but certainly you're going to a well-known blogger when you aren't already. Cheers!
<a href=http://viagrasildenafilbsl.com/>lowest price on viagra</a>
viagra not working
<a href="http://viagrasildenafilbsl.com/">where can i buy viagra</a>

TrevorFusTrevorFus2018/02/09 13:54
Amazing! This blog looks exactly like my old one! It's on a completely different subject but it has pretty much the same layout and design. Great choice of colors!
<a href=http://viagrasildenafilbsl.com/>superdrug viagra</a>
viagra how does it work
<a href="http://viagrasildenafilbsl.com/">Viagra</a>

TrevorFusTrevorFus2018/02/09 14:08
Paragraph writing is also a excitement, if you be acquainted with after that you can write if not it is complicated to write.
<a href=http://viagrasildenafilbsl.com/>viagra</a>
viagra 25
<a href="http://viagrasildenafilbsl.com/">viagra tablets</a>

TrevorFusTrevorFus2018/02/09 15:09
Your style is really unique compared to other folks I have read stuff from. I appreciate you for posting when you've got the opportunity, Guess I will just bookmark this web site.
<a href=http://viagrasildenafilbsl.com/>order viagra</a>
viagra best dosage
<a href="http://viagrasildenafilbsl.com/">buy sildenafil</a>

TrevorFusTrevorFus2018/02/09 15:23
Hi! I've been following your website for a while now and finally got the bravery to go ahead and give you a shout out from Dallas Tx! Just wanted to tell you keep up the good work!
<a href=http://viagrasildenafilbsl.com/>buy viagra</a>
viagra deaf
<a href="http://viagrasildenafilbsl.com/">viagra pills for sale</a>

TrevorFusTrevorFus2018/02/09 16:25
Hi there mates, its impressive post on the topic of tutoringand fully explained, keep it up all the time.
<a href=http://viagrasildenafilbsl.com/>viagra pills</a>
viagra faq
<a href="http://viagrasildenafilbsl.com/">online viagra</a>

TrevorFusTrevorFus2018/02/09 17:40
When I initially commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Cheers!
<a href=http://viagrasildenafilbsl.com/>sildenafil 100mg price</a>
what viagra looks like
<a href="http://viagrasildenafilbsl.com/">viagra 100mg</a>

TrevorFusTrevorFus2018/02/09 18:54
Hey would you mind stating which blog platform you're working with? I'm going to start my own blog soon but I'm having a tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I'm looking for something unique. P.S Apologies for getting off-topic but I had to ask!
<a href=http://viagrasildenafilbsl.com/>viagra on line</a>
viagra under the tongue
<a href="http://viagrasildenafilbsl.com/">superdrug viagra</a>

TrevorFusTrevorFus2018/02/09 19:07
Hello, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam responses? If so how do you protect against it, any plugin or anything you can advise? I get so much lately it's driving me insane so any help is very much appreciated.
<a href=http://viagrasildenafilbsl.com/>boots viagra over counter</a>
viagra for children
<a href="http://viagrasildenafilbsl.com/">online viagra</a>

TrevorFusTrevorFus2018/02/09 20:23
I like the valuable info you provide in your articles. I will bookmark your weblog and check again here regularly. I am quite certain I'll learn many new stuff right here! Best of luck for the next!
<a href=http://viagrasildenafilbsl.com/>free viagra</a>
viagra or sildenafil
<a href="http://viagrasildenafilbsl.com/">buying viagra online</a>

TrevorFusTrevorFus2018/02/09 21:25
I am really inspired together with your writing skills and also with the structure in your weblog. Is that this a paid topic or did you modify it your self? Anyway stay up the nice high quality writing, it's uncommon to look a nice blog like this one these days..
<a href=http://viagrasildenafilbsl.com/>viagra on line</a>
viagra controlled substance
<a href="http://viagrasildenafilbsl.com/">viagra over the counter</a>

TrevorFusTrevorFus2018/02/09 21:38
Today, I went to the beach front with my children. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!
<a href=http://viagrasildenafilbsl.com/>Viagra</a>
fastest viagra delivery
<a href="http://viagrasildenafilbsl.com/">viagra pills</a>

TrevorFusTrevorFus2018/02/09 22:41
I loved as much as you'll receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get bought an edginess over that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly very often inside case you shield this increase.
<a href=http://viagrasildenafilbsl.com/>viagra for sale uk</a>
viagra wholesale price
<a href="http://viagrasildenafilbsl.com/">where to buy viagra</a>

TrevorFusTrevorFus2018/02/09 22:53
We're a group of volunteers and starting a new scheme in our community. Your web site provided us with valuable info to work on. You have done an impressive job and our entire community will be grateful to you.
<a href=http://viagrasildenafilbsl.com/>online viagra</a>
viagra overnight
<a href="http://viagrasildenafilbsl.com/">viagra 100mg</a>

CanadaFusCanadaFus2018/02/10 06:37
What's up, this weekend is good in support of me, as this time i am reading this impressive educational post here at my house.
<a href=http://canadianpharmacyntx.com/>canadian drugstore</a>
canadian pharmacy king
<a href="http://canadianpharmacyntx.com/">highest rated canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/10 06:54
Appreciating the time and effort you put into your site and in depth information you present. It's good to come across a blog every once in a while that isn't the same outdated rehashed information. Excellent read! I've saved your site and I'm including your RSS feeds to my Google account.
<a href=http://canadianpharmacymsn.com/>canada pharmacies</a>
approved canadian online pharmacies
<a href="http://canadianpharmacymsn.com/">pharmacy canada</a>

CanadaFusCanadaFus2018/02/10 07:52
Hello, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam responses? If so how do you prevent it, any plugin or anything you can advise? I get so much lately it's driving me insane so any support is very much appreciated.
<a href=http://canadianpharmacyntx.com/>canadian pharmacies online prescriptions</a>
no 1 canadian pharcharmy online
<a href="http://canadianpharmacyntx.com/">trust pharmacy canada</a>

CanadianWelAyCanadianWelAy2018/02/10 08:10
I've been surfing online greater than three hours nowadays, but I never discovered any fascinating article like yours. It's lovely worth sufficient for me. In my view, if all site owners and bloggers made just right content material as you probably did, the net will be much more useful than ever before.
<a href=http://canadianpharmacymsn.com/>canadian pharmacies online</a>
canadian cialis
<a href="http://canadianpharmacymsn.com/">online pharmacies canada</a>

CanadianWelAyCanadianWelAy2018/02/10 09:25
At this time I am going to do my breakfast, once having my breakfast coming over again to read additional news.
<a href=http://canadianpharmacymsn.com/>canadian viagra</a>
highest rated canadian pharmacies
<a href="http://canadianpharmacymsn.com/">canada pharmacies</a>

CanadaFusCanadaFus2018/02/10 10:23
Everyone loves what you guys are up too. This sort of clever work and reporting! Keep up the fantastic works guys I've incorporated you guys to my blogroll.
<a href=http://canadianpharmacyntx.com/>canadian pharmacy viagra</a>
canadian pharmacies online prescriptions
<a href="http://canadianpharmacyntx.com/">canadian drugstore</a>

CanadaFusCanadaFus2018/02/10 11:38
Hi my friend! I want to say that this article is awesome, nice written and include approximately all significant infos. I would like to look more posts like this .
<a href=http://canadianpharmacyntx.com/>canada pharmacies online prescriptions</a>
canadian drug store
<a href="http://canadianpharmacyntx.com/">canada drug</a>

CanadianWelAyCanadianWelAy2018/02/10 11:56
Hi there Dear, are you actually visiting this site regularly, if so afterward you will without doubt obtain nice knowledge.
<a href=http://canadianpharmacymsn.com/>best canadian pharmacies online</a>
northwest pharmacy
<a href="http://canadianpharmacymsn.com/">online pharmacies canada</a>

CanadaFusCanadaFus2018/02/10 12:53
We're a group of volunteers and starting a new scheme in our community. Your site offered us with valuable info to work on. You have done a formidable job and our whole community will be grateful to you.
<a href=http://canadianpharmacyntx.com/>safe canadian online pharmacies</a>
canadian online pharmacies
<a href="http://canadianpharmacyntx.com/">canadian pharmacies that are legit</a>

CanadianWelAyCanadianWelAy2018/02/10 13:11
Hi, I do believe this is an excellent website. I stumbledupon it ;) I'm going to revisit yet again since i have bookmarked it. Money and freedom is the best way to change, may you be rich and continue to guide others.
<a href=http://canadianpharmacymsn.com/>pharmacy canada</a>
canadian pharmacies mail order
<a href="http://canadianpharmacymsn.com/">canadian pharmacies that ship to us</a>

CanadaFusCanadaFus2018/02/10 14:08
Hi! I could have sworn I've visited this website before but after going through many of the articles I realized it's new to me. Anyhow, I'm certainly delighted I stumbled upon it and I'll be book-marking it and checking back regularly!
<a href=http://canadianpharmacyntx.com/>canada pharmacy online</a>
the canadian pharmacy
<a href="http://canadianpharmacyntx.com/">aarp recommended canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/10 14:27
I'm truly enjoying the design and layout of your website. It's a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Great work!
<a href=http://canadianpharmacymsn.com/>canadian pharmacy uk delivery</a>
canadian cialis
<a href="http://canadianpharmacymsn.com/">canadian cialis</a>

CanadaFusCanadaFus2018/02/10 15:22
Hello would you mind stating which blog platform you're using? I'm going to start my own blog in the near future but I'm having a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I'm looking for something unique. P.S My apologies for getting off-topic but I had to ask!
<a href=http://canadianpharmacyntx.com/>online canadian pharmacies</a>
cialis canadian pharmacy
<a href="http://canadianpharmacyntx.com/">canadian pharmacies legitimate</a>

CanadaFusCanadaFus2018/02/10 16:37
It's truly a nice and useful piece of information. I'm satisfied that you simply shared this useful info with us. Please keep us informed like this. Thanks for sharing.
<a href=http://canadianpharmacyntx.com/>canadian pharmacies online prescriptions</a>
canadian cialis
<a href="http://canadianpharmacyntx.com/">legitimate canadian mail order pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/10 16:59
you're really a good webmaster. The web site loading pace is amazing. It sort of feels that you're doing any unique trick. Furthermore, The contents are masterpiece. you have done a fantastic activity on this subject!
<a href=http://canadianpharmacymsn.com/>canadian pharmacies that ship to us</a>
online pharmacies
<a href="http://canadianpharmacymsn.com/">canada drugs online</a>

CanadaFusCanadaFus2018/02/10 17:51
Woah! I'm really enjoying the template/theme of this website. It's simple, yet effective. A lot of times it's difficult to get that "perfect balance" between user friendliness and visual appearance. I must say that you've done a superb job with this. In addition, the blog loads extremely quick for me on Opera. Exceptional Blog!
<a href=http://canadianpharmacyntx.com/>canadian pharmacy viagra</a>
canadadrugs
<a href="http://canadianpharmacyntx.com/">canadian discount pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/10 18:16
Very quickly this website will be famous among all blogging and site-building people, due to it's pleasant posts
<a href=http://canadianpharmacymsn.com/>canadian pharmacies</a>
canadapharmacy
<a href="http://canadianpharmacymsn.com/">list of reputable canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/10 19:33
When some one searches for his required thing, so he/she wishes to be available that in detail, so that thing is maintained over here.
<a href=http://canadianpharmacymsn.com/>canadian pharmacy</a>
northwest pharmacy
<a href="http://canadianpharmacymsn.com/">best canadian pharmacies online</a>

CanadaFusCanadaFus2018/02/10 20:22
We're a group of volunteers and starting a new scheme in our community. Your website provided us with valuable info to work on. You have done an impressive job and our whole community will be thankful to you.
<a href=http://canadianpharmacyntx.com/>canadian pharmacies legitimate</a>
top rated online canadian pharmacies
<a href="http://canadianpharmacyntx.com/">canadian pharmacies legitimate</a>

CanadianWelAyCanadianWelAy2018/02/10 20:50
I know this web page offers quality dependent articles and additional data, is there any other web page which gives such information in quality?
<a href=http://canadianpharmacymsn.com/>northwestpharmacy</a>
top rated online canadian pharmacies
<a href="http://canadianpharmacymsn.com/">no 1 canadian pharcharmy online</a>

WQSchuhCemWQSchuhCem2018/02/10 20:54cialis side effects sore throat

<a href="http://cialiaswiskmetri.com/">buy cialis online</a>
farmaco cialis 20 mg

<a href=http://cialiaswiskmetri.com/>generic cialis online</a>

CanadaFusCanadaFus2018/02/10 21:37
This is a topic which is close to my heart... Cheers! Where are your contact details though?
<a href=http://canadianpharmacyntx.com/>canadapharmacy</a>
northwest pharmacy canada
<a href="http://canadianpharmacyntx.com/">canadian pharmacies on line</a>

CanadianWelAyCanadianWelAy2018/02/10 22:08
Hello, I do believe your website might be having internet browser compatibility problems. When I take a look at your site in Safari, it looks fine however when opening in IE, it's got some overlapping issues. I just wanted to provide you with a quick heads up! Besides that, wonderful website!
<a href=http://canadianpharmacymsn.com/>no 1 canadian pharcharmy online</a>
canada pharmacies online
<a href="http://canadianpharmacymsn.com/">canadian drugs</a>

CanadianWelAyCanadianWelAy2018/02/10 23:25
Hi there, this weekend is nice designed for me, as this time i am reading this enormous informative paragraph here at my house.
<a href=http://canadianpharmacymsn.com/>canadian cialis</a>
canadian pharmacies
<a href="http://canadianpharmacymsn.com/">canadian online pharmacy</a>

CanadaFusCanadaFus2018/02/11 00:09
I was suggested this blog by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my problem. You are incredible! Thanks!
<a href=http://canadianpharmacyntx.com/>canadian drugstore</a>
northwest pharmacy canada
<a href="http://canadianpharmacyntx.com/">online canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/11 00:42
Keep on working, great job!
<a href=http://canadianpharmacymsn.com/>canada drugs online</a>
online canadian pharmacies
<a href="http://canadianpharmacymsn.com/">list of approved canadian pharmacies</a>

CanadaFusCanadaFus2018/02/11 01:25
Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I get actually enjoyed account your blog posts. Anyway I'll be subscribing to your feeds and even I achievement you access consistently rapidly.
<a href=http://canadianpharmacyntx.com/>canadian discount pharmacies</a>
canadian pharmacies legitimate
<a href="http://canadianpharmacyntx.com/">canadian pharmacy no prescription</a>

CanadianWelAyCanadianWelAy2018/02/11 02:00
Great beat ! I would like to apprentice while you amend your web site, how could i subscribe for a weblog web site? The account aided me a applicable deal. I had been tiny bit acquainted of this your broadcast provided vibrant clear concept
<a href=http://canadianpharmacymsn.com/>canadian cialis</a>
canadadrugs price list
<a href="http://canadianpharmacymsn.com/">canadian online pharmacy</a>

CanadaFusCanadaFus2018/02/11 02:40
Hi there, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam feedback? If so how do you prevent it, any plugin or anything you can recommend? I get so much lately it's driving me crazy so any support is very much appreciated.
<a href=http://canadianpharmacyntx.com/>online canadian pharmacies</a>
canadian pharmacies mail order
<a href="http://canadianpharmacyntx.com/">approved canadian online pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/11 03:18
Wow that was strange. I just wrote an very long comment but after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again. Anyways, just wanted to say fantastic blog!
<a href=http://canadianpharmacymsn.com/>canadian pharmacies that ship to us</a>
discount canadian pharmacies
<a href="http://canadianpharmacymsn.com/">cialis canadian pharmacy</a>

CanadianWelAyCanadianWelAy2018/02/11 04:35
It's actually a nice and helpful piece of info. I am happy that you shared this helpful information with us. Please stay us informed like this. Thanks for sharing.
<a href=http://canadianpharmacymsn.com/>pharmacy canada</a>
best canadian pharmacies online
<a href="http://canadianpharmacymsn.com/">list of reputable canadian pharmacies</a>

CanadaFusCanadaFus2018/02/11 05:11
Its like you read my thoughts! You seem to know a lot about this, such as you wrote the e-book in it or something. I think that you simply can do with some p.c. to drive the message home a little bit, but other than that, that is fantastic blog. An excellent read. I'll certainly be back.
<a href=http://canadianpharmacyntx.com/>canadian pharmacies that ship to the us</a>
canadian viagra
<a href="http://canadianpharmacyntx.com/">highest rated canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/11 05:52
Thanks for the good writeup. It in fact was a amusement account it. Glance advanced to more delivered agreeable from you! By the way, how could we keep up a correspondence?
<a href=http://canadianpharmacymsn.com/>canadian drugs</a>
list of reputable canadian pharmacies
<a href="http://canadianpharmacymsn.com/">canadian pharmacies shipping to usa</a>

CanadaFusCanadaFus2018/02/11 06:26
What's up to all, how is everything, I think every one is getting more from this site, and your views are fastidious for new people.
<a href=http://canadianpharmacyntx.com/>canada pharmacy online</a>
canadian pharmacies shipping to usa
<a href="http://canadianpharmacyntx.com/">best canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/11 07:10
Hey there! I know this is somewhat off topic but I was wondering which blog platform are you using for this site? I'm getting fed up of Wordpress because I've had problems with hackers and I'm looking at options for another platform. I would be great if you could point me in the direction of a good platform.
<a href=http://canadianpharmacymsn.com/>best canadian pharmacies online</a>
highest rated canadian pharmacies
<a href="http://canadianpharmacymsn.com/">northwest pharmacy canada</a>

CanadaFusCanadaFus2018/02/11 07:41
Appreciating the time and effort you put into your site and in depth information you provide. It's awesome to come across a blog every once in a while that isn't the same outdated rehashed information. Fantastic read! I've saved your site and I'm adding your RSS feeds to my Google account.
<a href=http://canadianpharmacyntx.com/>canadian pharmacy no prescription</a>
canada pharmacy
<a href="http://canadianpharmacyntx.com/">online canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/11 08:29
It's very simple to find out any matter on net as compared to textbooks, as I found this article at this web page.
<a href=http://canadianpharmacymsn.com/>canadian pharmacy uk delivery</a>
canadianpharmacy
<a href="http://canadianpharmacymsn.com/">online pharmacies canada</a>

CanadaFusCanadaFus2018/02/11 08:58
You actually make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complex and very broad for me. I am looking forward for your next post, I will try to get the hang of it!
<a href=http://canadianpharmacyntx.com/>online canadian pharmacies</a>
online pharmacies canada
<a href="http://canadianpharmacyntx.com/">canadian pharmacies legitimate</a>

CanadianWelAyCanadianWelAy2018/02/11 09:38
I loved as much as you'll receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get got an edginess over that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly a lot often inside case you shield this hike.
<a href=http://canadianpharmacymsn.com/>canadian online pharmacies</a>
canadian drug store
<a href="http://canadianpharmacymsn.com/">cialis canadian pharmacy</a>

CanadianWelAyCanadianWelAy2018/02/11 10:42
Excellent beat ! I would like to apprentice even as you amend your site, how can i subscribe for a blog site? The account helped me a applicable deal. I had been tiny bit familiar of this your broadcast provided vibrant transparent idea
<a href=http://canadianpharmacymsn.com/>canadian pharmacies online</a>
canadian pharmacy online
<a href="http://canadianpharmacymsn.com/">canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/11 11:47
It's awesome for me to have a website, which is helpful in favor of my knowledge. thanks admin
<a href=http://canadianpharmacymsn.com/>northwest pharmacy</a>
discount canadian pharmacies
<a href="http://canadianpharmacymsn.com/">canada pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/11 12:51
Please let me know if you're looking for a writer for your weblog. You have some really good posts and I believe I would be a good asset. If you ever want to take some of the load off, I'd really like to write some material for your blog in exchange for a link back to mine. Please blast me an e-mail if interested. Cheers!
<a href=http://canadianpharmacymsn.com/>northwest pharmacy</a>
canadian pharmacy king
<a href="http://canadianpharmacymsn.com/">canadian cialis</a>

CanadianWelAyCanadianWelAy2018/02/11 13:55
Hi, I wish for to subscribe for this web site to get most up-to-date updates, therefore where can i do it please help.
<a href=http://canadianpharmacymsn.com/>online pharmacies canada</a>
trust pharmacy canada
<a href="http://canadianpharmacymsn.com/">canada online pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/11 14:59
I know this if off topic but I'm looking into starting my own weblog and was curious what all is needed to get set up? I'm assuming having a blog like yours would cost a pretty penny? I'm not very internet smart so I'm not 100% sure. Any tips or advice would be greatly appreciated. Thank you
<a href=http://canadianpharmacymsn.com/>canadian drugs</a>
canadian pharmacy uk delivery
<a href="http://canadianpharmacymsn.com/">northwestpharmacy</a>

CanadianWelAyCanadianWelAy2018/02/11 16:04
It's genuinely very complex in this full of activity life to listen news on Television, thus I just use the web for that purpose, and obtain the most up-to-date news.
<a href=http://canadianpharmacymsn.com/>canadadrugs price list</a>
canadian online pharmacy
<a href="http://canadianpharmacymsn.com/">no 1 canadian pharcharmy online</a>

CanadianWelAyCanadianWelAy2018/02/11 17:20
This design is incredible! You certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost...HaHa!) Great job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!
<a href=http://canadianpharmacymsn.com/>canadian pharmacies shipping to usa</a>
canada pharmacies online
<a href="http://canadianpharmacymsn.com/">canada pharmacy</a>

CanadaFusCanadaFus2018/02/11 17:32
Does your website have a contact page? I'm having trouble locating it but, I'd like to send you an e-mail. I've got some creative ideas for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it grow over time.
<a href=http://canadianpharmacyntx.com/>canada pharmacies online prescriptions</a>
safe canadian online pharmacies
<a href="http://canadianpharmacyntx.com/">canadian pharmacy no prescription</a>

CanadianWelAyCanadianWelAy2018/02/11 18:38
This is a topic that is near to my heart... Best wishes! Where are your contact details though?
<a href=http://canadianpharmacymsn.com/>top rated online canadian pharmacies</a>
approved canadian online pharmacies
<a href="http://canadianpharmacymsn.com/">canadian pharmacies</a>

CanadaFusCanadaFus2018/02/11 18:43
Good post. I certainly appreciate this site. Keep writing!
<a href=http://canadianpharmacyntx.com/>canada drug pharmacy</a>
canadian pharmacies shipping to usa
<a href="http://canadianpharmacyntx.com/">aarp recommended canadian pharmacies</a>

CanadaFusCanadaFus2018/02/11 19:54
Hi, I do believe this is a great web site. I stumbledupon it ;) I'm going to revisit once again since i have book marked it. Money and freedom is the greatest way to change, may you be rich and continue to guide other people.
<a href=http://canadianpharmacyntx.com/>canadadrugs</a>
canada pharmacy
<a href="http://canadianpharmacyntx.com/">canadian pharmacy no prescription</a>

CanadaFusCanadaFus2018/02/11 21:06
It's amazing designed for me to have a site, which is valuable designed for my know-how. thanks admin
<a href=http://canadianpharmacyntx.com/>canadian pharmacies that ship to the us</a>
canada online pharmacies
<a href="http://canadianpharmacyntx.com/">canadian pharmacies vipps</a>

CanadianWelAyCanadianWelAy2018/02/11 21:15
Wow! At last I got a blog from where I know how to in fact obtain useful facts regarding my study and knowledge.
<a href=http://canadianpharmacymsn.com/>canada online pharmacies</a>
canadian pharmacies that ship to the us
<a href="http://canadianpharmacymsn.com/">pharmacy canada</a>

CanadaFusCanadaFus2018/02/11 22:20
Howdy this is somewhat of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I'm starting a blog soon but have no coding skills so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!
<a href=http://canadianpharmacyntx.com/>canadian pharmacies vipps</a>
northwest pharmacy
<a href="http://canadianpharmacyntx.com/">canadian pharmacy viagra brand</a>

CanadianWelAyCanadianWelAy2018/02/11 22:36
Wow! This blog looks exactly like my old one! It's on a totally different topic but it has pretty much the same layout and design. Superb choice of colors!
<a href=http://canadianpharmacymsn.com/>cialis canadian pharmacy</a>
online pharmacies
<a href="http://canadianpharmacymsn.com/">canadian drugs</a>

DarrellMedDarrellMed2018/02/11 23:29
Keep on writing, great job!
<a href=http://howtobuybitcoinshelp.com/>how do you buy bitcoins</a>
where to buy bitcoins
<a href="http://howtobuybitcoinshelp.com/">best bitcoin trade platform</a>

MarionfamMarionfam2018/02/11 23:43
Very good blog! Do you have any tips and hints for aspiring writers? I'm hoping to start my own blog soon but I'm a little lost on everything. Would you suggest starting with a free platform like Wordpress or go for a paid option? There are so many options out there that I'm totally confused .. Any tips? Thank you!
<a href=http://howtobuybitcoinshelp.com/>buy bitcoin online</a>
buy ripple cryptocurrency
<a href="http://howtobuybitcoinshelp.com/">where can i buy bitcoin</a>

DarrellMedDarrellMed2018/02/12 00:44
Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.
<a href=http://howtobuybitcoinshelp.com/>bitcoin trading software</a>
best bitcoin trade platform
<a href="http://howtobuybitcoinshelp.com/">buying bitcoins</a>

MarionfamMarionfam2018/02/12 01:00
It's going to be finish of mine day, except before finish I am reading this great paragraph to increase my know-how.
<a href=http://howtobuybitcoinshelp.com/>bitcoin how to buy</a>
coinbase charts
<a href="http://howtobuybitcoinshelp.com/">buy cryptocurrency</a>

DarrellMedDarrellMed2018/02/12 01:59
Heya! I'm at work browsing your blog from my new iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Keep up the outstanding work!
<a href=http://howtobuybitcoinshelp.com/>litecoin trade</a>
bitcoin trading price
<a href="http://howtobuybitcoinshelp.com/">how to buy bitcoins with paypal</a>

MarionfamMarionfam2018/02/12 02:16
Hmm is anyone else having problems with the images on this blog loading? I'm trying to determine if its a problem on my end or if it's the blog. Any responses would be greatly appreciated.
<a href=http://howtobuybitcoinshelp.com/>how to buy iota</a>
litecoin trade
<a href="http://howtobuybitcoinshelp.com/">how to buy iota</a>

DarrellMedDarrellMed2018/02/12 03:15
A person necessarily lend a hand to make significantly posts I'd state. This is the very first time I frequented your website page and up to now? I amazed with the research you made to make this actual put up extraordinary. Great job!
<a href=http://howtobuybitcoinshelp.com/>how to buy bitcoin in australia</a>
buy bitcoins online instantly
<a href="http://howtobuybitcoinshelp.com/">buy bitcoin uk</a>

MarionfamMarionfam2018/02/12 03:33
With havin so much content do you ever run into any issues of plagorism or copyright violation? My site has a lot of unique content I've either authored myself or outsourced but it appears a lot of it is popping it up all over the internet without my agreement. Do you know any solutions to help protect against content from being ripped off? I'd certainly appreciate it.
<a href=http://howtobuybitcoinshelp.com/>bitcoin trade bot</a>
bitcoin trading software
<a href="http://howtobuybitcoinshelp.com/">bitcoin trading uk</a>

DarrellMedDarrellMed2018/02/12 04:36
Hi there, always i used to check website posts here in the early hours in the daylight, since i love to gain knowledge of more and more.
<a href=http://howtobuybitcoinshelp.com/>bitcoin trading for beginners</a>
how do i buy bitcoin
<a href="http://howtobuybitcoinshelp.com/">bitcoin trade site</a>

MarionfamMarionfam2018/02/12 04:54
It's difficult to find well-informed people in this particular topic, however, you sound like you know what you're talking about! Thanks
<a href=http://howtobuybitcoinshelp.com/>how to buy iota</a>
bitcoin trading platforms
<a href="http://howtobuybitcoinshelp.com/">bitcoin how to buy</a>

DarrellMedDarrellMed2018/02/12 06:02
I know this if off topic but I'm looking into starting my own weblog and was curious what all is needed to get set up? I'm assuming having a blog like yours would cost a pretty penny? I'm not very internet savvy so I'm not 100% positive. Any tips or advice would be greatly appreciated. Thank you
<a href=http://howtobuybitcoinshelp.com/>buying bitcoins</a>
bitcoin trading bots
<a href="http://howtobuybitcoinshelp.com/">bitcoin trading hours</a>

MarionfamMarionfam2018/02/12 06:18
I am really impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you modify it yourself? Anyway keep up the nice quality writing, it is rare to see a great blog like this one today.
<a href=http://howtobuybitcoinshelp.com/>how do you buy bitcoin</a>
how to buy bitcoin
<a href="http://howtobuybitcoinshelp.com/">bitcoin trading bots</a>

DarrellMedDarrellMed2018/02/12 07:26
I was recommended this blog through my cousin. I'm now not certain whether or not this submit is written through him as no one else understand such specific approximately my trouble. You are amazing! Thanks!
<a href=http://howtobuybitcoinshelp.com/>where to buy bitcoin</a>
buy bitcoins instantly no verification
<a href="http://howtobuybitcoinshelp.com/">buying bitcoin</a>

MarionfamMarionfam2018/02/12 07:41
Admiring the time and energy you put into your blog and detailed information you present. It's nice to come across a blog every once in a while that isn't the same out of date rehashed information. Wonderful read! I've saved your site and I'm including your RSS feeds to my Google account.
<a href=http://howtobuybitcoinshelp.com/>crypto currency stocks to buy</a>
where to buy ripple
<a href="http://howtobuybitcoinshelp.com/">coinbase charts</a>

CanadaFusCanadaFus2018/02/18 21:56
Thank you for sharing your thoughts. I really appreciate your efforts and I am waiting for your further write ups thanks once again.
<a href=http://canadianpharmacyntx.com/>canadian pharmacies that ship to the us</a>
safe canadian online pharmacies
<a href="http://canadianpharmacyntx.com/">canadian pharmacies that ship to the us</a>

CanadianWelAyCanadianWelAy2018/02/18 22:10
Hey I am so excited I found your web site, I really found you by accident, while I was looking on Google for something else, Nonetheless I am here now and would just like to say thanks a lot for a incredible post and a all round thrilling blog (I also love the theme/design), I don’t have time to browse it all at the moment but I have book-marked it and also added your RSS feeds, so when I have time I will be back to read more, Please do keep up the great jo.
<a href=http://canadianpharmacymsn.com/>canadian viagra</a>
canada pharmacies online
<a href="http://canadianpharmacymsn.com/">northwest pharmacy canada</a>

CanadaFusCanadaFus2018/02/18 23:13
Heya this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I'm starting a blog soon but have no coding skills so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!
<a href=http://canadianpharmacyntx.com/>canadian drugstore</a>
canada drugs
<a href="http://canadianpharmacyntx.com/">the canadian pharmacy</a>

CanadianWelAyCanadianWelAy2018/02/18 23:26
Hi Dear, are you truly visiting this website on a regular basis, if so after that you will absolutely get fastidious knowledge.
<a href=http://canadianpharmacymsn.com/>canada drugs online</a>
canadian online pharmacies
<a href="http://canadianpharmacymsn.com/">list of approved canadian pharmacies</a>

CanadaFusCanadaFus2018/02/19 00:30
Thankfulness to my father who shared with me on the topic of this weblog, this webpage is genuinely amazing.
<a href=http://canadianpharmacyntx.com/>highest rated canadian pharmacies</a>
canada pharmacies
<a href="http://canadianpharmacyntx.com/">canadian pharmacies that ship to the us</a>

CanadianWelAyCanadianWelAy2018/02/19 00:43
I'd like to find out more? I'd love to find out some additional information.
<a href=http://canadianpharmacymsn.com/>canada pharmacies</a>
canadian pharmacies
<a href="http://canadianpharmacymsn.com/">canada pharmacies</a>

CanadaFusCanadaFus2018/02/19 01:48
You ought to be a part of a contest for one of the best blogs on the internet. I am going to highly recommend this blog!
<a href=http://canadianpharmacyntx.com/>canadian pharmacy viagra brand</a>
most reliable canadian pharmacies
<a href="http://canadianpharmacyntx.com/">aarp recommended canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/19 01:59
For most recent news you have to visit internet and on web I found this site as a most excellent web page for newest updates.
<a href=http://canadianpharmacymsn.com/>northwest pharmacy</a>
canada pharmacies online prescriptions
<a href="http://canadianpharmacymsn.com/">canadianpharmacy</a>

CanadaFusCanadaFus2018/02/19 03:05
Please let me know if you're looking for a writer for your blog. You have some really great posts and I believe I would be a good asset. If you ever want to take some of the load off, I'd really like to write some articles for your blog in exchange for a link back to mine. Please blast me an email if interested. Regards!
<a href=http://canadianpharmacyntx.com/>canadian pharmacies that are legit</a>
canadian pharmacies legitimate
<a href="http://canadianpharmacyntx.com/">canada drugs</a>

CanadaFusCanadaFus2018/02/19 04:22
Hey There. I found your blog using msn. This is a very well written article. I will be sure to bookmark it and come back to read more of your useful information. Thanks for the post. I will definitely return.
<a href=http://canadianpharmacyntx.com/>discount canadian pharmacies</a>
canadian pharmacy king
<a href="http://canadianpharmacyntx.com/">aarp recommended canadian pharmacies</a>

CanadianWelAyCanadianWelAy2018/02/19 04:34
Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your site when you could be giving us something enlightening to read?
<a href=http://canadianpharmacymsn.com/>canadadrugs price list</a>
northwest pharmacy
<a href="http://canadianpharmacymsn.com/">canadian pharmacies that ship to us</a>

CanadaFusCanadaFus2018/02/19 05:41
What's up, I would like to subscribe for this blog to obtain hottest updates, thus where can i do it please help.
<a href=http://canadianpharmacyntx.com/>canadian pharmacy viagra brand</a>
the canadian pharmacy
<a href="http://canadianpharmacyntx.com/">canadian drugstore</a>

CanadianWelAyCanadianWelAy2018/02/19 05:51
This is the perfect site for anybody who would like to understand this topic. You realize a whole lot its almost hard to argue with you (not that I really would want to…HaHa). You certainly put a new spin on a topic which has been written about for ages. Excellent stuff, just wonderful!
<a href=http://canadianpharmacymsn.com/>northwest pharmacy</a>
canadian drug store
<a href="http://canadianpharmacymsn.com/">canada online pharmacies</a>

CanadaFusCanadaFus2018/02/19 06:59
I do consider all of the concepts you have introduced for your post. They are really convincing and can definitely work. Still, the posts are very brief for novices. May you please prolong them a bit from subsequent time? Thank you for the post.
<a href=http://canadianpharmacyntx.com/>canada pharmacies online</a>
canada drug pharmacy
<a href="http://canadianpharmacyntx.com/">canadian drug store</a>

CanadianWelAyCanadianWelAy2018/02/19 07:09
What a information of un-ambiguity and preserveness of precious experience about unpredicted emotions.
<a href=http://canadianpharmacymsn.com/>canada pharmacy</a>
top rated online canadian pharmacies
<a href="http://canadianpharmacymsn.com/">canadianpharmacy</a>

CanadaFusCanadaFus2018/02/19 08:18
Have you ever thought about writing an e-book or guest authoring on other blogs? I have a blog centered on the same ideas you discuss and would really like to have you share some stories/information. I know my audience would enjoy your work. If you are even remotely interested, feel free to shoot me an e-mail.
<a href=http://canadianpharmacyntx.com/>discount canadian pharmacies</a>
canadian drugs
<a href="http://canadianpharmacyntx.com/">canadian pharmacies online prescriptions</a>

CanadianWelAyCanadianWelAy2018/02/19 08:27
Great article! That is the type of info that should be shared across the net. Disgrace on Google for not positioning this submit higher! Come on over and talk over with my website . Thank you =)
<a href=http://canadianpharmacymsn.com/>canadianpharmacy</a>
online canadian pharmacies
<a href="http://canadianpharmacymsn.com/">northwest pharmacy</a>

CanadaFusCanadaFus2018/02/19 09:38
It is perfect time to make some plans for the future and it is time to be happy. I have read this publish and if I may just I want to recommend you some interesting issues or tips. Maybe you could write next articles referring to this article. I desire to learn even more issues approximately it!
<a href=http://canadianpharmacyntx.com/>online canadian pharmacies</a>
online pharmacies canada
<a href="http://canadianpharmacyntx.com/">canadian drug store</a>

CanadaFusCanadaFus2018/02/19 10:58
I am no longer positive the place you're getting your information, but good topic. I must spend a while finding out more or working out more. Thank you for magnificent info I was searching for this information for my mission.
<a href=http://canadianpharmacyntx.com/>canadapharmacy</a>
canada drugs
<a href="http://canadianpharmacyntx.com/">canadapharmacy</a>

2011-12-17

はじめてのPython 17章 関数に関連する高度なテクニック

03:28 | はじめてのPython 17章 関数に関連する高度なテクニック - taketin.py を含むブックマーク はてなブックマーク - はじめてのPython 17章 関数に関連する高度なテクニック - taketin.py

  • lambda式
    • defステートメントと違う点は、作成された関数関数オブジェクト)が式の戻り値になる、という点。つまり、戻り値変数に代入しない限りは関数に名前が無い、という事になる。この為、「無名関数」と呼ばれる。インラインでの関数定義(コールバック関数の定義など)によく使用される
    • lambda式はあくまで式である為、リストのリテラル関数の呼び出しコードの中などでも使える
    • lambda式はボディ部分も式である為、defステートメントに比べると汎用性は劣るが、コードを短く凝縮できる
    • lmbda式はコールバック関数の他、ジャンプテーブル(要素として単なるオブジェクトではなく、行うべき処理を組み込んだリストやディクショナリのこと)によく利用される
L = [(lambda x: x ** 2), (lambda x: x ** 3), (lambda x: x ** 4)]

for f in L:
    print f(2)     # 4, 8, 16 が出力される

print L[0](3)     # 9 が出力される

  • lambda式とネストスコープ
    • defステートメントの中に組み込まれたlambda式では、defステートメントのスコープをそのまま利用でき、lambda式によって作成された関数オブジェクトはネストスコープの変数を保持し続ける
    • lambda式が他のlambda式に組み込まれた(ネストされた)場合も、内側の式から外側の式のスコープにアクセスする事ができる
>>> action = (lambda x: (lambda y: x + y))
>>> act = action(99)
>>> act(3)
102
>>> ((lambda x: (lambda y: x + y)) (99))(4)
103

こういった書き方は読み辛いので、あまり良い方法とは言えない。


>>> def func(x, y, z): return x + y + z
…
>>> apply(fund, (2, 3, 4))
9
>>> f = lambda x, y, z: x + y + z
>>> apply(f, (2, 3, 4))
9

※ 但し、apply関数は Python3.0 で無くなる為、使用すべきでは無い。

使っているコードの移植方法は以下など。

2to3を使ってコードをPython 3に移植する - Dive Into Python 3 日本語版


  • map関数
    • 第一引数に渡された関数を、その後に指定されたシーケンスの個々要素に適用する関数
    • forステートメントでも同じような処理は書けるが、一般的にmap関数の方が処理が早くなる
>>> counters = [1, 2, 3, 4]
>>> def inc(x): return x + 10
…
>>> map(inc, counters)
[11, 12, 13, 14]

  • map関数と類似した関数: filter と reduce
    • filter関数
      • シーケンスの各要素から特定の条件に合うものを抽出する
    • reduce関数
      • まずシーケンスの1、2番目の要素を引数として関数を実行し、次にその結果得られた値と3番目の要素を引数として同じ関数を実行する
# filter
>>> filter((lambda x: x > 0), range(-5, 5))
[1, 2, 3, 4]

# reduce
>>> reduce((lambda x, y: x + y), [1, 2, 3, 4])
10

※ reduce関数は Python3.0 で functools に隔離されたようです


  • リスト内包表記
    • リスト内包表記内で ifステートメントや forステートメントのネストを利用すれば、ビルトイン関数を使用するよりも簡素なコードが書ける
# if を使ったリスト内包表記
>>> [x for x in range(5) if x % 2 == 0]
[0, 2, 4]

# filter関数を使うと以下の様になる
>>> filter((lambda x: x % 2 == 0), range(5))
[0, 2, 4]

>>> res = []
>>> for x in range(5):
…        if x % 2 == 0:
…            res.append(x)
…
>>> res
[0, 2, 4]
# for のネストを使ったリスト内包表記
>>> res = [x + y for x in [0, 1, 2] for y in [100, 200, 300]]
>>> res
[100, 200, 300, 101, 201, 301, 102, 202, 302]

# リスト内包表記を使わない場合の例
>>> res = []
>>> for x in [0, 1, 2]:
…        for y in [100, 200, 300]:
…            res.append(x + y)
…
>>> res
[100, 200, 300, 101, 201, 301, 102, 202, 302]

    • リスト内包表記は柔軟性、汎用性が高いがそのためにコードが難解になりやすいという欠点がある。(特にネストが行われた場合)
    • しかし現状は、読みにくいコードに「パフォーマンスの高さ」があるのも事実
    • forループ < map関数 < リスト内包表記 の順にパフォーマンスが高い
    • プログラムは keep it simple を心がけるべきなので、特にパフォーマンスが重要になる部分以外は、分かりやすい forループで記述するべきである

  • ジェネレータとイテレータ
    • ジェネレータ
      • いったん何らかの値を戻して、しばらく後にその時点から処理を再開する
      • ジェネレータ関数は実行が一時停止される。停止している間は「停止時の状態はどうだったか」「どこまで処理が進んだか」というステート情報が保持される
      • 通常の関数との違いは、返り値を yieldステートメントで返すという事
    • イテレータ
    • ジェネレータ式
      • イテレータとリスト内包表記を組み合わせたもの。式はリスト内包表記の [] を () に変えたもの
      • リスト内包表記とコードの持つ意味はほぼ同じだが、リスト内包表記は結果のリストを一度に作るのに対し、ジェネレータ式は反復処理により随時生成していく
>>> for num in (x ** 2 for x in range(4)):
…        print '%s, %s' % (num, num / 2.0)
…
0, 0.0
1, 0.5
4, 2.0
9, 4.5
      • ジェネレータ式を囲む () は、そのジェネレータ式が他の () の中に単独で存在する場合には付けなくてもかまわない
>>> sum(x ** 2 for x in range(4))
14

>>> sorted(x ** 2 for x in range(4))
[0, 1, 4, 9]

>>> sorted((x ** 2 for x in range(4)), reverse=True)
[9, 4, 1, 0]

>>> import math
>>> map(math.sqrt, (x ** 2 for x in range(4)))
[0.0, 1.0, 2.0, 3.0]
      • ジェネレータ式はリスト内包表記よりもやや遅い為、使うのは実行結果が膨大になる場合のみ使用するべきである

  • 関数を作る際のコツ
    • できる限り入力には引数、出力には returnステートメントを使用する(できる限り外から独立したものにする)
    • グローバル変数はどうしても必要な場合以外は使用しない
    • 引数が可変性オブジェクトの場合でも上書きしない(意図して設計されるものは別)
    • 関数の役割は一つに絞る
    • 関数はできる限り規模の小さいものにする
    • 他のモジュール変数に直接変更を加えない

>>> schedule = [ {echo, 'Spam!', {echo, 'Ham!'} }]
>>> for (func, arg) in schedule:
…         func(arg)
…
Spam!
Ham!

  • 関数についての注意事項
    • 変数がローカルスコープに属するかどうかはスタティックに決定される(defステートメントのどこかに代入の記述があれば、実行時ではなくコンパイル時にローカルスコープと定義される)
# case1
>>> x = 99
>>> def selector():
…        print x;    # グローバル変数として扱われる
… 
>>> selector()
99

# case2
>>> def selector():
…        print x
…        x = 88    # この記述があるので、xはコンパイル時にローカルスコープとして定義される
…
>>> selector()
存在しない変数を使用した旨の UnboundLocalError が表示される
    • 戻り値の無い関数
      • return, yield ステートメントを使用しない関数戻り値は None になる
      • こういった関数は他の言語で「プロシージャ」と呼ばれるものと同様の役割となる。通常、オブジェクトを上書きすることによって役割を果たす為、いわば副作用に依存して機能するものと言える
    • ネストスコープのループ
      • ループによって次々に変更が加えられていく変数の、ある時点での値を内側にネストされたコードで保持する、という場合には注意が必要。単純に外側の値を内側の変数に代入するコードを書いただけだと、内側の変数の値も外側の値とともに次々に変化する為

PrapatanPrapatan2012/02/20 19:05Thanks for sharing. What a peslarue to read!

brqiuabrqiua2012/02/21 18:11m13eDA <a href="http://qzenzrwhjkxr.com/">qzenzrwhjkxr</a>

ketdxqyketdxqy2012/02/22 00:52dpiZKx , [url=http://wtyptaaooelw.com/]wtyptaaooelw[/url], [link=http://biarxexnjoao.com/]biarxexnjoao[/link], http://ybmseavredhw.com/

xwvdaqsfgxwvdaqsfg2012/02/29 02:58XmZddh <a href="http://gwhqkyqzsvwp.com/">gwhqkyqzsvwp</a>

2011-12-14

はじめてのPython 15章 関数の基礎、16章 スコープと引数

00:47 | はじめてのPython 15章 関数の基礎、16章 スコープと引数 - taketin.py を含むブックマーク はてなブックマーク - はじめてのPython 15章 関数の基礎、16章 スコープと引数 - taketin.py

15章 関数の基礎

ステートメント、式
呼び出しmyfunc("spam", "eggs", meat=ham)
def, return, yielddef adder(a, b=1, *c): return a+b+c[0]
globaldef function(): global x; x='new'
lambdafuncs = [lambda x: x**2, lambda x: x*3]


  • returnステートメント
    • return は他の言語同様、値を返却して制御を戻す。
    • 関数内で returnステートメントを省略すると、Noneオブジェクトが返される。
  • yieldステートメント
    • 呼び出し側に値を戻した後もステートを保持し、処理を再開できるジェネレータと呼ばれる特殊な関数に用いられる。


  • globalステートメント
    • 関数内で定義された変数は、関数内飲みのスコープとなる。
    • モジュール全体で有効にしたい場合、globalステートメントを使用する。

  • defステートメントのネストと動的呼び出し
if test:
    def func():
        …
else:
    def func():
        …
…
func()

分岐によって関数の内容を変えるような記述が可能。


funcname = func
func()

変数関数名を代入する事で、関数オブジェクトリファレンスを代入する為、変数に()をつける事で呼び出しが可能。


16章 スコープと引数

  • スコープに関するルール


  • ネストスコープ
    • 関数1内で変数1と更に関数2が定義され、関数2内で変数1を呼び出す場合、ネストスコープとして特別な宣言無しで利用できる。ただし変更、代入を行う場合は global宣言が必要。
    • 以下のコードのようにすでに存在しない外側のスコープに属する変数を保持しているオブジェクトの事を「クロージャ」あるいは「ファクトリ関数」と呼ぶ
def f1():
    x = 88
    def f2():
        print x
    return f2    # f1() の返り値は f2() である

action = f1()
action()    # f2() が実行され、88 と表示される

  • lambda式
    • defステートメントと同じように関数を作るのに用いられる式
    • 式なのでリストやディクショナリのリテラルの中など、defステートメントが使えない場所で使用する事ができる


つまり、

不変性オブジェクト引数は、Cの「値渡し」引数に似ている。

可変性オブジェクト引数は、Cの「ポインタ渡し」引数に似ている。


  • 参照渡しと同様の結果を得る
    • Pythonには他言語でいう「引数の参照渡し」は無い。しかし同様の結果を得る書き方はできる
def multiple(x, y):
    x = 2
    y = [3, 4]
    return x, y

X = 1
L = [1, 2]
X, L = multiple(X, L)    # X, L の値は (2, [3, 4]) というタプルになる。元の変数の値にアンパック代入している。

  • 引数のバリエーション
    • 通常の引数 <位置によるマッチング>
      • どの位置に置かれているかを基準にマッチングが行われる
    • キーワード引数 <名前によるマッチング>
      • 関数呼び出し側のコードで、(引数 = 値) と指定する事ができる。この場合引数はdefステートメントの引数と名前によって対応付けられる
    • デフォルト値の設定
      • defステートメントのカッコ内で = という記号を使用すれば、引数デフォルト値を設定できる
    • 引数の数を自由に変えられるようにする
      • defステートメントのカッコ内で * という記号を使用すれば、呼び出し時に引数の数を自由に増やす事ができる(Cで言う可変引数に似ている)
    • 引数の数を呼び出し側で自由に変えられるようにする
      • 呼び出し側で * という記号を使えば、複数の引数を同時に渡す事ができる。

※ * が一つならタプル、二つならディクショナリに収められる

JoanaJoana2012/02/21 03:21To think, I was confused a mintue ago.

iidyhrkdiidyhrkd2012/02/21 19:36GExFmc <a href="http://ufqkcxuvcarx.com/">ufqkcxuvcarx</a>

bniisekobniiseko2012/02/22 01:33AdzhX0 , [url=http://bcxehnggfccs.com/]bcxehnggfccs[/url], [link=http://sfntkuxvllmq.com/]sfntkuxvllmq[/link], http://vugswbsuqada.com/

cejpukeucejpukeu2012/02/29 01:507c7Tyi <a href="http://wglslokygyvl.com/">wglslokygyvl</a>

2011-12-10

初めてのPython 13章 whileループとforループ 14章 Pythonのドキュメント

01:06 | 初めてのPython 13章 whileループとforループ 14章 Pythonのドキュメント - taketin.py を含むブックマーク はてなブックマーク - 初めてのPython 13章 whileループとforループ 14章 Pythonのドキュメント - taketin.py

13章 whileループとforループ

・while ループ

while <条件>:
    <ステートメント>
else:
    <ステートメント2>

else ブロックはオプションであり、breakで処理が終了した場合は実行されない


・break, continue, pass ステートメントと else ブロック

  • break
    • ステートメントが直接属するループを無条件で抜ける
  • continue
    • ステートメントが直接属するループの先頭(見出し行)に無条件で戻る
  • pass
  • else
    • 見出し行に指定された条件が満たされなくなり、ループが終了する際に実行される。break ステートメントによってループが終了される場合には実行されない

・for ループ

for ループはシーケンスオブジェクトなら何にでも使用できる

for <target> in <object>:
    <statements>
else:
    <statements>

処理対象のオブジェクトと代入ターゲットを指定し、その後繰り返し処理に対応するステートメントを書く

  • 代入ターゲットは通常 for ステートメントと同じ名前空間に属する変数として扱われる
  • ループ終了後も最後に代入された要素へのリファレンスを保持し続ける

アンパック代入

>>> T = [(1, 2), (3, 4), (5, 6)]
>>> for (a, b) in T:
…        print a, b
…
1 2
3 4
5 6

ファイルを対象とした反復処理

>>> f = open('script.py')
>>> f.readline()

# 現在はこれに良く似た機能を持つ next() というメソッドが用意されている
# readline との違いはファイルの末尾に到達した時に空文字列を返さず、
# StopIteration というビルトイン例外を発生させる点

>>> f = open('script.py')
>>> f.next()

# 更に現在のPythonはファイル内容を1行づつ読み込む際、読み込みメソッドを呼び出す必要が無い
# この方法は3つのメリットがある。コードがシンプル、実行速度が上がる、メモリ節約。
>>> for line in open('script.py'): # next() が自動的に呼ばれるprint line,

他のオブジェクトへの反復処理

  • for ループは内部動作として、処理対象のオブジェクト引数として iter() というビルトイン関数を呼び出している。これを明示的に書く事で for ループを記述せずにイテレーション処理をする事ができる。
>>> L = [1, 2, 3]
>>> I = iter(L)
>>> I.next()
1
>>> I.next()
2
>>> I.next()
3

特殊な forループ

  • range() を使う
>>> for i in range(3):
…        print i,
0
1
2

# シーケンスに対して変則的なアクセス
>>> S = 'abcdefghijk'
>>> range(0, len(S), 2)
[0, 2, 4, 6, 8, 10]

>>> for i in range(0, len(S), 2): print S[i],
a c e g i k

しかし実はスライシングでもっと効率良く書ける

>>> for x in S[::2]: print x

シーケンスを更新する forループ

>>> L = [1, 2, 3, 4, 5]
>>> for i in range(len(L)):
…        L[i] += 1
...
>>> L
[2, 3, 4, 5, 6]

通常の forループだと代入された変数の方を更新してしまうので、インデックスを使ってオリジナルの値を変更するようにする。


zip関数の利用

>>> L1 = [1, 2, 3, 4]
>>> L2 = [5, 6, 7, 8]
>>> zip(L1, L2)
>>> for (x, y) in zip(L1, L2):
…        print x, y, '--', x+y
…
1 5 -- 6
2 6 -- 8
3 7 -- 10
4 8 -- 12

zip関数を使ったディクショナリの生成と dict関数

>>> keys = ['spam', 'eggs', 'toast']
>>> vals = [1, 3, 5]
>>> zip(keys, vals)
[('spam', 1), ('eggs', 3), ('toast', 5)]

>>> D = {}
>>> for (k, v) in zip(keys, gals): D[k] = v
…
>>> D
{'toast':5, 'eggs':3, 'spam':1}

# dict関数を使えば forループを使用せずに同じ事ができる
>>> D2 = dict(zip(keys, vals))
>>> D2
{'toast':5, 'eggs':3, 'spam':1}

dict は正確には「ディクショナリオブジェクトコンストラクタ」である。


enumerate関数

>>> S = 'spam'
>>> for (offset, item) in enumerate(S):
…        print item, 'appears at offset', offset
…
s appears at offset 0
p appears at offset 1
a appears at offset 2
m appears at offset 3

enumerate関数はジェネレータと呼ばれるオブジェクトを返す。これは反復処理に対応したオブジェクトであり、nextメソッドを持っている為、イテレート処理を行える。


・リスト内包表記

# range() を使った記法
>>> L = [1, 2, 3, 4, 5]
>>> for i in range(len(L)):
…        L[i] += 10
…
>>> L
[11, 12, 13, 14, 15]

# リスト内包表記で書き直す
>>> L = [x +10 for x in L]
>>> L
[21, 22, 23, 24, 25]

リスト内包表記でしかできない事といのは無いが、以下のメリットがある。


ファイルに対してのリスト内包表記

>>> lines = [line.rstrip() for line in open('huge.py')]
>>> lines
['import sys', 'print sys.path', 'x = 2', 'print 2 ** 33']

リスト内包表記の拡張構文

# 先頭が p の行だけ取り出す
>>> lines = [line.rstrip() for line in open('hoge.py') if line[0] == 'p']
>>> lines
['print sys.path', 'print 2 ** 33']

# ループのネスト
>>> [x + y for x in 'abc' for y in 'lmn']
['al', 'am', 'an', 'bl', 'bm', 'bn', 'cl', 'cm', 'cn']

14章 Pythonのドキュメント

Python のドキュメントの種類

#プログラム中のコメント
dir関数引数に渡したオブジェクトの属性リストを返す
ドキュメンテーション文字列:__doc__コメント同様、プログラム中に組み込む
PyDoc:help関数テキストベースでドキュメントを表示する
PyDoc:GUIインターフェースWebブラウザにドキュメント表示
標準マニュアルセットPythonやツールセットに関する標準マニュアル
Webサイトオンラインチュートリアルリファレンスなど
書籍市販されている紙媒体の書籍

ドキュメンテーション文字列:__doc__


PyDoc:help関数


ステートメントについてのまとめ

  • コロンを忘れない
  • トップレベルのコードは字下げしない
  • 対話型コマンドラインでは空白行が意味を持つ
  • 字下げに一貫性を持たせる
  • C と混同しない(カッコやセミコロン
  • できる限り whileやrange()は使わず、単純なforループを使う
  • 可変性を持つオブジェクトの代入に注意する
  • オブジェクトの上書きを行う関数は値を戻さない
  • 関数を呼び出す際には必ずカッコを使用する
  • インポート、リロードの際には拡張子やパスは使用しない