A newbie doubt on methods/functions calling
Steve D'Aprano
steve+python at pearwood.info
Thu Oct 6 13:31:06 EDT 2016
On Fri, 7 Oct 2016 04:06 am, mr.puneet.goyal at gmail.com wrote:
> Hi
>
> I just started learning python. Is there any way to call functions in
> different way ?
>
> Rather calling obj.function(arg1, arg2) I would like to call like below
>
> "obj function arg1 arg2"
No. This will be a syntax error.
> this function is part of a class.
>
> class myClass:
> def function(arg1, arg2):
> # do something
>
> Is it possible to do in python ? May be not directly but using some other
> methods.
The only way to do this will be to write your own pre-processor, which will
parse your source code, and translate it from your language to valid
Python. That's a lot of work for very little value -- I recommend you just
learn the Python syntax rather than trying to force it to be something it
is not.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
More information about the Python-list
mailing list