range(n): A Deceptively Complex Program
I’ve been itching to write this article since I authored python vs Copy on Write last year. To recap, I found myself awake at 4 AM trying to performance tune the cache on a long running ETL written in...
View ArticlePython小问题汇总
现在的时间适合写点最近的小总结,这中间涉及到python/git等问题,我就从python先说起吧. 一、Python 1. Python的异常处理 因为想到自己不断尝试写小程序的话会用到抛出异常信息来判断哪里出现了问题: usage: raise [Exception [, args [, trackback]]] 上面是Python的raise的用法,下面是自己用这个方法实现异常的抛出方法: 1...
View Article实现一个编译器
最终效果 动态类型, 内置int,str,list,dict(from python), function function执行后可以保留内部的变量. 不想自己实现这么多类型,用python来实现 整个语言基于Auto变量,所以两句话就可以跑起编译器 a = Auto(open("hello.pym").read(), name='__main__') a.call() call会执行几个过程:...
View ArticleInplace vs Standard Operators in Python
Inplace Operators Set 1, Set 2 Normal operators does the simple assigning job. On other hand, Inplace operators behave similar to normal operators except that they act in a different manner in case of...
View ArticlePython pandas 0.19.1 Intro to Data Structures 数据结构介绍 文档翻译
python pandas 0.19.1 Intro to Data Structures 数据结构介绍 文档翻译 1小时前来源:cnblogs 我们将以一个快速的、非全面的pandas的基础数据结构概述来开始。应用在所有对象的数据类型、索引和轴标签/对齐等的基础操作。首先我们需要向你的命名空间引入numpy和pandas。 In [1]: import numpy as np In [2]:...
View ArticlePython与MongoDB
python与MongoDB 一点号编程派6小时前 在Python应用中需要一个什么样的与语言本身一样灵活的数据库呢?比如MongoDB。 译者:j_hao104 英文原文: 中文译文:https://my.oschina.net/jhao104/blog/812002...
View ArticlePython第一天――入门Python(1)数据定义
数据类型: 什么是数据? 在计算机科学中,数据是指所有能输入到计算机并被计算机程序处理的符号的介质的总称,是用于输入电子计算机进行处理,具有一定意义的数字字母、符号和模拟量等的统称。现在计算机存储和处理对象十分广泛,表示这些对象的数据也随之变得越来越复杂。 举个例子:...
View ArticleTop 10 tech trends for 2017
Technology is currently the most trending topic on the Internet. Especially the field of Artificial Intelligence (AI). To keep the hand on the pulse, it is smart to be aware of the emerging trends. In...
View ArticleA new pure functional language built on the top of Python
lambdascript A new pure functional language built on the top of python3. Warning: this is an alpha release; the core of the interpreter is working and should give a precise idea of the language, but...
View ArticleGo tops Java, C, Python for programming language of the year
Google's Go was 2016's biggest gainer in Tiobe's index of language popularity, as the top titles on the list all slipped year over year. Claiming the crown of Tiobe's programming language of the...
View ArticlePython函数的参数
作者:杨冬 欢迎转载,也请保留这段声明。谢谢! 出处: https://andyyoung01.github.io/ 或 http://andyyoung01.16mb.com/ 各种语言都有它自己特定的函数参数定义方法。python对于函数参数的定义非常灵活,它提供了三种定义函数参数的方式。 1. Positional arguments位置参数...
View ArticleDavid Rader: How to: Pick a PostgreSQL Python driver
Using Postgres with python is easy and provides first class database capabilities for applications and data processing. When starting a new project, you need to choose which PostgreSQL python driver to...
View ArticleSideload JSON API resources in Django
ByMatt Layman on January 10, 2017 I’m a big proponent of using a framework to reduce the time required to make something useful. Occasionally, using a framework means that developers must explore to...
View ArticleDay1-python理论基础
一、python介绍 Python 的创始人为Guido van Rossum。Guido为了打发圣诞节的无趣,于1989年发明,在荷兰国家数学和计算机科学研究所设计出来的(作为ABC 语言的一种继承),之所以起名Python,是因他是Monty Python的喜剧团体的爱好者。 Python第一个公开发行版发行于1991年。...
View ArticleAlexa skills and intents
Alexa Skills andIntents This is the third article about my journey creating a custom Alexa skill. I’ve set up a very, very basic skill and given it some DynamoDB storage . Now I want to make it a...
View Articlepygo: Interpreters in Go and for Go
View the slides Go is a great general purpose programming language and it is thus no surprise it can be a great fit for science work. Indeed, Go provides an efficient and quick edit/compile/run...
View Article基于cookie的django-rest-jwt认证
关于JWT(Json Web Token)是一种较新的用户认证方式,官网在 这里 ,网上有篇中文解释写的很好, 点此跳转 。 用户认证(Authentication)和用户授权(Authorization)是两个不同的概念,认证解决的是“有没有”的问题,而授权解决的是“能不能”的问题。...
View ArticlePython全栈之路系列之字符串数据类型
字符串(str) 字符串类型是python的序列类型,他的本质就是字符序列,而且python的字符串类型是不可以改变的,你无法将原字符串进行修改,但是可以将字符串的一部分复制到新的字符串中,来达到相同的修改效果。 创建字符串类型可以使用单引号或者双引号又或者三引号来创建,实例如下: 单引号 >>> string = 'ansheng' # type是查看一个变量的数据类型...
View ArticleCheat Sheet: Python For Data Science
Starting to learn a new programming language is never easy. And for aspiring data scientists, this can even be more so ― most of the times, they come from different kinds of fields of study, or they...
View ArticleMovingAverage-滑动平均
MovingAverage 可翻译为滑动平均或移动平均,是做时间序列预测时用到的简单方法。 计算方法:对于一个给定的数列,首先设定一个固定的值k,然后分别计算第1项到第k项,第2项到第k+1项,第3项到第k+2项的平均值,依次类推。 下面代码取自TensorFlow源代码: class MovingAverage { public: explicit MovingAverage(int...
View Article