|
351 | 351 | Traceback (most recent call last):
|
352 | 352 | SyntaxError: invalid syntax
|
353 | 353 |
|
| 354 | +>>> def foo(/,a,b=,c): |
| 355 | +... pass |
| 356 | +Traceback (most recent call last): |
| 357 | +SyntaxError: at least one argument must precede / |
| 358 | +
|
| 359 | +>>> def foo(a,/,/,b,c): |
| 360 | +... pass |
| 361 | +Traceback (most recent call last): |
| 362 | +SyntaxError: / may appear only once |
| 363 | +
|
| 364 | +>>> def foo(a,/,a1,/,b,c): |
| 365 | +... pass |
| 366 | +Traceback (most recent call last): |
| 367 | +SyntaxError: / may appear only once |
| 368 | +
|
| 369 | +>>> def foo(a=1,/,/,*b,/,c): |
| 370 | +... pass |
| 371 | +Traceback (most recent call last): |
| 372 | +SyntaxError: / may appear only once |
| 373 | +
|
| 374 | +>>> def foo(a,/,a1=1,/,b,c): |
| 375 | +... pass |
| 376 | +Traceback (most recent call last): |
| 377 | +SyntaxError: / may appear only once |
| 378 | +
|
| 379 | +>>> def foo(a,*b,c,/,d,e): |
| 380 | +... pass |
| 381 | +Traceback (most recent call last): |
| 382 | +SyntaxError: / must be ahead of * |
| 383 | +
|
| 384 | +>>> def foo(a=1,*b,c=3,/,d,e): |
| 385 | +... pass |
| 386 | +Traceback (most recent call last): |
| 387 | +SyntaxError: / must be ahead of * |
| 388 | +
|
| 389 | +>>> def foo(a,*b=3,c): |
| 390 | +... pass |
| 391 | +Traceback (most recent call last): |
| 392 | +SyntaxError: var-positional argument cannot have default value |
| 393 | +
|
| 394 | +>>> def foo(a,*b: int=,c): |
| 395 | +... pass |
| 396 | +Traceback (most recent call last): |
| 397 | +SyntaxError: var-positional argument cannot have default value |
| 398 | +
|
| 399 | +>>> def foo(a,**b=3): |
| 400 | +... pass |
| 401 | +Traceback (most recent call last): |
| 402 | +SyntaxError: var-keyword argument cannot have default value |
| 403 | +
|
| 404 | +>>> def foo(a,**b: int=3): |
| 405 | +... pass |
| 406 | +Traceback (most recent call last): |
| 407 | +SyntaxError: var-keyword argument cannot have default value |
| 408 | +
|
| 409 | +>>> def foo(a,*a, b, **c, d): |
| 410 | +... pass |
| 411 | +Traceback (most recent call last): |
| 412 | +SyntaxError: arguments cannot follow var-keyword argument |
| 413 | +
|
| 414 | +>>> def foo(a,*a, b, **c, d=4): |
| 415 | +... pass |
| 416 | +Traceback (most recent call last): |
| 417 | +SyntaxError: arguments cannot follow var-keyword argument |
| 418 | +
|
| 419 | +>>> def foo(a,*a, b, **c, *d): |
| 420 | +... pass |
| 421 | +Traceback (most recent call last): |
| 422 | +SyntaxError: arguments cannot follow var-keyword argument |
| 423 | +
|
| 424 | +>>> def foo(a,*a, b, **c, **d): |
| 425 | +... pass |
| 426 | +Traceback (most recent call last): |
| 427 | +SyntaxError: arguments cannot follow var-keyword argument |
| 428 | +
|
| 429 | +>>> def foo(a=1,/,**b,/,c): |
| 430 | +... pass |
| 431 | +Traceback (most recent call last): |
| 432 | +SyntaxError: arguments cannot follow var-keyword argument |
| 433 | +
|
| 434 | +>>> def foo(*b,*d): |
| 435 | +... pass |
| 436 | +Traceback (most recent call last): |
| 437 | +SyntaxError: * argument may appear only once |
| 438 | +
|
| 439 | +>>> def foo(a,*b,c,*d,*e,c): |
| 440 | +... pass |
| 441 | +Traceback (most recent call last): |
| 442 | +SyntaxError: * argument may appear only once |
| 443 | +
|
| 444 | +>>> def foo(a,b,/,c,*b,c,*d,*e,c): |
| 445 | +... pass |
| 446 | +Traceback (most recent call last): |
| 447 | +SyntaxError: * argument may appear only once |
| 448 | +
|
| 449 | +>>> def foo(a,b,/,c,*b,c,*d,**e): |
| 450 | +... pass |
| 451 | +Traceback (most recent call last): |
| 452 | +SyntaxError: * argument may appear only once |
| 453 | +
|
| 454 | +>>> def foo(a=1,/*,b,c): |
| 455 | +... pass |
| 456 | +Traceback (most recent call last): |
| 457 | +SyntaxError: expected comma between / and * |
| 458 | +
|
| 459 | +>>> def foo(a=1,d=,c): |
| 460 | +... pass |
| 461 | +Traceback (most recent call last): |
| 462 | +SyntaxError: expected default value expression |
| 463 | +
|
| 464 | +>>> def foo(a,d=,c): |
| 465 | +... pass |
| 466 | +Traceback (most recent call last): |
| 467 | +SyntaxError: expected default value expression |
| 468 | +
|
| 469 | +>>> def foo(a,d: int=,c): |
| 470 | +... pass |
| 471 | +Traceback (most recent call last): |
| 472 | +SyntaxError: expected default value expression |
| 473 | +
|
| 474 | +>>> lambda /,a,b,c: None |
| 475 | +Traceback (most recent call last): |
| 476 | +SyntaxError: at least one argument must precede / |
| 477 | +
|
| 478 | +>>> lambda a,/,/,b,c: None |
| 479 | +Traceback (most recent call last): |
| 480 | +SyntaxError: / may appear only once |
| 481 | +
|
| 482 | +>>> lambda a,/,a1,/,b,c: None |
| 483 | +Traceback (most recent call last): |
| 484 | +SyntaxError: / may appear only once |
| 485 | +
|
| 486 | +>>> lambda a=1,/,/,*b,/,c: None |
| 487 | +Traceback (most recent call last): |
| 488 | +SyntaxError: / may appear only once |
| 489 | +
|
| 490 | +>>> lambda a,/,a1=1,/,b,c: None |
| 491 | +Traceback (most recent call last): |
| 492 | +SyntaxError: / may appear only once |
| 493 | +
|
| 494 | +>>> lambda a,*b,c,/,d,e: None |
| 495 | +Traceback (most recent call last): |
| 496 | +SyntaxError: / must be ahead of * |
| 497 | +
|
| 498 | +>>> lambda a=1,*b,c=3,/,d,e: None |
| 499 | +Traceback (most recent call last): |
| 500 | +SyntaxError: / must be ahead of * |
| 501 | +
|
| 502 | +>>> lambda a=1,/*,b,c: None |
| 503 | +Traceback (most recent call last): |
| 504 | +SyntaxError: expected comma between / and * |
| 505 | +
|
| 506 | +>>> lambda a,*b=3,c: None |
| 507 | +Traceback (most recent call last): |
| 508 | +SyntaxError: var-positional argument cannot have default value |
| 509 | +
|
| 510 | +>>> lambda a,**b=3: None |
| 511 | +Traceback (most recent call last): |
| 512 | +SyntaxError: var-keyword argument cannot have default value |
| 513 | +
|
| 514 | +>>> lambda a, *a, b, **c, d: None |
| 515 | +Traceback (most recent call last): |
| 516 | +SyntaxError: arguments cannot follow var-keyword argument |
| 517 | +
|
| 518 | +>>> lambda a,*a, b, **c, d=4: None |
| 519 | +Traceback (most recent call last): |
| 520 | +SyntaxError: arguments cannot follow var-keyword argument |
| 521 | +
|
| 522 | +>>> lambda a,*a, b, **c, *d: None |
| 523 | +Traceback (most recent call last): |
| 524 | +SyntaxError: arguments cannot follow var-keyword argument |
| 525 | +
|
| 526 | +>>> lambda a,*a, b, **c, **d: None |
| 527 | +Traceback (most recent call last): |
| 528 | +SyntaxError: arguments cannot follow var-keyword argument |
| 529 | +
|
| 530 | +>>> lambda a=1,/,**b,/,c: None |
| 531 | +Traceback (most recent call last): |
| 532 | +SyntaxError: arguments cannot follow var-keyword argument |
| 533 | +
|
| 534 | +>>> lambda *b,*d: None |
| 535 | +Traceback (most recent call last): |
| 536 | +SyntaxError: * argument may appear only once |
| 537 | +
|
| 538 | +>>> lambda a,*b,c,*d,*e,c: None |
| 539 | +Traceback (most recent call last): |
| 540 | +SyntaxError: * argument may appear only once |
| 541 | +
|
| 542 | +>>> lambda a,b,/,c,*b,c,*d,*e,c: None |
| 543 | +Traceback (most recent call last): |
| 544 | +SyntaxError: * argument may appear only once |
| 545 | +
|
| 546 | +>>> lambda a,b,/,c,*b,c,*d,**e: None |
| 547 | +Traceback (most recent call last): |
| 548 | +SyntaxError: * argument may appear only once |
| 549 | +
|
| 550 | +>>> lambda a=1,d=,c: None |
| 551 | +Traceback (most recent call last): |
| 552 | +SyntaxError: expected default value expression |
| 553 | +
|
| 554 | +>>> lambda a,d=,c: None |
| 555 | +Traceback (most recent call last): |
| 556 | +SyntaxError: expected default value expression |
| 557 | +
|
354 | 558 | >>> import ast; ast.parse('''
|
355 | 559 | ... def f(
|
356 | 560 | ... *, # type: int
|
|
0 commit comments