Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9141561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:39:40+00:00 2026-06-17T09:39:40+00:00

In Python it is possible to call either del x or del (x) .

  • 0

In Python it is possible to call either del x or del (x) . I know how to define a function called F(x) , but I do not know how to define a function that cal be called like del, without a tuple as parameters.

What is the difference between F x and F(x), and how can I define a function that can be called without parenthesis ?

>>> a = 10
>>> a
10
>>> del a             <------------ can be called without parenthesis
>>> a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined
>>> a = 1
>>> del (a)
>>> a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined
>>> def f(x): 1
... 
>>> f (10)
>>> print f (10)
None
>>> def f(x): return 1
... 
>>> print f (10)
1
>>> f 1                  <------   cannot be called so
  File "<stdin>", line 1
    f 1
      ^
SyntaxError: invalid syntax
>>> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:39:40+00:00Added an answer on June 17, 2026 at 9:39 am

    The main reason is that del is actually a statement and therefore has special behavior in Python. Therefore you cannot actually define these (and this behavior) yourself* – it is a built-in part of the language for a set of reserved keywords.

    **I guess you could potentially edit the source of Python itself and build your own in, but I don’t think that is what you’re after :)*

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Timeout on a Python function call I want to implement that when
Is it possible for python to accept input like this: Folder name: Download But
In Python, is it possible to do a non-blocking system call without forking off
Is it possible to execute a python-script on a server without using something like
Does Python have extension methods like C#? Is it possible to call a method
Is it possible to call Tcl procedures that have function pointers (or callback functions)
Using PyObjC, is it possible to import a Python module, call a function and
I have Python code to call a REST service that is something like this:
Possible Duplicate: Understanding Python's call-by-object style of passing function arguments I recently came across
Possible Duplicate: Do python's variable length arguments (*args) expand a generator at function call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.