Essential Python Interview Questions

由 Toptal 出的 python interview 问题,其中几个关键的分别为,1. 函数默认值的传值问题,默认值只在函数定义时执行过一次。2. lambda 闭包函数中的 late binding 问题,循环中只取最新的一个值,可以通过 generator,将 [] 换成 () ,解决。3. Python 继承类中的赋值问题,类的属性是以 dict 的形式保存,当子类中的属性不存在时,则向父类递归查询,直到查到或抛出 AttributeError 为止。当更改父类的属性时,若子类属性未做变更,查询子类相关属性时返回的未父类的属性值。4. [[]] * N 的操作并未生成包含 N 个 Item 的list,而是 N 个对应的引用,所以当改变某个 item 中的值时,改变的是其中所有 item 的值。

Essential Python Interview Questions

comments powered by Disqus

Tags

abcs accept acid activemq affinity algorithm allocation android array async aws b+tree b-tree backoff benchmark best-practices bfs big-o bigquery bind bitcount blog break broker bubble buffer cache cap cert cgroups channel citus class classmethod closure closures cluster concurrency config consumer container context cookie cors crawler cronjob csrf ctr data-science data-structure database datadog dataflow datascience decorator defer dfs distributed django dns docker double-shipping drf ecosia elastic-search enumerate epoll errgroup escaping extra fabric2 facebook-pixel financial-report flask flutter forward-proxy freelance frontend frp garbage-collector gc gcp generator gesture get gil git golang goroutine graphql ha handbook haproxy hash hash-slot hashring hashtable hpa http http-auth http-proxy http_proxy https index init innodb instagram intergration interview ios javascript jinja2 jobboard jwt k8s kafka kibana kqueue label lambda layer4 layer7 lean levels.io linked-list linux list listen loadbalancer logs long-tail lru marketing master matplotlib memory merge metaclass metaprogramming metrics metrics-server microservices mitm mobile model mq myisam mysql namespace nat netflix network network-extension nginx nodejs nomad nosql npm oodesign openssl optimization orm osi pandas parallelism paramiko parkinglot patroni permission pg pipeline pixelme post postgresql postresql prefetch_related prerender private-key process proxy proxycommand put pvm python queue rabbitmq rbac react-native reactive reactjs rebase redis redis-cluster replication resource rest restfulapi retargeting retry revenue reverse-proxy rocketmq rsa rxswift saas scaffold scaleable search-engine security select seo serverless service session set shadosocks shadowsocks shard sharding shell shopify sigint signal sigterm slack slave slow-query sniper sns socket socks5 source-code spa sql sqlalchemy sqs ssh ssl ssl-pinning stack startup state stateful stateless staticmethod string struct swift swiftui switch syscall system-design systemctl tcp tcp-proxy thread tmpreaper token traefik trustkit tunning type typeform udp userdefaults variable vc voidcallback vpn vuejs weak web web-development where widget yarn zset 削峰 宽索引 异步 看源码学-golang 窄索引 解耦 跨域 跳板机



Archives

2020 (1)
2019 (157)