Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111761

Re: learning python. learning defining functions . need help

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Random832 <random832@fastmail.com>
Newsgroups comp.lang.python
Subject Re: learning python. learning defining functions . need help
Date Fri, 22 Jul 2016 11:35:02 -0400
Lines 22
Message-ID <mailman.56.1469201704.22221.python-list@python.org> (permalink)
References <432aeb03-ea14-4ece-8e5b-a7521cf12b84@googlegroups.com> <ji44pbpbaj6olkqcq832ivm7q7gl5d1aca@4ax.com> <CAPTjJmq6nnqp3434HNkxZLPm-igt-vk76u1GZVsr7euhWd4f8Q@mail.gmail.com> <CAO1D73GxUMSwRZvggewY8o-3GLpSMZHAyGD18by1dy-CqyGhpw@mail.gmail.com> <1469201702.1515177.673935617.42048544@webmail.messagingengine.com>
Mime-Version 1.0
Content-Type text/plain
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de 6PmYofVA8edSbVNtcGdCcQTSNO5PTceyRMvqUooJzP5g==
Return-Path <random832@fastmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'defaults': 0.05; 'definitions.': 0.07; 'interpreted': 0.07; 'interpreter.': 0.07; 'subject:help': 0.07; '22,': 0.09; 'dict': 0.09; 'received:internal': 0.09; 'interpreter': 0.15; 'justin': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'spec,': 0.16; 'subject:python.': 0.16; 'wrote:': 0.16; 'instance,': 0.18; 'subject:need': 0.18; 'typing': 0.18; 'why.': 0.18; 'language': 0.19; 'assuming': 0.22; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; "doesn't": 0.26; 'command': 0.26; 'fri,': 0.27; 'subject:learning': 0.29; 'true.': 0.33; 'could': 0.35; 'false': 0.35; 'set.': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'received:66': 0.38; 'anything': 0.38; 'to:addr:python.org': 0.40; 'your': 0.60; 'header:Message-Id:1': 0.61; 'subject:. ': 0.67; 'jul': 0.72; 'dict()': 0.84; 'subject: . ': 0.84; 'walters': 0.84
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=NXZKP4gZoEiNMN/AqlGuBgBNV1g=; b=jCTz4q R9JZ92/gRRHQzIOpCUIxjpZOYUWg9tG+JFr8e+UzS1kvx+Q6blWDe9murbGgfoeX KOkj8+wojsRqXk3+T+R6rvaIlMfUOWy+GXk2Y0X0rttw9epNTR/V64rj5ZKKQJon n99JSbynTt0DCa98hWGGEb+26oT/Le3d1rwNc=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=NXZKP4gZoEiNMN/ AqlGuBgBNV1g=; b=COKyvQ6HrOh4QdDgCzfHFLnXdvMpyV4jNLZkBjREtAR7VyO FigNdPSLrIT0hTk8T5YTDIOQAbwib3hTiRordJPWmGw3QLuYLYHxyxyXicADh8B2 OPcEJRpRG/ckedwIsRPCfsjJ/EVRt7KiFKl2dDtGcygI/4TplKQtvamWrAtk=
X-Sasl-Enc ctpowwNs7PJLEIEtwUL7NbksfWQcD2Se7HfSiGz9mbu/ 1469201702
X-Mailer MessagingEngine.com Webmail Interface - ajax-2ccfea0a
In-Reply-To <CAO1D73GxUMSwRZvggewY8o-3GLpSMZHAyGD18by1dy-CqyGhpw@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <1469201702.1515177.673935617.42048544@webmail.messagingengine.com>
X-Mailman-Original-References <432aeb03-ea14-4ece-8e5b-a7521cf12b84@googlegroups.com> <ji44pbpbaj6olkqcq832ivm7q7gl5d1aca@4ax.com> <CAPTjJmq6nnqp3434HNkxZLPm-igt-vk76u1GZVsr7euhWd4f8Q@mail.gmail.com> <CAO1D73GxUMSwRZvggewY8o-3GLpSMZHAyGD18by1dy-CqyGhpw@mail.gmail.com>
Xref csiph.com comp.lang.python:111761

Show key headers only | View raw


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 a dict instance, not the dict type.

type({}) == dict == type(dict()) will always* be true.

>This is because simply typing '{}' could be interpreted as either a
>dict or a set. My interpreter defaults 'type({})' to 'dict', but it's
>best to not take the risk.

This is part of the language spec, it is not something that can be
chosen by each interpreter.

*well, assuming that "type" and "dict" have not been reassigned from
their built-in definitions.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

learning python. learning defining functions . need help sigmaphine1914@gmail.com - 2016-07-21 19:27 -0700
  Re: learning python. learning defining functions . need help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-07-22 09:13 -0400
  Re: learning python. learning defining functions . need help Chris Angelico <rosuav@gmail.com> - 2016-07-22 23:24 +1000
  Re: learning python. learning defining functions . need help justin walters <walters.justin01@gmail.com> - 2016-07-22 08:21 -0700
    Re: learning python. learning defining functions . need help Steven D'Aprano <steve@pearwood.info> - 2016-07-23 11:44 +1000
  Re: learning python. learning defining functions . need help Random832 <random832@fastmail.com> - 2016-07-22 11:35 -0400
  Re: learning python. learning defining functions . need help Chris Angelico <rosuav@gmail.com> - 2016-07-23 01:35 +1000
  Re: learning python. learning defining functions . need help "D'Arcy J.M. Cain" <darcy@Vex.Net> - 2016-07-22 11:41 -0400
  Re: learning python. learning defining functions . need help MRAB <python@mrabarnett.plus.com> - 2016-07-22 19:36 +0100
  Re: learning python. learning defining functions . need help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-07-22 20:04 -0400
  Re: learning python. learning defining functions . need help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-07-23 11:39 -0400

csiph-web