Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAndrés Leal
9,563 PointsWhen to use "del" ?
When is useful to apply the "del" function in a Python program?
Andrés Leal
9,563 PointsShouldn't it be called a function since how it is called or how it was created at first by python! Thanks btw
Alexander Davison
65,469 PointsBTW are you using Python 2 or Python 3? I use Python 3, and in Python 3 del is a keyword.
Andrés Leal
9,563 PointsPython 2.7 Should I update to Python 3?
Alexander Davison
65,469 PointsYes, 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
Moe Myint Kyal Sin
Courses Plus Student 553 PointsWhen you want to delete your variable.
2 Answers
Jennifer Nordell
Treehouse TeacherAccording 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.
Alexander Davison
65,469 PointsThx
A X
12,842 PointsAs a further clarification question, you'd really only use del in the Python shell right? You'd never see it otherwise?
Alexander Davison
65,469 PointsSo um I never use it actually
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsFirst, 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