Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail 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; 'python,': 0.02; 'subject:Python': 0.05; 'encode': 0.09; 'integers': 0.09; 'objects.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tends': 0.09; 'python': 0.11; 'python.': 0.11; 'decode': 0.16; 'ecosystem.': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'happily': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'text?': 0.16; 'unicode?': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'string': 0.17; 'byte': 0.18; 'integer': 0.18; 'stefan': 0.18; 'language': 0.19; '>>>': 0.20; 'handling': 0.20; 'embedding': 0.22; 'features,': 0.22; 'defined': 0.23; 'bit': 0.23; '2015': 0.23; "python's": 0.23; 'header:In- Reply-To:1': 0.24; 'somewhere': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; '(e.g.': 0.27; 'cool': 0.27; "doesn't": 0.28; 'rest': 0.28; 'skip:( 20': 0.28; 'noticed': 0.29; 'looks': 0.29; 'cases.': 0.29; 'operators': 0.29; 'strings,': 0.29; 'objects': 0.29; 'fri,': 0.31; 'code': 0.31; 'embedded': 0.32; 'usually': 0.33; 'though.': 0.33; 'case,': 0.34; 'gives': 0.35; 'could': 0.35; 'to:addr:python-list': 0.35; 'i.e.': 0.35; 'unicode': 0.35; 'comment': 0.35; 'handle': 0.36; 'but': 0.36; '(and': 0.36; 'subject:: ': 0.37; 'received:org': 0.38; 'is,': 0.38; 'supports': 0.38; 'pm,': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.39; 'received:de': 0.40; 'why': 0.40; 'your': 0.60; 'even': 0.61; "you'll": 0.61; 'improved': 0.63; 'you.': 0.64; 'within': 0.64; 'here': 0.66; 'received:178': 0.72; 'steady': 0.72; '*lot*': 0.84; 'float,': 0.84; 'overloading': 0.84; 'weaker': 0.84; 'ask,': 0.91; 'dare': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: Creating a reliable sandboxed Python environment Date: Fri, 29 May 2015 11:23:17 +0200 References: <60b424a2-2273-42b2-b60c-92656af0afa5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dslb-178-007-067-223.178.007.pools.vodafone-ip.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 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: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432891406 news.xs4all.nl 2924 [2001:888:2000:d::a6]:56895 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:91437 Chris Angelico schrieb am 29.05.2015 um 09:41: > On Fri, May 29, 2015 at 4:18 PM, Stefan Behnel wrote: >>> Lua's a much weaker language than Python is, though. Can it handle >>> arbitrary-precision integers? Unicode? Dare I even ask, >>> arbitrary-precision rationals (fractions.Fraction)? >> >> All of those and way more, as long as you use it embedded in Python. > > Okay, so how would you go about using Lua-embedded-in-Python to > manipulate Unicode text? Lua only supports byte strings, so Lupa will encode and decode them for you. If that's not enough, you'll have to work with Python Unicode string objects through the language interface. (And I just noticed that the handling can be improved here by overloading Lua operators with Python operators - not currently implemented.) > Looks to me as if Lua doesn't have integers at all The standard number type in Lua is a C double float, i.e. the steady integer range is somewhere within +/-2^53. That tends to be enough for a *lot* of use cases. You could change that type in the Lua C code (e.g. to a 64 bit int), but that's usually a bad idea. The same comment as above applies: if you need Python object features, use Python objects. Embedding Lua in Python gives you access to all of Python's objects and ecosystem. It may not always be as cool to use as from Python, but in that case, why not code it in Python in the first place? You wouldn't use Lua/Lupa to write whole applications, just the user defined parts of them. The rest can happily remain in Python. And should, for your own sanity. Stefan