Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: What is a function parameter =[] for? Date: Wed, 25 Nov 2015 01:54:45 +1100 Lines: 30 Message-ID: References: <56544BAB.9020709@rece.vub.ac.be> <874mgbpnb5.fsf@elektro.pacujo.net> <486929d1-4caa-403c-89e6-c45d7b447f98@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de Drvy7pqY5wJh8JdK4pYe5AOo7rRh/nPMBZ5kQ2y+s/Ag== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'ideally': 0.04; 'file)': 0.07; 'cc:addr:python-list': 0.09; 'times,': 0.13; 'wed,': 0.15; 'file,': 0.15; '(file': 0.16; 'disappear,': 0.16; 'disk.': 0.16; 'distinct': 0.16; 'duplicating': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'handle,': 0.16; 'pointers,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'two.': 0.16; 'wrote:': 0.16; 'obviously': 0.16; 'exists': 0.18; 'pointer': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'handles': 0.20; '(the': 0.22; 'file.': 0.22; 'am,': 0.23; 'header :In-Reply-To:1': 0.24; "doesn't": 0.26; 'compare': 0.27; 'separate': 0.27; 'message-id:@mail.gmail.com': 0.27; 'disk': 0.27; 'everyone': 0.31; 'hopefully': 0.33; 'picking': 0.33; 'open': 0.33; 'languages': 0.34; 'file': 0.34; 'handle': 0.34; 'received:google.com': 0.35; 'exist': 0.35; 'nov': 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; '(and': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'difference': 0.38; 'received:209': 0.38; 'files': 0.38; 'still': 0.40; 'called': 0.40; 'some': 0.40; "you'll": 0.61; 'here.': 0.62; 'more': 0.63; 'different': 0.63; 'necessarily': 0.63; 'chrisa': 0.84; 'etc),': 0.84; 'etc,': 0.84; 'to:none': 0.91; 'notion': 0.91; 'same,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=5Ba+AWhGYy3QpYdgm0L3HBSwHGbxv9qk432COD09VZ4=; b=djxIfIgA7oosZhGheUfsImxqEXi/y9mgTteRWwXW5GhCUwO5uW0nYs1BCgt6J6IoMN qhjrbdjeQkBAIjZCu3YdjBAeS2MtMSlBvtmRmFKjdr2U6TAJ2p5N7ubQAcN9e9R5XNu2 HxRwL95GJFs1uEQxkF+Xjm4vYd/oSwOfnP58rjMBxgTCQ4rr4rfuY+kfBoPN7HQLYSNw wGPNYP35zz9pc0oR8MBpMBUWfsnYgZa0D3hHvdYAn4mZnbQUhLQvErpEiaHa/4VMSDPV egMD/NGokSgYnS/a3jmQkXBKnsfG513VCp6XFDHFnrXqcR72XBYbPiZ9+yt40Lb216ol HdYw== X-Received: by 10.50.93.72 with SMTP id cs8mr19491225igb.13.1448376886036; Tue, 24 Nov 2015 06:54:46 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99348 On Wed, Nov 25, 2015 at 1:43 AM, BartC wrote: > It comes from the use of file handles (what you get in some languages when > you open or create a file) which everyone can understand: > > * If you copy handle F to G like in an assignment, it obviously doesn't copy > the contents of the file, just the handle. > > * If I compare the contents of files F and H, they might be the same, but > they are not necessarily the same file. > > * If F and G are the same handle, then if I update a file via F, I will see > the same change via handle G. > > The main difference is that when F and G go out of scope and the handles > disappear, the file hopefully still exists! (And ideally the file is first > closed via one of the handles.) I would recommend picking a different example, actually. An open file (the resource) is different from the file that actually exists on the disk. You can open a file for reading three times, and barring access conflicts etc, you'll get three distinct open-file-objects (file handles, etc), with separate read pointers, and advancing the file pointer of one has no effect on the other two. Plus there are other considerations like the notion of duplicating file handles, force-duplicating file handles (sometimes called "dup2"), files that no longer exist on disk but only in memory, files that exist on disk but no longer have any file names, and so on. Files are way WAY more complicated than you want to dig into here. ChrisA