Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Returning True or False vs. True or None
Post: RE: Returning True or False vs. True or None

(Apr-04-2019, 02:13 AM)ichabod801 Wrote: ... Thanks! As a new python programmer I am just trying to make sure that I am developing good coding practices, and you're argument for explicitly returning...
trevorkavanaugh General Coding Help 6 9,251 Apr-04-2019, 02:28 AM
    Thread: Returning True or False vs. True or None
Post: Returning True or False vs. True or None

Hello, I was just wondering if there is any reason that I should explicitly return False from a function instead of just letting it return None? Example: def function(): if condition: r...
trevorkavanaugh General Coding Help 6 9,251 Apr-04-2019, 12:43 AM
    Thread: Calling list() on permutation
Post: RE: Calling list() on permutation

(Mar-01-2019, 05:46 AM)ichabod801 Wrote: permutations returns a generator, which is an object that just sits there and generates values until it's done. Once it's done, that's it, it's dead. You can...
trevorkavanaugh General Coding Help 2 2,387 Mar-01-2019, 06:00 AM
    Thread: Calling list() on permutation
Post: Calling list() on permutation

Hello, Whenever I call list() on a permutations object it removes all of the data from the permutations object. Could anyone explain why that is to me? Example 1: from itertools import permutations ...
trevorkavanaugh General Coding Help 2 2,387 Mar-01-2019, 05:36 AM
    Thread: Mysterious Extra New-Line
Post: RE: Mysterious Extra New-Line

(Feb-27-2019, 10:43 AM)gontajones Wrote: The builtin print function adds a new line by default: This totally just hit me while I was sitting in a bagel shop eating **doh** Thanks for your respon...
trevorkavanaugh General Coding Help 2 2,498 Feb-27-2019, 07:13 PM
    Thread: Mysterious Extra New-Line
Post: Mysterious Extra New-Line

Hey, So I am doing exercises out of a Python book I am reading and for some reason this code is printing two new-lines between "- turkey" and "- bacon" and I was hoping someone could explain to me wh...
trevorkavanaugh General Coding Help 2 2,498 Feb-27-2019, 06:56 AM
    Thread: for Variable Not Expiring
Post: RE: for Variable Not Expiring

(Feb-24-2019, 01:56 PM)metulburr Wrote: This article explains it. Ill post it here instead of linking because over the years articles/blogs have a tendency to disappear..... Boom! Thank you, amazing...
trevorkavanaugh General Coding Help 10 5,399 Feb-25-2019, 12:31 AM
    Thread: for Variable Not Expiring
Post: RE: for Variable Not Expiring

ah, good to know. thanks.
trevorkavanaugh General Coding Help 10 5,399 Feb-24-2019, 07:29 AM
    Thread: for Variable Not Expiring
Post: for Variable Not Expiring

Hello, I am new to python and just realized that when I create a for loop to iterate through a list, I am still able to access the variable that was temporarily storing the value of each list item af...
trevorkavanaugh General Coding Help 10 5,399 Feb-24-2019, 05:53 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020