semvec/pypi-packages huggingface dataset:
Code1v1 0.0.9
Code 1v1 是 AI悦创·致力推广编程教学而研发的教学库
License: MIT
Requires Python: >=3.6.0


📦 Code1v1 (for Bornforthis)
=======================
你好，我是悦创。
Hello, this is Yue Chuang.

如果你对 Python 库开发比较熟悉且有兴趣一起研发和优化，欢迎👏发提交 issues 申请。[https://github.com/AndersonHJB/Code1v1/issues](https://github.com/AndersonHJB/Code1v1/issues)。

If you are familiar with Python library development and are interested in working together to develop and optimize it, please submit an issues request at 👏.[https://github.com/AndersonHJB/Code1v1/issues](https://github.com/AndersonHJB/Code1v1/issues)

欢迎提交 Pull requests。

You are welcome to submit Pull requests.

## Links

- Github: [https://github.com/AndersonHJB/Code1v1](https://github.com/AndersonHJB/Code1v1)
- Pypi: [https://pypi.org/project/Code1v1/](https://pypi.org/project/Code1v1/)
- 官方文档：[https://bornforthis.cn/Code1v1/](https://bornforthis.cn/Code1v1/)


## Installation

### MacOS

```bash
pip3 install Code1v1
```
### Windows

```bash
pip install Code1v1
```


## More Resources


- [What is Code1v1?](https://bornforthis.cn/Code1v1/)


## License


This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any means.

## Contact Me

### Wechat

![img_1.png](https://github.com/AndersonHJB/Code1v1/raw/main/img.png)

### Email:aiyuechuang@gmail.com
break-out-nested 0.10
Break out of nested loops with max. 4 lines of code, no matter how deeply they are nested
License: MIT
Keywords: itertools,nested,loops,break,break out


# Break out of nested loops with max. 4 lines of code, no matter how deeply they are nested 


## The problem: breaking out of nested loops 

#### pip install break-out-nested 

```python
# Break out of nested loops - a pain in the ***
# How it is usually done:
done = False
for i in range(1, 6, 1):  # 1st loop
    print('i:', i)
    for j in range(1, 11, 2):  # 2nd loop
        print('   i, j:', i, j)
        for k in range(1, 21, 4):  # 3rd loop
            print('      i,j,k:', i, j, k)
            if i % 3 == 0 and j % 3 == 0 and k % 3 == 0:
                done = True
                break  # breaking from 3rd loop
        if done: break  # breaking from 2nd loop
    if done: break  # breaking from 1st loop
```



## The solution

```python
# Way easier
from break_out_nested import it, bol

# you need to create new variables as attributes of it,
# because break_out_nested has only access to these variables
it.i, it.j, it.k = 1, 1, 1


# the break condition
def cond(): return it.i % 3 == 0 and it.j % 3 == 0 and it.k % 3 == 0


# The condition will be checked in each loop
# The function that checks the condition has to be passed as the last argument. 
# You can pass as many iterables as you want to the function
for it.i, it.j, it.k in bol(range(1, 6, 1), range(1, 11, 2), range(1, 21, 4), cond):
    print(it.i, it.j, it.k)
```



## More examples

```python
# More examples
def cond(): return it.i + it.j + it.k == 777


it.i, it.j, it.k = 0, 0, 0
for it.i, it.j, it.k in bol(range(100), range(1000), range(10000), cond):
    print(it.i, it.j, it.k)


def cond(): return it.i + it.j + it.k >= 100000


it.i, it.j, it.k = 0, 0, 0
# you don't have to use it.i, it.j, it.k as the loop variables, you can
# use anything you want, but you have to update the variables somewhere
for i, j, k in bol(range(100), range(1000), range(10000), cond):
    it.i, it.j, it.k = i * 10, j * 100, k * 100
    print(it.i, it.j, it.k)
```