首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

女博士?or女硕士?This is a question

2018-07-16-14.00

女博/硕士?的内心独白

01

今天是假装深沉day

思考了以下这个问题,哎,依然无解啊……大概需要接下来以下不断地反复问自己以及不断地用实践去检验自己吧……hhh还有今天test一下赞赏功能hhhhh

今天依然没有口语部分,跟大家分享一下,我今天的python基础学习日记!

Advanced Python Objects, map()

1.Advanced Python Objects

While functions play a big role in the Python ecosystem, Python does have classes which can have attached methods, and be instantiated as objects.

First, you can define a class using a class keyword, and ending with a colon.

Anything indented below this, is within the scope of the class.

An example of a class in python:

class Person: department = 'School of Information' #a class variable def set_name(self, new_name): #a method self.name = new_name def set_location(self, new_location): self.location = new_location

person = Person()person.set_name('Christopher Brooks')person.set_location('Ann Arbor, MI, USA')print('{} live in {} and works in the department {}'.format(person.name, person.location, person.department))

output:Christopher Brooks live in Ann Arbor, MI, USA and works in the department School of Information

First, objects in Python do not have private or protected members.

Second, there's no need for an explicit constructor when creating objects in Python.

If you're more interested in python objects, I'd recommend checking out the Python documentation from the Python tutorial.

2.map()

The map function is one of the basis for functional programming in Python. The first parameters of function that you want executed, and the second parameter, and every following parameter, is something which can be iterated upon.

With map, we can do this comparison in a single statement.

map(function,iteration,……)

store1 = [10.00, 11.00, 12.34, 2.34]store2 = [9.00, 11.10, 12.34, 2.01]cheapest = map(min, store1, store2)cheapest

we see that we get an odd reference value instead of a list of items that we're expecting. This is calledlazy evaluation. In Python, the map function returns to you a map object. Itdoesn't actually tryand run the function min on two items, until you look inside for a value.

This is an interesting design pattern of the language, and it's commonly used when dealing with big data. This allows us to have very efficient memory management, even though something might be computationally complex.

for item in cheapest: print(item)

9.0 11.0 12.34 2.01

Excercise for map():

Here is a list of faculty teaching this MOOC. Can you write a function and apply it using map() to get a list of all faculty titles and last names (e.g. ['Dr. Brooks', 'Dr. Collins-Thompson', …]) ?

people = ['Dr. Christopher Brooks', 'Dr. Kevyn Collins-Thompson', 'Dr. VG Vinod Vydiswaran', 'Dr. Daniel Romero']def split_title_and_name(person): return person.split(' ')[0]+person.split(' ')[2]list(map(split_title_and_name,people))

Lambda and List Comprehensions

1.Lambda

Lambda's are Python's way of creating anonymous functions. These are the same as other functions, but they have no name.

The intent is that they're simple or short lived and it's easier just to write out the function in one line instead of going to the trouble of creating a named function.

my_function = lambda a, b, c : a + bmy_function(1, 2, 3)

-> 3

Exercise:

people = ['Dr. Christopher Brooks', 'Dr. Kevyn Collins-Thompson', 'Dr. VG Vinod Vydiswaran', 'Dr. Daniel Romero']def split_title_and_name(person): return person.split()[0] + ' ' + person.split()[-1]#option 1for person in people: print(split_title_and_name(person) == (lambda x: x.split()[0] + ' ' + x.split()[-1])(person))#option 2list(map(split_title_and_name, people)) == list(map(lambda person: person.split()[0] + ' ' + person.split()[-1], people))

pay attention to (lambda x:operation)(input)

Note that you can't have default values for lambda parameters and you can't have complex logic inside of the lambda itself because you're limited to a single expression.

2.list comprehensions

Python has built in support for creating these sequences using a more abbreviated syntax called list comprehensions.

Sequences are structures that we can iterate over. We've learned a lot about sequences and in Python. Tuples, lists, dictionaries and so forth.

Let's iterate from 0 to 999 and return the even numbers use loop.

my_list = []for number in range(0, 1000): if number % 2 == 0: my_list.append(number)my_list

use list comprehension

my_list = [number for number in range(0,1000) if number % 2 == 0]my_list

Exercise:

def times_tables(): lst = [] for i in range(10): for j in range (10): lst.append(i*j) return lsttimes_tables() == [j*i for i in range(10) for j in range(10)]

今日吐槽

歌词大意是(哈哈哈哈哈哈哈,让我笑一会先,谨以此歌献给读博或者没读博却忙得跟狗一样的单身狗们):

장가갈 수 있을까 장가갈 수 있을까

能娶到媳妇儿吗 能娶到媳妇儿吗

올해도 가는데 장가갈 수 있을까

今年又要过去了 我能娶到媳妇儿吗

누굴 만난다는 건 어려운 일이야

找个人交往 可真是件难事儿啊

남들처럼 그렇게 장가 갈 수 있을까

我也能像别人那样娶到媳妇儿吗

내 친구들 하나 둘 씩 떠나가고

我的朋友们也都一个两个地成家了

설마했던 그 친구마저 떠난다

曾觉得不可能娶到媳妇儿的那位也都成家了

운명적인 사랑도 잘 모르겠고

不懂什么是命中注定的爱情

여자 맘은 진짜 진짜 모르겠다

也真的真的不懂女人的心

장가갈 수 있을까 장가갈 수 있을까

能娶到媳妇儿吗 能娶到媳妇儿吗

통장 잔고 없는데 장가갈 수 있을까

存折里没有钱 我能娶到媳妇儿吗

누굴 만난다는 건 어려운 일이야

找个人交往 可真是件难事儿啊

남들처럼 그렇게 장가 갈 수 있을까

我也能像别人那样娶到媳妇儿吗

시집갈 수 있을까 시집갈 수 있을까

能嫁出去吗 能嫁出去吗

올해도 가는데 시집갈 수 있을까

今年也快过去了 我能嫁出去吗

누굴 만난다는 건 어려운 일이야

找个人交往 可真是件难事儿啊

남들처럼 그렇게 시집 갈 수 있을까

我也能像别人那样嫁出去吗

이러다 평생 혼자 사는 거 아냐

这样下去是不是要孤独终老

다시 사랑이란걸 할 수 있을까

我能再爱吗

소녀 같던 내 순수함 어디갔나

我纯真的少女心去哪儿了

여자 맘은 나도 내가 모르겠다

女人心连我自己都不懂

장가갈 수 있을까 (시집갈 수 있을까)

我能娶到媳妇儿吗(我能嫁出去吗)

장가갈 수 있을까 (시집갈 수 있을까)

我能娶到媳妇儿吗(我能嫁出去吗)

올해도 가는데 (올해도 가는데) 장가

今年也快过去了(今年也快过去了)

장가갈 수 있을까 (시집갈 수 있을까)

我能娶到媳妇儿吗(我能嫁出去吗)

누굴 만난다는 건 (누굴 만난다는 건) 어려운 일이야 (어려운 일이야)

找个人交往(找个人交往)可真是件难事儿啊(可真是件难事儿啊)

남들처럼 그렇게 (남들처럼 그렇게) 장가갈 수 있을까 (시집갈 수 있을까)

我也能像别人那样(我也能像别人那样)娶到媳妇儿吗(嫁出去吗)

언젠간 우리도 장가갈거야 시집갈거야

总有一天我们也会娶到媳妇儿的(嫁出去的)

우린 꼭 갈거야

我们一定可以的

快被今天的歌笑死了

笑死之后就是一种淡淡的忧伤,每次和师兄师姐们讨论研究问题都会觉得深深的绝望,这次暑期学校好不容易建立起来的一丢丢读博信念啊(大概建立起来了一点点吧?,至于哪来的自信,我也不知道),不过现在又没了……

今天早上去听讲座,最近听讲座都没有之前认真了,刚开始的讲座,笔记记得满满,但是现在:呵……上课刷淘宝……不过明天是Eric Zheng !!!我男神!次于吴恩达的男神,嘤,好喜欢这样的逻辑脑力魅力技术IT金融医疗样样拿手的理工笑起来眯眯眼可爱的男人啊!哈哈哈,一定认真听并且做笔记!

下午去了电信去要数据……感觉……呵……要数据……真的……好难啊……人家真的好拖延啊……师姐说不要把以后的研究寄期望于数据上,哪怕披荆斩棘拿到了电信数据,后面还有一个更难搞、更盛气凌人的卫计委……等着我…………真的是吓得我不想读博,因为目前的所有研究问题都是基于这两个数据啊,你妹!(不好意思,突然暴燥)

不过最近要数据,和高一级的人尬聊技能掌握,至少我终于get了要等人家回你了再提需求,否则我的留言很可能石沉大海……

然后晚上去中院的时候,就问了一个办公室的学长和老师,有个学长开玩笑说为了混口饭吃……然后刚要劝我,女孩子就不要读的时候,被师兄打住了hhhhh,然后口风一转:读博是因为热爱!说自己每天一想到论文和研究问题做梦都能笑出来。说完这句话,学长大喊了一句:雷!不许劈我!

哈哈哈哈哈哈哈,学长们好搞笑,然后在读博的老师学长跟我说:你要想好自己是否喜欢研究,不用担心是否能够毕业,如果你真的喜欢,你就会付出比别人更多的努力,那么总是会有回报的。人家一份功夫,你付出两份,总会毕业的,读博这件事是独立的一件事,不会有什么其他的依托。

虽然觉得老师学长说得对,但看着别的同学跟着导师已经投了文章,或者说已经拿着数据在进行中,又或者不用担心数据,而是很踏实地再看文献,也会觉得羡慕吧。但我觉得我最大的问题在于:我总是担心自己现在做的东西会是无用功,于是拒绝投入。但或者对于读博,我这样的惰性是不对的吧。我总是羡慕那些很厉害的大牛们什么方面都有所了解,哪怕不深入也掌握了核心,不会随意被人忽悠,大概这就是他们以前在做我所以为的“无用功”积累下来的吧。

我其实还蛮心虚的,因为别人问我为什么要读博,是否热爱的时候,我是回答不出来的。但我觉得思考研究问题的过程中,我似乎会获得成就感?但是我知道我的目标其实就是以前想的“我想去高校啊”,此处应该给爱辉老师献花,嘤,真的好喜欢爱辉啊,超感谢他当时特别单纯没有防备得为我担保出国呀♥。也算是爱辉老师的“工资条”?埋下了我想去高校的种子?(哈哈哈哈哈哈哈哈,赌博的理由真的很不高尚)……其实也是因为不想去工作,我以前以为高校的圈子会简单很多,但现在发现不是的,social无处不在,学术圈子的social的分级更加可怕。叹气……但是还是想读博啊,不过可能我需要更加审慎地去思考这个问题吧。

最后,是自己最近很喜欢的一句话:如临深渊、如履薄冰。是胡大一在他的医学书中对医生道德的要求,我觉得我这种跳脱的性子,也真的很需要这句话啊。

哎,一个女博士?or一个女硕士?的内心独白hhh,希望可以一起成长啊,大家晚安,么么哒……

7.16

晚安

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20180716G1RY0R00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

相关快讯

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券