设万维读者为首页 万维读者网 -- 全球华人的精神家园 广告服务 联系我们 关于万维
 
首  页 新  闻 论  坛 博  客 视  频 分类广告 购  物
搜索>> 发表日志 控制面板 个人相册 给我留言
帮助 退出
我的薄客  
自己的空间, 不薄没客  
        https://blog.creaders.net/u/15920/ > 复制 > 收藏本页
我的网络日志
我们的天使 2020-07-16 04:08:33

病毒仍然在肆虐着世界!

  人们在不知所措该如何面对病毒的时候,一位勇敢的美女科学家闫丽梦走了出来,告知世界这起病毒是如何被中共所掩盖,告知我们人类找到对付病毒的解药的唯一方法就是找到病毒到底是从哪里来的,到底是怎么来的。而这个凶险的病毒留给我们人类的时间不多了。

  我看了她的视频,我佩服她的勇气。是啊,不是所有人都敢像她这样冒着生命危险,出走美国,来到世界的舞台,唤醒毫不知情的人们。知道真相的不止她一个,还有那么多的男人,但是那些男人们在中共的强权下闭嘴,在中共的残酷吏治下早已经阳痿,毫无男儿的风范。就像她的丈夫,害怕中共的淫威下,不敢和她一起出走美国,不敢和她一起向世界讲述真相。还有她的导师Leo Poon,实验室的主任马利克等等,他们为求生、为求荣、为求利,选择和中共国沆瀣一气。男人的悲哀,不如我中华的一介女流!巾帼英雄真的不让须眉!

  网上也有人说她就是女版的李文亮,其实我觉得她比李文亮更需要勇气来做这件事。李文亮就是在微信朋友圈发了一条微信,好心地告知周围的同事和朋友出现传染病的真相,要亲朋好友小心的话,注意保护不好染上病。他压根就不知道他一句对亲朋好友小心的提示会给他带来训诫的结果,他无意成为吹哨人,更没有想到他训诫的结果会把他送上风头浪尖,更不会知道他会有生命的代价。而我们的女英雄,那就是明知有生命危险,也要出来唤醒懵懂无知的人们。她躲避中共的各种监控,她躲避可能的各种追杀,历经千难万险才来到了美国。上演了一个现实版的007!她就像一个天使,来拯救我们人类。


浏览(19) (0) 评论(0)
发表评论
Learned today 2018-11-30 09:19:27

Scientific wild-ass guess (SWAG) is an American English slang term meaning a rough estimate made by an expert in the field, based on experience and intuition. It is similar to the slang word guesstimate, a portmanteau of guess and estimate.

We are going to take swag at that.


Jump the gun: act before the proper time

浏览(125) (0) 评论(0)
暂不接受评论
Python Tips 2018-11-26 08:19:13

Enumerate is a built-in function of Python, which allows us to loop over something and have an automatic counter. 


for counter, value in enumerate(some_list):
    print(counter, value)


my_list = ['apple', 'banana', 'grapes', 'pear']for c, value in enumerate(my_list, 1):
    print(c, value)# Output:# 1 apple# 2 banana# 3 grapes# 4 pear


my_list = ['apple', 'banana', 'grapes', 'pear']
counter_list = list(enumerate(my_list, 1))
print(counter_list)
# Output: [(1, 'apple'), (2, 'banana'), (3, 'grapes'), (4, 'pear')]


 *args and **kwargs


*args and **kwargs are mostly used in function definitions. *args and **kwargs allow you to pass a variable number of arguments to a function. 


*args is used to send a non-keyworded variable length argument list to the function. 


def test_var_args(f_arg, *argv):
    print("first normal arg:", f_arg)
    for arg in argv:
        print("another arg through *argv:", arg)
        
test_var_args('yasoob', 'python', 'eggs', 'test')


first normal arg: yasoob
another arg through *argv: python
another arg through *argv: eggs
another arg through *argv: test


**kwargs allows you to pass keyworded variable length of arguments to a function. You should use **kwargs if you want to handle named arguments in a function. 


def greet_me(**kwargs):
    for key, value in kwargs.items():
        print("{0} = {1}".format(key, value))
        
>>> greet_me(name="yasoob")
name = yasoob


So here we will see how to call a function using *args and **kwargs. Just consider that you have this little function:

def test_args_kwargs(arg1, arg2, arg3):
    print("arg1:", arg1)
    print("arg2:", arg2)
    print("arg3:", arg3)

Now you can use *args or **kwargs to pass arguments to this little function. Here’s how to do it:

# first with *args
>>> args = ("two", 3, 5)
>>> test_args_kwargs(*args)
arg1: two
arg2: 3
arg3: 5

# now with **kwargs:
>>> kwargs = {"arg3": 3, "arg2": "two", "arg1": 5}
>>> test_args_kwargs(**kwargs)
arg1: 5
arg2: two
arg3: 3


Order of using *args **kwargs and formal args

So if you want to use all three of these in functions then the order is

some_func(fargs, *args, **kwargs)


The most common use case is when making function decorators. Moreover it can be used in monkey patching as well. Monkey patching means modifying some code at runtime. Consider that you have a class with a function called get_info which calls an API and returns the response data. If we want to test it we can replace the API call with some test data. For instance:

import someclass

def get_info(self, *args):
    return "Test data"
    
someclass.get_info = get_info


Object introspection

In computer programming, introspection is the ability to determine the type of an object at runtime. It is one of Python’s strengths. Everything in Python is an object and we can examine those objects. Python ships with a few built-in functions and modules to help us.

dir

It is one of the most important functions for introspection. It returns a list of attributes and methods belonging to an object. Here is an example:

my_list = [1, 2, 3]dir(my_list)# Output: ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',# '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__',# '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__',# '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__',# '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__',# '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__',# '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop',# 'remove', 'reverse', 'sort']

Our introspection gave us the names of all the methods of a list. This can be handy when you are not able to recall a method name. If we run dir() without any argument then it returns all names in the current scope.

type and id

The type function returns the type of an object. For example:

print(type(''))# Output: print(type([]))# Output: print(type({}))# Output: print(type(dict))# Output: print(type(3))# Output:

id returns the unique ids of various objects. For instance:

name = "Yasoob"print(id(name))# Output: 139972439030304


inspect module

The inspect module also provides several useful functions to get information about live objects. For example you can check the members of an object by running:

import inspectprint(inspect.getmembers(str))# Output: [('__add__', <slot wrapper '__add__' of ... ...

There are a couple of other methods as well which help in introspection.


浏览(260) (0) 评论(0)
暂不接受评论
 
关于本站 | 广告服务 | 联系我们 | 招聘信息 | 网站导航 | 隐私保护
Copyright (C) 1998-2020. CyberMedia Network /Creaders.NET. All Rights Reserved.