mirror of
https://github.com/pocketpy/pocketpy
synced 2026-03-22 05:00:17 +00:00
Compare commits
1 Commits
53f0164b7e
...
2078b72ab2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2078b72ab2 |
@ -60,18 +60,16 @@ def filter(f, iterable):
|
||||
if f(i):
|
||||
yield i
|
||||
|
||||
class zip:
|
||||
def __init__(self, *iterables):
|
||||
self.iterables = [iter(it) for it in iterables]
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
result = []
|
||||
for it in self.iterables:
|
||||
result.append(next(it))
|
||||
return tuple(result)
|
||||
def zip(a, b):
|
||||
a = iter(a)
|
||||
b = iter(b)
|
||||
while True:
|
||||
try:
|
||||
ai = next(a)
|
||||
bi = next(b)
|
||||
except StopIteration:
|
||||
break
|
||||
yield ai, bi
|
||||
|
||||
def reversed(iterable):
|
||||
a = list(iterable)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -2301,9 +2301,6 @@ static Error* _compile_f_args(Compiler* self, FuncDecl* decl, bool is_lambda) {
|
||||
int state = 0; // 0 for args, 1 for *args, 2 for k=v, 3 for **kwargs
|
||||
Error* err;
|
||||
do {
|
||||
// allow trailing comma
|
||||
if(!is_lambda && curr()->type == TK_RPAREN) break;
|
||||
|
||||
if(state >= 3) return SyntaxError(self, "**kwargs should be the last argument");
|
||||
if(match(TK_MUL)) {
|
||||
if(state < 1)
|
||||
|
||||
@ -156,17 +156,6 @@ def f(a,
|
||||
|
||||
assert f(1, 2) == 3
|
||||
|
||||
|
||||
# https://github.com/pocketpy/pocketpy/issues/458
|
||||
def f(
|
||||
x: int,
|
||||
y: int,
|
||||
):
|
||||
return x + y
|
||||
|
||||
assert f(1, 2) == 3
|
||||
|
||||
|
||||
# try:
|
||||
# f(a=1)
|
||||
# exit(1)
|
||||
|
||||
@ -381,21 +381,6 @@ for x, y in zip(d, e):
|
||||
# verify that original order and values are retained.
|
||||
assertEqual(x is y, True)
|
||||
|
||||
# https://github.com/pocketpy/pocketpy/issues/447
|
||||
names = ["Alice", "Bob", "Charlie"]
|
||||
ages = [25, 30, 35]
|
||||
cities = ["NY", "LA", "SF"]
|
||||
result = []
|
||||
for name, age, city in zip(names, ages, cities):
|
||||
result.append((name, age, city))
|
||||
assertEqual(result, [("Alice", 25, "NY"), ("Bob", 30, "LA"), ("Charlie", 35, "SF")])
|
||||
|
||||
cities.pop()
|
||||
result = []
|
||||
for name, age, city in zip(names, ages, cities):
|
||||
result.append((name, age, city))
|
||||
assertEqual(result, [("Alice", 25, "NY"), ("Bob", 30, "LA")])
|
||||
|
||||
########### test repr#############
|
||||
d = deque(range(200))
|
||||
e = eval(repr(d))
|
||||
|
||||
@ -187,27 +187,10 @@ DEALINGS IN THE SOFTWARE.
|
||||
}
|
||||
|
||||
#run-button {
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
padding-bottom: 1px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
background-color: #007bff;
|
||||
color: #ffffff;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
outline: none;
|
||||
user-select: none;
|
||||
}
|
||||
#run-button:hover,
|
||||
#run-button:focus {
|
||||
background-color: #0056b3;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
#run-button:active {
|
||||
background-color: #004085;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
transform: translateY(1px);
|
||||
}
|
||||
|
||||
#code-editor.hljs {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user