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


Groups > comp.lang.python > #36168

Re: pygame - importing GL - very bad...

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'languages,': 0.04; '[0]': 0.07; 'variable,': 0.07; 'python': 0.09; 'difference,': 0.09; 'php,': 0.09; 'referencing': 0.09; 'semantics': 0.09; 'def': 0.10; 'language,': 0.11; 'passing': 0.15; 'foo():': 0.16; 'foo.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'naming': 0.16; 'pointer,': 0.16; 'skip:[ 60': 0.16; 'substituted': 0.16; 'variable.': 0.16; 'wrote:': 0.17; 'pointer': 0.17; 'jan': 0.18; 'changes': 0.20; 'otherwise,': 0.20; 'assignment': 0.22; 'extends': 0.22; 'object.': 0.22; 'pascal': 0.22; 'posted': 0.22; 'flexibility': 0.23; 'references': 0.23; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:" 20': 0.26; 'url:wiki': 0.26; 'am,': 0.27; 'implemented': 0.27; 'language.': 0.27; 'older': 0.27; 'object,': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'rest': 0.28; 'received:209.85.212': 0.28; 'chris': 0.28; 'prints': 0.29; 'things,': 0.29; 'though.': 0.29; 'url:wikipedia': 0.29; "i'm": 0.29; 'function': 0.30; 'sense': 0.31; 'code': 0.31; 'to:addr :python-list': 0.33; 'languages': 0.33; 'another': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'list': 0.35; 'exist': 0.35; 'returning': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'anything': 0.36; 'level': 0.37; 'why': 0.37; 'drop': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'object': 0.38; 'things': 0.38; 'url:en': 0.38; 'to:addr:python.org': 0.39; 'list,': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'most': 0.61; 'high': 0.61; 'subject:...': 0.63; 'more': 0.63; 'other.': 0.64; 'charset:windows-1252': 0.65; 'subject': 0.66; 'url:htm': 0.71; 'power': 0.74; '2013': 0.84; 'differently:': 0.84; 'links:': 0.84; 'outside.': 0.84; 'subject:very': 0.91; 'technique': 0.93; 'you).': 0.95
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:to :content-type:content-transfer-encoding; bh=1CNAtq8XEYB5IbQo9ZC96E92IuSzqx6G5RS+Z75GlI8=; b=Uwxw7rRI3+ieuAwO7f2hnoX4Og5/0FMGT9eGzb8B2BTrkZcWH3HgN1e1nlJNxYvZVP 9Au9ASABs02PAJVyg7Rrz7cbGmglLGUeqXs9iRHH5t8h4OP960KtcsWt4sIBIHCgu7wH c+Dr0oM+wzCc8Ivoe5gCOZY3jXroYEmrEfRq3tc06Y3GVKFJAtYTznXcGOzFYVpvMg8S khS5emkfcfFecPWws9nhNKiIMZzSqATFaZMMk5LOV2fx+M2jdq6Jspuh5Ag/RrktGDx7 /DY3yx0KnCb4Qv2IGZYNMRL0FMKr4wl/88IXfD+ugRPR9iN6iqwX702lE0PRepzY7HIb CdmQ==
MIME-Version 1.0
In-Reply-To <kc98gm$21c$1@dont-email.me>
References <kbufkg$ead$1@dont-email.me> <mailman.1512.1357038843.29569.python-list@python.org> <kbvslg$mqg$1@dont-email.me> <mailman.1.1357163829.2939.python-list@python.org> <kc2oa0$3e3$1@dont-email.me> <mailman.38.1357222158.2939.python-list@python.org> <kc7uia$8h1$1@dont-email.me> <mailman.104.1357349785.2939.python-list@python.org> <kc90g4$p5d$1@dont-email.me> <mailman.111.1357386440.2939.python-list@python.org> <kc98gm$21c$1@dont-email.me>
Date Sun, 6 Jan 2013 00:27:19 +1100
Subject Re: pygame - importing GL - very bad...
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.115.1357392442.2939.python-list@python.org> (permalink)
Lines 73
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1357392442 news.xs4all.nl 6952 [2001:888:2000:d::a6]:45417
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36168

Show key headers only | View raw


On Sun, Jan 6, 2013 at 12:06 AM, someone <newsboost@gmail.com> wrote:
> On 01/05/2013 12:47 PM, Chris Angelico wrote:
>> You can find good references on the subject in various
>> places, but call-by-reference as implemented in Pascal simply doesn't
>> exist in most modern languages, because its semantics are way
>> confusing. The name given to this technique varies; here's a couple of
>> links:
>>
>> http://effbot.org/zone/call-by-object.htm
>> http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing
>
> If you don't like calling it "pass-by-reference", perhaps you prefer calling
> it: “call by object reference“...  From:
> http://effbot.org/zone/call-by-object.htm
>
> In any case I think we understand each other.

That's one of the links I just posted :) It's not just a naming
difference, though. With Pascal's pass-by-reference semantics, this
code would act differently:

def foo(x):
  x = 5

a = 2
foo(a)
print(a)

Python prints 2, because the assignment to x just rebinds the name
inside foo. True pass-by-reference actually changes the caller's
variable. C can achieve this by means of pointers; in Python, you can
pass and mutate a list, thus:

def foo(x):
  x[0] = 5 # Dereference the pointer, kinda

x=[None] # Declare a pointer variable, ish
x[0] = 2
foo(x) # Don't forget to drop the [0] when passing the pointer to
another function
print(x[0]) # Prints 5. See? We have pass-by-reference!

But otherwise, rebinding names in the function has no effect on
anything outside. Among other things, this guarantees that, in any
situation, a name referencing an object can be perfectly substituted
for any other name referencing the same object, or any other way of
accessing the object.

def foo(lst):
  lst[0]=len(lst)

x = [10,20,30]
y = x
foo(x) # These two...
foo(y) # ... are identical!

This is a philosophy that extends through the rest of the language. A
function returning a list can be directly dereferenced, as can a list
literal:

def foo():
  return [0,1,4,9,16]

print( ["Hello","world!","Testing","Testing","One","Two","Three"][foo()[2]] )

This is a flexibility and power that just doesn't exist in many older
languages (C and PHP, I'm looking at you). Object semantics make more
sense than any other system for a modern high level language, which is
why many of them do things that way.

ChrisA

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


Thread

pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-01 12:00 +0100
  Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-01 22:13 +1100
    Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 00:49 +0100
      Re: pygame - importing GL - very bad... Michael Torrie <torriem@gmail.com> - 2013-01-02 14:57 -0700
        Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 02:53 +0100
          Re: pygame - importing GL - very bad... "Mike C. Fletcher" <mcfletch@vrplumber.com> - 2013-01-03 09:09 -0500
            Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:10 +0100
              Re: pygame - importing GL - very bad... Dave Angel <d@davea.name> - 2013-01-04 20:30 -0500
                Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 11:49 +0100
                Re: pygame - importing GL - very bad... Dave Angel <d@davea.name> - 2013-01-05 06:23 -0500
                Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-05 22:47 +1100
                Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 14:06 +0100
                Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-06 00:27 +1100
                Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 20:49 +0100
                Re: pygame - importing GL - very bad... alex23 <wuwei23@gmail.com> - 2013-01-06 03:37 -0800
                Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-06 13:46 +0100
      Re: pygame - importing GL - very bad... Andrew Berg <bahamutzero8825@gmail.com> - 2013-01-02 16:30 -0600
        Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 03:02 +0100
  Re: pygame - importing GL - very bad... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-01 11:49 +0000
    Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 00:49 +0100
      Re: pygame - importing GL - very bad... Nobody <nobody@nowhere.com> - 2013-01-02 03:01 +0000
        Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 04:43 +0100
        Re: pygame - importing GL - very bad... alex23 <wuwei23@gmail.com> - 2013-01-02 01:52 -0800
          Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 15:04 +0100
      Re: pygame - importing GL - very bad... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-02 07:39 +0000
        Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 15:06 +0100
  Re: pygame - importing GL - very bad... Peter Otten <__peter__@web.de> - 2013-01-01 13:56 +0100
    Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 00:50 +0100
      pylint, was Re: pygame - importing GL - very bad... Peter Otten <__peter__@web.de> - 2013-01-02 13:07 +0100
        Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 15:09 +0100
          Re: pylint, was Re: pygame - importing GL - very bad... Dave Angel <d@davea.name> - 2013-01-02 09:26 -0500
            Re: pylint, was Re: pygame - importing GL - very bad... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-02 23:52 +0000
              Re: pylint, was Re: pygame - importing GL - very bad... Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-02 17:25 -0700
              Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 03:24 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... Terry Reedy <tjreedy@udel.edu> - 2013-01-02 21:48 -0500
                Re: pylint, was Re: pygame - importing GL - very bad... Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-02 19:55 -0700
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 12:19 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-03 22:27 +1100
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:11 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... Jan Riechers <janpeterr@freenet.de> - 2013-01-05 14:49 +0200
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 14:09 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... Ben Finney <ben+python@benfinney.id.au> - 2013-01-03 17:01 +1100
                Re: pylint, was Re: pygame - importing GL - very bad... Chris Rebert <clp2@rebertia.com> - 2013-01-02 22:33 -0800
                Re: pylint, was Re: pygame - importing GL - very bad... Peter Otten <__peter__@web.de> - 2013-01-03 10:00 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 12:21 +0100
                Regular expression syntax, was Re: pylint, was Re: pygame - importing GL - very bad... Peter Otten <__peter__@web.de> - 2013-01-03 12:39 +0100
                Re: Regular expression syntax, was Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:12 +0100
                Re: pylint, was Re: pygame - importing GL - very bad... "Mike C. Fletcher" <mcfletch@vrplumber.com> - 2013-01-03 09:19 -0500
                Re: pylint, was Re: pygame - importing GL - very bad... Terry Reedy <tjreedy@udel.edu> - 2013-01-03 11:52 -0500
                Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:14 +0100
            Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 03:06 +0100
      Re: pylint, was Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-03 01:32 +1100
      Re: pylint, was Re: pygame - importing GL - very bad... Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-02 10:52 -0700
      Re: pylint, was Re: pygame - importing GL - very bad... Chris Angelico <rosuav@gmail.com> - 2013-01-03 04:57 +1100
      Re: pylint, was Re: pygame - importing GL - very bad... Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-02 12:31 -0700
        Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-03 03:31 +0100
          Re: pylint, was Re: pygame - importing GL - very bad... Dave Angel <d@davea.name> - 2013-01-02 21:56 -0500
            Re: pylint, was Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-05 02:23 +0100
  Re: pygame - importing GL - very bad... alex23 <wuwei23@gmail.com> - 2013-01-01 14:39 -0800
    Re: pygame - importing GL - very bad... someone <newsboost@gmail.com> - 2013-01-02 00:56 +0100

csiph-web