Linked Questions

0 votes
1 answer
603 views

Is it possible to overload the meaning of different keywords in Python? I'd like to implement my own version of if and for etc.
JRR's user avatar
  • 6,230
-1 votes
4 answers
641 views

Normally, Python calls functions by func(arg0, arg1) But I would like to change to func arg0 arg1 For example, #Something... cmd = input() interpret(cmd) #Something... If I input 'func arg0 arg1', ...
Zhipeng YANG's user avatar
2 votes
0 answers
618 views

Can I create a statement in python 2.7? Something similar to the print statement, that it's like a function, but gets the parameters without parenthesis.
Daniel's user avatar
  • 239
0 votes
1 answer
319 views

I'm wondering if there is anyway around the typical limitations on python function names (alphanumerics etc). Typical function application proceeds like this myFunction(arg1,arg2). But we know there ...
keegan's user avatar
  • 3,002
0 votes
1 answer
186 views

I have been searching already but I have no idea how those e and j are called and therefore not found useful information. I am searching for numbers with chars for specification or as operators. Like ...
BadAtLaTeX's user avatar
0 votes
1 answer
121 views

Not sure how to explain, I mean statemtents like: for i in l: if a==b: def x(): lambda x: class spam: while True: basically those control statements that end with : can I create novel ones? (like in ...
user3392394's user avatar
1 vote
1 answer
44 views

How can I express a method (e.g. dir(os)) like a keyword (e.g. dir_ os)? Is it even possible? The opposite is quite easy to achieve: # `assert` expressed like a method def assert_(x): assert x ...
isar's user avatar
  • 1,811
0 votes
0 answers
45 views

By 'class constructor with a unicode caracter' I mean an analogous to the list constructor '[' or the tuple constructor '('. For exemple, can I define a class Circular_List, a '|' constructor such ...
Aron Maciel's user avatar
1 vote
0 answers
31 views

Is it possible to create a keyword in python that's equivalent to inheriting a class? So given class: class Hello: pass I could write keyword Custom: pass which would be equivalent to class ...
ladder's user avatar
  • 249
116 votes
10 answers
164k views

The print used to be a statement in Python 2, but now it became a function that requires parenthesis in Python 3. Is there anyway to suppress these parenthesis in Python 3? Maybe by re-defining the ...
Laura's user avatar
  • 1,445
5 votes
8 answers
2k views

Suppose I have the code: a = 2 b = a + 2 a = 3 The question is: how to keep b updated on each change in a? E.g., after the above code I would like to get: print(b) to be 5, not 4. Of course, b can ...
Anton Tarasenko's user avatar
20 votes
4 answers
7k views

In the module warnings (https://docs.python.org/3.5/library/warnings.html) there is the ability to raise a warning that appears to come from somewhere earlier in the stack: warnings.warn('This is a ...
Joel's user avatar
  • 2,175
7 votes
4 answers
8k views

The Python documentation specifies that is is legal to omit the parentheses if a function only takes a single parameter, but myfunction "Hello!" generates a syntax error. So, what's the ...
Tony the Pony's user avatar
1 vote
1 answer
2k views

Just wondering... I find using escape characters too distracting. I'd rather do something like this (console code): >>> print ^'Let's begin and end with sets of unlikely 2 chars and bingo!'^ Let's ...
cregox's user avatar
  • 18.6k
6 votes
1 answer
5k views

I want to use reserved keyword "from" as the name of variable. I have it in my arguments parser: parser.add_argument("--from") args = parser.parse_args() print(args.from) but this isn't working ...
Július Marko's user avatar

15 30 50 per page