Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Any comment on using ctypesgen package? Date: Fri, 4 Mar 2016 23:00:13 +1100 Lines: 22 Message-ID: References: <3f342ec1-c6cd-49a8-aca2-2eac21fbbd79@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de mfsApFs8fRgCAZdJPlTAlg5pn47y1ZBhdDkvtuiqLuCA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; '-----------': 0.04; '---------': 0.05; 'testing,': 0.05; 'cc:addr:python-list': 0.09; '2to3': 0.09; 'backwards': 0.09; 'object)': 0.09; 'subject:using': 0.09; 'undefined.': 0.09; 'python': 0.10; 'assume': 0.11; 'do,': 0.15; '(before': 0.16; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'new-style': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:comment': 0.16; 'wrote:': 0.16; 'try:': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'pass': 0.22; 'trying': 0.22; 'defined': 0.23; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; '2.0': 0.27; 'idea': 0.28; 'skip:( 20': 0.28; 'about.': 0.29; 'preserve': 0.29; 'types.': 0.29; "i'm": 0.30; 'classes': 0.30; 'comments': 0.30; 'class.': 0.30; 'query': 0.30; 'skip:_ 10': 0.32; 'class': 0.33; 'true.': 0.33; 'file': 0.34; 'except': 0.34; 'received:google.com': 0.35; 'instance': 0.35; 'but': 0.36; 'instead': 0.36; 'needed': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'anything': 0.38; 'sure': 0.39; 'where': 0.40; 'some': 0.40; 'save': 0.60; 'mar': 0.65; 'note:': 0.66; 'talking': 0.67; 'yourself': 0.73; 'chrisa': 0.84; 'object:': 0.84; 'subject:Any': 0.84; 'to:none': 0.91; 'trouble.': 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; bh=2gumSGMYikS8tDww4mI0MalPyRp3I25/tHmBfKntmJw=; b=yetxglMAgrQPOSpIcMGBQjIkvC7WowhFGUZTfEKIWtWad+Hfcc9UUQv1DIDmJVujtB NooMwaqkgMawa10YbrNDjkybn0Z+BP35DTtiaf9Baa2D/pVEga3ev6la0JdBlEnO9JAa C6gnf4jhgZ5MCkRVshbuCOKiX5PVh4w5E9uamVd/MXKWz6Kka8ZeUqlXpuKEYnN/cLSY 77iV9rEhBZwcAEfZ21sN5P2H87wGxGIUsi1R51zyRotjbW+VOAtB4q/YpMBVZfUzHiBb z2zVAmn3BwVxNtNYsWr92GUauKiraW6svoaT6jPoWhNYvf8RCI2+DhSn+Z9vbqRQYHSG JXaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=2gumSGMYikS8tDww4mI0MalPyRp3I25/tHmBfKntmJw=; b=gaNiqyg5iOSwyrzxJjCvb3qkqJUT/NB1ptfkxKXavSLQUzn75QVR1uxhlhn1TYDmdB WJX6qtPba4dc7II7yIFxQfJcwcb7CG7hQhuJkL9B5VtyGoyRcqiJAVorxzX5bhHO7HJh F+csc/RWk/FQNDELMULZ4Kc8dlVir9FV0DFimbvKkPjm/DgEePKc1gUTsgNDtZoK+/1h 6IQuQhExD+KxPIjnczXu12slRlSybX6ukn10bOwYozr4JCkfaSQ4vQDMBjGO9ehpp/KA II16hUV14i9fy32HjTXgnEuO15ImefpnpvyrcIqY3At0MlHhMzRnkIH6o51VaSusByq1 gWfg== X-Gm-Message-State: AD7BkJJ7Enx1uW4otmfmQ37zMrvLrbhV3nmoR0T4QdPE9YORmuR06gB2KoIFyrdAlBJxNPpCVAjeTPl0dLvxGA== X-Received: by 10.107.63.137 with SMTP id m131mr7370940ioa.157.1457092813651; Fri, 04 Mar 2016 04:00:13 -0800 (PST) In-Reply-To: <3f342ec1-c6cd-49a8-aca2-2eac21fbbd79@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 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:104028 On Fri, Mar 4, 2016 at 10:08 PM, wrote: > Below is the troubled codes in file lex.py: > Note: In original codes (before 2To3 modify), there is "types.ObjectType" instead of "object". > --------- > # Available instance types. This is used when lexers are defined by a class. > # It's a little funky because I want to preserve backwards compatibility > # with Python 2.0 where types.ObjectType is undefined. > try: > _INSTANCETYPE = (types.InstanceType, object) > except AttributeError: > _INSTANCETYPE = types.InstanceType > class object: pass # Note: needed if no new-style classes present > ----------- > The author had put some comments above these codes but I have no idea what he is talking about. I'm not sure exactly what this is trying to do, but if it's just for isinstance testing, you can save yourself a lot of trouble. In Python 3, *every* type inherits from 'object'. So _INSTANCETYPE can be set to just object - and anything that's trying to query that can simply assume it's true. ChrisA