Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Python Data Types Naming Things

Andrés Leal
Andrés Leal
9,563 Points

When to use "del" ?

When is useful to apply the "del" function in a Python program?

First, it isn't a function, it is a keyword (just so you know). I never ever use del, but you might just encounter it in other peoples' programs.

Hope it helps! ~xela888

Andrés Leal
Andrés Leal
9,563 Points

Shouldn't it be called a function since how it is called or how it was created at first by python! Thanks btw

BTW are you using Python 2 or Python 3? I use Python 3, and in Python 3 del is a keyword.

Andrés Leal
Andrés Leal
9,563 Points

Python 2.7 Should I update to Python 3?

Yes, you should update it. Kenneth Love (the Python teacher) is teaching in Python 3, so please install it. You can install it at www.python.org. Kenneth Love also will teach you how to install it!

Hope it helps! ~xela888

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

According to the Python documentation del is not a function but rather a statement built-in to Python to handle data structures. You can find more information here.

https://docs.python.org/2/tutorial/datastructures.html

Thx

As a further clarification question, you'd really only use del in the Python shell right? You'd never see it otherwise?

So um I never use it actually