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


Groups > comp.lang.python > #64037

Re: Python declarative

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; '16,': 0.03; 'parameters': 0.04; 'syntax': 0.04; 'startup': 0.05; 'subject:Python': 0.06; '(b)': 0.07; 'none,': 0.07; 'clean.': 0.09; 'creation,': 0.09; 'parameter': 0.09; 'will,': 0.09; 'yeah,': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'jan': 0.12; 'mostly': 0.14; 'choose,': 0.16; 'dump': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'unordered': 0.16; 'world",': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'split': 0.19; 'thu,': 0.19; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; '(a)': 0.24; 'expanded': 0.24; 'specify': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'chris': 0.29; 'am,': 0.29; 'room': 0.29; 'tim': 0.29; 'message- id:@mail.gmail.com': 0.30; 'along': 0.30; "i'm": 0.30; 'code': 0.31; 'chase': 0.31; 'keys': 0.31; "they'll": 0.31; 'another': 0.32; 'says': 0.33; 'there,': 0.34; 'could': 0.34; 'problem': 0.35; 'possible.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'version': 0.36; 'really': 0.36; 'controls': 0.36; 'method': 0.36; 'should': 0.36; 'window': 0.38; 'previous': 0.38; 'enough': 0.39; 'space': 0.40; 'algorithms': 0.60; 'expression': 0.60; 'solve': 0.60; 'voice': 0.60; 'new': 0.61; 'simple': 0.61; 'kind': 0.63; 'choose': 0.64; 'provide': 0.64; 'love': 0.65; 'hours': 0.66; 'between': 0.67; 'containing': 0.69; 'default': 0.69; 'bag': 0.74; 'saw': 0.77; 'glad': 0.83; 'dict,': 0.84; 'strongest': 0.84; 'boxes': 0.91; 'to:none': 0.92; 'imagine': 0.93
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=0dHxp6QGLL1GaBc59JoEyNt+roekc6HM/VtvlMUnUyE=; b=cSm0nkIM7/8YyJzVfyhNlylEVhX43IpxZz0V6Nyrl4hmeEq0egmcjOPkMpN+lEDDm0 03xgJmjWVYYneB6FmXIYaRlI9sX6pZhiLhZiHdftb9y729dByZvu72x1vLa0zbXPxtlZ VX+vGpmlZSQbWB9toTtP7sEPhbjyI4851PDelAKJ9z/mTzDK1DSg+1xTm3YIhhtfYna9 3JFxwHMO6wXyJdXo7/K5sdoCSJvna0W6SpQZogglRsBRrUzhSPOmw+VBZb5zZ+p9kCXH I720QB0AVJtv/7cDYvRm6aqBrlz5DgzOVoo4cGIPULYU/ossl/6GAYyKpcXPqpMG8kH6 T2Fg==
MIME-Version 1.0
X-Received by 10.66.118.71 with SMTP id kk7mr6586832pab.14.1389836331756; Wed, 15 Jan 2014 17:38:51 -0800 (PST)
In-Reply-To <20140115184839.0a35a9ae@bigbox.christie.dr>
References <1389805328.32401.6.camel@linux-fetk.site> <CAPTjJmqnMaavYx7HyCKaPkj_Kcwp-gQZPjNm-k=KR_FSgEYysQ@mail.gmail.com> <lb73pm$78v$1@ger.gmane.org> <CAPTjJmo+PccoGQoWMa2T6dxySC2HowK59w9xjVvBTX4Whr7yBg@mail.gmail.com> <20140115184839.0a35a9ae@bigbox.christie.dr>
Date Thu, 16 Jan 2014 12:38:51 +1100
Subject Re: Python declarative
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.5559.1389836340.18130.python-list@python.org> (permalink)
Lines 41
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1389836340 news.xs4all.nl 2851 [2001:888:2000:d::a6]:42582
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!nntp.giganews.com!news.osn.de!diablo2.news.osn.de!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:64037

Show key headers only | View raw


On Thu, Jan 16, 2014 at 11:48 AM, Tim Chase
<python.list@tim.thechases.com> wrote:
> On 2014-01-16 10:09, Chris Angelico wrote:
>> myWindow = Window(
>>      title="Hello World",
>>      children=[Button(
>>          label="I'm a button",
>>          onClick=exit
>>      )]
>> )
>
> This also solves the problem that **kwargs are just a dict, which is
> inherently unordered.  So with the previous scheme, you'd just get an
> unordered bag of controls that Python could then dump into your
> containing window as its dict-traversal algorithms saw fit. :-)

Yeah, I don't really want my window layout to randomize every Python startup :)

Actually... I'm really REALLY glad code like the previous version
wasn't prevalent. It would have made for intense opposition to hash
randomization - as I recall, the strongest voice against randomization
was that tests would start to fail (IMO, a simple way to print a
dictionary with its keys sorted would both solve that and provide an
aesthetically-pleasing display). Imagine if someone spent hours
crafting child object names in order to force the children to be added
in the right order, and then along comes the new Python and it's all
broken...

But I still think it should be a method (as it is in GTK, not familiar
enough with the others), as there's no way with the parameter system
to (a) add children after object creation, or (b) specify parameters
(GTK's boxes let you choose, per-child, whether they'll be expanded to
fill any spare space - by default they all will, ie spare room is
split between them, but often you want to choose one to be expanded
and another not). PyGTK is mostly there, but since its .add() method
returns None, chaining isn't possible. Method chaining like that is
somewhat controversial... I would love to have some kind of syntax
that says "and the value of this expression is the bit before the
dot", but I have no idea what would be clean.

ChrisA

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


Thread

Re: Python declarative Chris Angelico <rosuav@gmail.com> - 2014-01-16 12:38 +1100

csiph-web