社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

Python函数里的爱情故事

编程派 • 8 年前 • 949 次点击  

全文约 3200 字,读完可能需要 4 分钟。

一直被拒型

  1. def my_love_story():

  2.    for girl in every_girl_I_liked:

  3.        response = declare_love(girl)

  4.        if response != "NO":

  5.            raise RunTimeError("There must be something wrong with the                 girl.")

孤单型

  1. def my_love_story():

  2.    return None

自己动手型

  1. def my_girl_friend():

  2.    return "Right Hand"

或者




    
  1. import random

  2. def my_girl_friend():

  3.    my_girl_friends = ["Left Hand", "Right Hand"]

  4.    return random.choice(my_girl_friends)

风流型

  1. def my_love_story():

  2.    for girl in every_girl_I_have_met:

  3.        sleep_with(girl)

一见钟情型

  1. def my_love_story():

  2.    assert love_at_first_sight(my_girl_friend) is True

钟爱一生型

  1. def my_love_story():

  2.    girl = met_a_girl ()

  3.    girl_friend = dated_her(girl)

  4.    wife = got_married(girl_friend)

  5.    mother = had_a_child(wife)

  6.    assert girl is girl_friend is wife is mother

寻找真爱型

  1. def my_love_story():

  2.    girl = find_someone()

  3.    while not is_the_one(girl):

  4.        girl = find_someone()

  5.    live_happily_ever_after()

韩剧型

  1. def my_love_story():

  2.    assert me.is_wealthy()

  3.    assert me.is_handsome()

  4.    assert me.is_tall()

  5.    girl = someone_I_met_at_a_random_party()

  6.    me.hate(girl)

  7.    me.fell_in_love_with(girl)

  8.    girl.ex_boy_friend is jerk

  9.    me.fight(girl.ex_boy_friend)

  10.    me.date(girl)

  11.    me.mother.hate(girl)

  12.    me.mother.find_me_another_girl()

  13.    me.break_up_with_my_family()

  14.    girl .got_cancer()

  15.    me.is_devastated()

  16.    me.mother.give_money_to(me)

  17.    me.mother.accept(girl)

  18.    girl.is_cured()

  19.    me.kiss(girl)

  20.    the_end()

相亲型

  1. def my_love_story():

  2.    available_girls = filter(who_does_not_mind_my_poverty, girls_my_mother_set_me_up())

  3.    marry(biggest_boobs(available_girls))

现实型

  1. def my_love_story():

  2.    girl = met_a_girl()

  3.    girl_friend = fell_crazy_in_love(girl)

  4.    with before_getting_married(girl_friend):

  5.        if not all([me.have_a_house, me.have_a_car, me.have_a_lot_of_money]):

  6.            girl_friend.break_up_with(me)

我爱的人和爱我的人型

  1. def my_love_story():

  2.    for girl in every_girl_that_loved_me:

  3.        me.reject(girl)

  4.    for girl in every_girl_that_I_loved:

  5.        girl.reject(me)

暗恋型

  1. def my_love_story():

  2.    places_I_have_been = [classrooms, companies, supermarkets, restaurants, trains, hotels_I_stayed]

  3.    for girl in the_most_beautiful_girl():

  4.        me.fell_in_love_with(girl)

  5.        girl.never_notice(me)

If u rd al abv, and udrstnd tm, chncs r u dnt hv a grl frnd.

原文:http://cizixs.com/2015/04/19/love-story-in-a-python-function


题图:pexels,CC0 授权。

点击阅读原文,查看更多 Python 教程和资源。


今天看啥 - 高品质阅读平台
本文地址:http://www.jintiankansha.me/weixin/f8cqf2ZaMY
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/1934
 
949 次点击