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


Groups > comp.lang.python > #60731

Re: Jython - Can't access enumerations?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <timothy.c.delaney@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.046
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; '64-bit': 0.07; 'skip:p 60': 0.07; '[1,': 0.09; 'arrays': 0.09; '(oracle': 0.16; 'collections': 0.16; 'sadly': 0.16; 'subject:access': 0.16; 'elements': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'library': 0.18; 'all,': 0.19; 'trying': 0.19; 'work,': 0.20; 'help.': 0.21; 'feb': 0.22; '>>>': 0.22; 'example': 0.22; 'import': 0.22; 'email addr:gmail.com&gt;': 0.22; 'error': 0.23; '&gt;&gt;&gt;': 0.24; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'asked': 0.31; 'probably': 0.32; 'skip:c 30': 0.32; 'minimal': 0.33; 'to:name:python-list': 0.33; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'accessing': 0.36; 'skip:j 20': 0.36; "didn't": 0.36; 'subject:?': 0.36; 'so,': 0.37; 'server': 0.38; 'skip:& 10': 0.38; 'problems': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'skip:p 20': 0.39; 'subject:Can': 0.60; 'forum': 0.61; 'skip:a 30': 0.61; "you'll": 0.62; 'more': 0.64; 'here': 0.66; 'latest': 0.67; 'therefore': 0.72; 'hoping': 0.75; 'demonstrates': 0.84; 'enumeration': 0.84; '2013,': 0.91; 'you).': 0.95; '2013': 0.98
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; bh=bFqtRfuX2ljQD2xaDS063qogf3W1BAl2upgObLHL/ZQ=; b=1JcBU3L+6NnHIECXYWgowztSCRL6fBIluHDzT4ZsxXQV/CRbfQLNMaLxb07XEIl9Zh PXcFLgCE6mNL7vT9dVEywNA5wz/0vnoi3Dx0QrF20I/wUV4C03dUrMJsVoYDp2cy4Ck/ dNVGmJAgy1asqEYzN55Yfj9V7pS5jfM8o9XxZTFw+Iys1Slf4VKQYOxt1DX4k5J59owm VH6Mpn5aNL/RbyETzsFnqDjeHsExS5Yzw8otZh/PgML/5OvwOetzMHnfo/cPbbVjPP66 MBEgl18cHfMmgBS4KaKcShdZ8LWgNn8QQv2ZFD/Ws3tAbxYYTA6od05n+JAGrzxwYWQk tFfg==
MIME-Version 1.0
X-Received by 10.182.45.195 with SMTP id p3mr40016366obm.29.1385671827446; Thu, 28 Nov 2013 12:50:27 -0800 (PST)
In-Reply-To <7633df1c-5c4d-40ea-b9a5-51637d2fef89@googlegroups.com>
References <7633df1c-5c4d-40ea-b9a5-51637d2fef89@googlegroups.com>
Date Fri, 29 Nov 2013 07:50:27 +1100
Subject Re: Jython - Can't access enumerations?
From Tim Delaney <timothy.c.delaney@gmail.com>
To Python-List <python-list@python.org>
Content-Type multipart/alternative; boundary=089e01537e420ce0ea04ec42dd78
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.3377.1385671831.18130.python-list@python.org> (permalink)
Lines 96
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1385671831 news.xs4all.nl 15973 [2001:888:2000:d::a6]:51071
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60731

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 29 November 2013 04:22, Eamonn Rea <eamonnrea@gmail.com> wrote:

> Hello! I'm using Jython to write a game with Python/Jython/LibGDX. I
> wasn't having any trouble, and everything was going well, but sadly I can't
> access items in enumerations.
>
> If you know about the LibGDX library and have used it, you'll probably
> know about the BodyType enumeration for Box2D. I was trying to access the
> BodyType item in the enumeration. This didn't work, as Jython couldn't find
> the BodyType enumeration. I asked on the LibGDX forum and no one could
> help. So I'm hoping that someone here could help :-)
>
> So, is this a problem with LibGDX or Jython? I'm using the latest version
> of Jython.
>

There is no problems accessing the elements of enumerations with Jython.
The following was tested using Jython 2.7b1:

Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_40
Type "help", "copyright", "credits" or "license" for more information.
>>> import java.util.Collections as Collections
>>> import java.util.Arrays as Arrays
>>>
>>> a = Arrays.asList(1, 2, 3)
>>> print(a)
[1, 2, 3]
>>> e = Collections.enumeration(a)
>>> print(e)
java.util.Collections$2@f48007e
>>>
>>> for i in e:
...     print(i)
...
1
2
3

Therefore the problem is either with LibGDX or (more likely) way you are
using it. Please post a minimal example that demonstrates the problem plus
the exact error message you get (I don't know LibGLX at all, but someone
else might, plus trimming it down to a minimal example may reveal the
problem to you).

Tim Delaney

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


Thread

Jython - Can't access enumerations? Eamonn Rea <eamonnrea@gmail.com> - 2013-11-28 09:22 -0800
  Re: Jython - Can't access enumerations? Tim Delaney <timothy.c.delaney@gmail.com> - 2013-11-29 07:50 +1100
  Re: Jython - Can't access enumerations? Eamonn Rea <eamonnrea@gmail.com> - 2013-11-29 08:15 -0800
    Re: Jython - Can't access enumerations? Tim Delaney <timothy.c.delaney@gmail.com> - 2013-11-30 06:40 +1100

csiph-web