On Sat, 23 Jul 2016 01:21 am, justin walters wrote:
> That should illustrate why. This is because simply typing '{}' could be
> interpreted as
> either a dict or a set.
No. {} is always an empty dict. That is a language guarantee. Any
programming language where {} is not an empty disk is not val
On 2016-07-22 16:41, D'Arcy J.M. Cain wrote:
On Fri, 22 Jul 2016 08:21:17 -0700
justin walters wrote:
You could also replace that line with:
if stock is None or type(stock) != dict:
Use isinstance(). That handles classes that subclass dict as well.
If you're checking that it's a dict,
On Fri, 22 Jul 2016 08:21:17 -0700
justin walters wrote:
> You could also replace that line with:
>
> if stock is None or type(stock) != dict:
Use isinstance(). That handles classes that subclass dict as well.
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@
On Fri, Jul 22, 2016, at 11:21, justin walters wrote:
> Try opening the interactive terminal on your command line and type the
> following:
>
> type({}) == dict()
>
> That should illustrate why.
That doesn't illustrate anything relevant at all. The reason this is
false is because dict() is
On Sat, Jul 23, 2016 at 1:21 AM, justin walters
wrote:
> Hi Chris,
>
> Try opening the interactive terminal on your command line and type the
> following:
>
> type({}) == dict()
>
> That should illustrate why. This is because simply typing '{}' could be
> interpreted as
> either a dict or a se
On Fri, Jul 22, 2016 at 6:24 AM, Chris Angelico wrote:
> On Fri, Jul 22, 2016 at 11:13 PM, Dennis Lee Bieber
> wrote:
> > Now... Going much beyond the assignment (if you were having
> trouble
> > with the assignment, this will seem like magic) [Python 2.7]:
>
> I'm not sure, but I think
On Fri, Jul 22, 2016 at 11:13 PM, Dennis Lee Bieber
wrote:
> Now... Going much beyond the assignment (if you were having trouble
> with the assignment, this will seem like magic) [Python 2.7]:
I'm not sure, but I think your code would become Py3 compatible if you
just change your prints.
having a little trouble with defining functions. i have a doc called ch5.py and
when i was trying the following i had issues
"
Try It Out: Defining a Function
Try saving the following in your file for Chapter 5, ch5.py.def in_fridge():
try:
count = fridge[wanted_food]