On 11/13/2016 08:40 PM, Kaylen Wheeler wrote:
> I wonder if Lua would be a better option. Does it suffer from the
> same sandboxing issues that python does?
Lua was designed for this sort of thing and it can be secured and sandboxed.
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Nov 14, 2016 at 6:25 AM, Serhiy Storchaka wrote:
> On 14.11.16 02:40, Steve D'Aprano wrote:
>>
>> I'm surprised that the inspect module doesn't appear to have isiterable
>> and isiterator functions. Here's my first attempt at both:
>
> Just use isinstance() with collections ABC classes.
E
On 14.11.16 02:40, Steve D'Aprano wrote:
I'm surprised that the inspect module doesn't appear to have isiterable and
isiterator functions. Here's my first attempt at both:
Just use isinstance() with collections ABC classes.
--
https://mail.python.org/mailman/listinfo/python-list
On Monday 14 November 2016 16:04, Chris Angelico wrote:
> True, but ISTR there being a possibility that __iter__ could raise to
> indicate that this isn't actually iterable. Maybe I'm recalling wrong.
If __iter__ raises, that's a bug :-)
Raising an exception from __iter__ appears to just fall th
On Mon, Nov 14, 2016 at 5:20 AM, Steven D'Aprano
wrote:
> but what magic do I need? globals() is no good, because it returns the
> library's global namespace, not the caller's.
>
> Any solution ought to work for CPython, IronPython and Jython, at a minimum.
You can access the globals of the calle
Suppose I have a library function that reads a global configuration setting:
# Toy example
SPAMIFY = True
def make_spam(n):
if SPAMIFY:
return "spam"*n
else:
return "ham"*n
Don't tell me to make SPAMIFY a parameter of the function. I know that. That's
what I would normal
Michael Torrie wrote:
And such bindings may need to be two-way.
For example in Python code you may want to instantiate some new instance
of game object, and you'll need to make sure that the wrapper code will
create the appropriate in-game object.
Another thing that can be tricky about this is
On Mon, Nov 14, 2016 at 3:54 PM, Steven D'Aprano
wrote:
>> Any particular reason to write it that way, rather than:
>>
>> def isiterable(obj):
>> try:
>> iter(obj)
>> return True
>> except TypeError:
>> return False
>
>
> class BadIterable:
> def __iter__(self):
Poul Riis wrote:
However, when sending the .stl file produced to a 3D-printer the vase comes
out as a filled solid - no room for water and flowers!
My guess is that you have a problem with the orientation
of your faces. The inner surface needs to have its triangles
oriented so that their "outsi
On Monday 14 November 2016 11:59, Chris Angelico wrote:
> On Mon, Nov 14, 2016 at 11:40 AM, Steve D'Aprano
> wrote:
>> def isiterable(obj):
>> """Return True if obj is an iterable, and False otherwise.
>>
>> Iterable objects can be iterated over, and they provide either
>> an __iter__
I wonder if Lua would be a better option. Does it suffer from the same
sandboxing issues that python does?
On Sunday, 13 November 2016 17:38:23 UTC-8, Nathan Ernst wrote:
> In regards to performance of Lua vs Python, I don't have enough (near zero
> experience) with Lua to comment there.
>
> B
Running the following codes (deen.py) under Win32 python 3.4.4 terminal:
tbli = [0x66, 0x27, 0xD0]
tblm = [0 for x in range(3)]
def gpa(data):
td = data ^ tblm[2]
return td
I can get a correct answer this way:
>>> import deen
>>> deen.tblm = deen.tbli
>>> deen.gpa(0x7d)
173 # 0xad (= 0x7
In regards to performance of Lua vs Python, I don't have enough (near zero
experience) with Lua to comment there.
But in regards to embedding in a game, the only experience I have w/ Python
being embedded is while working on modding Civilization IV. What I saw
there just made me nauseous.
The rea
On 11/13/2016 12:10 AM, kfjwhee...@gmail.com wrote:
> 2. How would I go about including python scripts to run with the
> engine. Would the .py files from the standard libraries be
> necessary, or is anything built in?
It's usually just a matter of asking the python instance to load and run
the s
On Mon, Nov 14, 2016 at 11:40 AM, Steve D'Aprano
wrote:
> On Mon, 14 Nov 2016 12:23 am, Chris Angelico wrote:
>
>> Python without its stdlib is a disappointingly featureless
>> language :)
>
>
> I don't think that's true. You can do a lot in Python without any imports in
> your code:
>
> - basic s
On Mon, Nov 14, 2016 at 11:40 AM, Steve D'Aprano
wrote:
> def isiterable(obj):
> """Return True if obj is an iterable, and False otherwise.
>
> Iterable objects can be iterated over, and they provide either
> an __iter__ method or a __getitem__ method.
>
> Iteration over an object
On Mon, 14 Nov 2016 12:23 am, Chris Angelico wrote:
> Python without its stdlib is a disappointingly featureless
> language :)
I don't think that's true. You can do a lot in Python without any imports in
your code:
- basic string processing
- BigNum (int) and float arithmetic
- lists and tuples
On Mon, 14 Nov 2016 07:02 am, Antoon Pardon wrote:
>
> Some time ago I read a text or saw a video on iterators and one thing
> I remember from it, is that you should do something like the following
> when working with iterators, to avoid some pitt falls.
>
> def bar(iterator):
> if iter(iter
Below you can find my python code to make a vase for 3D-printing.
The vase looks nice on my screen so the vertices and the faces seem to be
perfect.
However, when sending the .stl file produced to a 3D-printer the vase comes out
as a filled solid - no room for water and flowers!
I have tried to s
On Mon, Nov 14, 2016 at 8:57 AM, Gregory Ewing
wrote:
> Antoon Pardon wrote:
>
>> def bar(iterator):
>> if iter(iterator) is iterator:
>> ...
>
>
> That's a way of finding out whether you can safely iterate
> over something more than once. If the object is already an
> iterator, applyi
Hi,
On 13/11/16 20:09, menta...@gmail.com wrote:
HI want to make a script that if somthing happens, it stop, and if it doesnt,
it couninues. I dont finding a smart way.
Read the documentation for the "while", "break" and "continue" keywords.
Regards, E.
--
https://mail.python.org/mailman/li
Antoon Pardon wrote:
def bar(iterator):
if iter(iterator) is iterator:
...
That's a way of finding out whether you can safely iterate
over something more than once. If the object is already an
iterator, applying iter() to it will return the same
object, and iterating over it will c
On Mon, Nov 14, 2016 at 7:02 AM, Antoon Pardon
wrote:
> Some time ago I read a text or saw a video on iterators and one thing
> I remember from it, is that you should do something like the following
> when working with iterators, to avoid some pitt falls.
>
> def bar(iterator):
> if iter(itera
Hii there
I am preety New at python, and i need your help. I want to make a script that
if somthing happens, it stop, and if it doesnt, it couninues. I dont finding a
smart way. Here is what i wrote. I want to do it without exits and sleeps.
import time
print ("hello there ")
x = raw_input ("
Some time ago I read a text or saw a video on iterators and one thing
I remember from it, is that you should do something like the following
when working with iterators, to avoid some pitt falls.
def bar(iterator):
if iter(iterator) is iterator:
...
However I can't relocate it and ca
andy writes:
> Sat, 12 Nov 2016 04:58:20 -0800 wrote guy asor:
>
>> hello!
>>
>> this is my code:
>>
>> word=raw_input()
>> print word*3
>>
>>
>> with this code im getting - wordwordword.
>> what changes i need to make to get - word word word - instead?
>>
>> thanks
>
> using python3.x:
>
> w
Sun, 13 Nov 2016 15:12:01 +0100 wrote andy:
> word=input()
> print((word+' ')*2, end='')
> print(word)
>
> ..but D'Apranos ' '.join(..) is far more elegant.
don't know whether I really would use this form, but it works in python3:
word = ' '.join([input()]*3)
print(word)
--
https://mail.pytho
Sat, 12 Nov 2016 04:58:20 -0800 wrote guy asor:
> hello!
>
> this is my code:
>
> word=raw_input()
> print word*3
>
>
> with this code im getting - wordwordword.
> what changes i need to make to get - word word word - instead?
>
> thanks
using python3.x:
word=input()
print((word+' ')*2, end
On Sun, Nov 13, 2016 at 6:10 PM, wrote:
>
> (Sorry about the last post, my finger slipped before I was finished, and I
> can't delete it for some reason.)
(That's because this is a mailing list and newsgroup gatewayed to each
other. Once sent, a message cannot be edited or deleted.)
> A friend
kfjwhee...@gmail.com writes:
> A friend of mine is developing a game engine, and I would like to
> extend the engine by adding some scripting functionality.
I haven't done it myself. But the Python Wiki has some pages that will
help you, I think:
* https://wiki.python.org/moin/AppsWithPythonScr
30 matches
Mail list logo