可能是小python包,只包含raise_if函数
raise_if的Python项目详细描述
[![构建
状态](https://travis ci.org/rochacbruno/raise_if.png)(https://travis ci.org/rochacbruno/raise_if)
[![覆盖范围
状态](https://coveralls.io/repos/rochacbruno/raise_if/badge.png)(https://coveralls.io/r/rochacbruno/raise_if)
![实用程序](https://img.shields.io/badge/utility-0%25 lightgrey.svg)
![emacs](https://img.shields.io/badge/build%20,带有emacs blue.svg)
[![forthebadge](http://forthebadge.com/images/badges/build with love.svg)](http://forthebadge.com)
[![forthebadge](http://forthebadge.com/images/badges/grein free.svg)(http://forthebadge.com)
[![forthebadge](http://forthebadge.com/images/badges/builded by developers.svg)(http://forthebadge.com)
如果python可以像ruby那样提升条件,那么就提升条件。
``ruby
def i\u必须有真理(值)
提升类型错误,如果value==false
end
``````
但是唯一有效的一行选项却伤害了pep8
```python
def i你必须拥有真理(value):
>如果没有value:raise typeerror('你必须给我真理')
`````
````python
>python
>
def
def=
end=
end``````是的我必须有一个真理(值):
raise-if(非值,typeerror,typeerror,你必须给我一个真理)
````` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `
raise-if(非1==2,typeerror,typeerror,'fails,'fails,'另一个arg'foo’)
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `)
```
为什么??
因为我很懒,我不喜欢if语句链中的额外中断!
:)
状态](https://travis ci.org/rochacbruno/raise_if.png)(https://travis ci.org/rochacbruno/raise_if)
[![覆盖范围
状态](https://coveralls.io/repos/rochacbruno/raise_if/badge.png)(https://coveralls.io/r/rochacbruno/raise_if)
![实用程序](https://img.shields.io/badge/utility-0%25 lightgrey.svg)
![emacs](https://img.shields.io/badge/build%20,带有emacs blue.svg)
[![forthebadge](http://forthebadge.com/images/badges/build with love.svg)](http://forthebadge.com)
[![forthebadge](http://forthebadge.com/images/badges/grein free.svg)(http://forthebadge.com)
[![forthebadge](http://forthebadge.com/images/badges/builded by developers.svg)(http://forthebadge.com)
如果python可以像ruby那样提升条件,那么就提升条件。
``ruby
def i\u必须有真理(值)
提升类型错误,如果value==false
end
``````
但是唯一有效的一行选项却伤害了pep8
```python
def i你必须拥有真理(value):
>如果没有value:raise typeerror('你必须给我真理')
`````
````python
>python
>
def
def=
end=
end``````是的我必须有一个真理(值):
raise-if(非值,typeerror,typeerror,你必须给我一个真理)
````` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `
raise-if(非1==2,typeerror,typeerror,'fails,'fails,'另一个arg'foo’)
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `)
```
为什么??
因为我很懒,我不喜欢if语句链中的额外中断!
:)