Re: Basic Info

2015-05-30 Thread Laura Creighton
In a message of Sat, 30 May 2015 22:35:25 -0700, ch.tanvee...@gmail.com writes: >Hi friends, >M Tanveer, and wanna start to learn python language, i've installed python on >my Windows (OS) and set path to it, Now please Guide me which editor is best >to use and what instructions should be followe

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Laura Creighton
In a message of Sun, 31 May 2015 09:52:29 +1000, "Steven D'Aprano" writes: >How many PyPy sandboxes are being used with hostile users motivated to break >out of the sandbox? > >"I wrote a sandbox which I can't break out of" is different from "I wrote a >sandbox which nobody can break out of". Javas

Basic Info

2015-05-30 Thread ch . tanveer13
Hi friends, M Tanveer, and wanna start to learn python language, i've installed python on my Windows (OS) and set path to it, Now please Guide me which editor is best to use and what instructions should be followed . Best Regards: Tanveeer Ahmad Thanks -- https://mail.python.org/mailman/listinf

Re: Building an extension module with SWIG

2015-05-30 Thread Stefan Behnel
garyr schrieb am 30.05.2015 um 22:48: > *snip* > >> Compile it ("cythonize -b foo.pyx") and you'll get an extension module >> that >> executes faster than what SWIG would give you and keeps everything in one >> file to improve readability. >> >> [1] http://cython.org/ > > Thanks for your reply. M

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread Rustom Mody
On Sunday, May 31, 2015 at 10:28:39 AM UTC+5:30, Chris Angelico wrote: > On Sun, May 31, 2015 at 2:46 PM, Rustom Mody wrote: > > More to the point no language matches perfectly¹ everything that a learner > > needs to learn. > > Can you write a kernel module in python? (Or Haskell?) > > Can you see

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread Chris Angelico
On Sun, May 31, 2015 at 2:46 PM, Rustom Mody wrote: > More to the point no language matches perfectly¹ everything that a learner > needs to learn. > Can you write a kernel module in python? (Or Haskell?) > Can you see details of machine state and transitions in python? > Can you client-script a b

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread Rustom Mody
On Sunday, May 31, 2015 at 9:55:45 AM UTC+5:30, Chris Angelico wrote: > On Sun, May 31, 2015 at 1:30 PM, Rustom Mody wrote: > > > > In a recent course I taught, I used a[0] and a[1:] to split arrays and write > > recursive functions a la Haskell in Python. > > Is it efficient? no > > Is it idiomat

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread Chris Angelico
On Sun, May 31, 2015 at 1:30 PM, Rustom Mody wrote: > > In a recent course I taught, I used a[0] and a[1:] to split arrays and write > recursive functions a la Haskell in Python. > Is it efficient? no > Is it idiomatic python? NO! > Is it good to do that? That depends on one's priority. > In mine

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread Rustom Mody
On Friday, May 29, 2015 at 9:32:06 PM UTC+5:30, Mike Driscoll wrote: > Hi, > > I've been asked on several occasions to write about intermediate or advanced > topics in Python and I was wondering what the community considers to be > "intermediate" or "advanced". I realize we're all growing in our

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Paul Rubin
davidf...@gmail.com writes: > Thanks for the responses folks. I will briefly summarize them:... I do think you should look at Geordi (the C++ IRC bot) that I linked. It seems to have changed its implementation to use Docker, but either way, lots of the the stuff it did was language independent. --

Re: Building an extension module with SWIG

2015-05-30 Thread garyr
"garyr" wrote in message news:mkco9p$gf8$1...@speranza.aioe.org... > I'm trying to create an extension module using SWIG. I've > succeeded in generating a pyd file but when I import the module I get the > error message: "SystemError: dynamic module not initialized properly." I > added an initfoo

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread C.D. Reimer
On 5/29/2015 9:01 AM, Mike Driscoll wrote: I've been asked on several occasions to write about intermediate or advanced topics in Python and I was wondering what the community considers to be "intermediate" or "advanced". I'm trying my hand at Cython (http://cython.org/). I just know enough of

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Modulok
While this thread is indeed a theoretical discussion of the interpreter, for a practical solution where you control the host environment, one might look into OS level sandboxing like FreeBSD's Jails (not to be confused with a simple chroot environment) along with various resource limiting parameter

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Steven D'Aprano
On Sat, 30 May 2015 09:24 pm, Laura Creighton wrote: > In a message of Sat, 30 May 2015 19:00:14 +1000, "Steven D'Aprano" writes: >>I wouldn't have imagined that the claim "it's easier to secure a small >>language with a few features than a big language with lots of features" >>would have been so

Re: should "self" be changed?

2015-05-30 Thread zipher
On Thursday, May 28, 2015 at 11:59:36 AM UTC-5, Marko Rauhamaa wrote: > Ian Kelly : > > I think I would be more inclined to use enums. This has the advantages > > of not creating a new set of state classes for every connection > > instance and that each state is a singleton instance, allowing thing

Re: should "self" be changed?

2015-05-30 Thread zipher
On Wednesday, May 27, 2015 at 8:00:49 AM UTC-5, Todd wrote: > On Wed, May 27, 2015 at 2:40 PM, zipher wrote: > On Wednesday, May 27, 2015 at 6:30:16 AM UTC-5, Ben Finney wrote: > > > Steven D'Aprano writes: > > > > > > > On Wednesday 27 May 2015 14:39, Ben Finney wrote: > > > > > > > > > Tha

Re: should "self" be changed?

2015-05-30 Thread zipher
On Wednesday, May 27, 2015 at 2:39:21 AM UTC-5, Marko Rauhamaa wrote: > Chris Angelico : > > > Using some other name in place of "self" should definitely remain > > *possible*, but not commonly done. > > You are effectively making the argument that Python has made a mistake > by not giving "self"

Re: should "self" be changed?

2015-05-30 Thread zipher
On Wednesday, May 27, 2015 at 12:48:02 AM UTC-5, Steven D'Aprano wrote: > On Wednesday 27 May 2015 14:39, Ben Finney wrote: > > > zipher writes: > > > >> Arrgh. Sorry, that was meant privately... > > > > I'm glad we saw it publicly, so that we get more of an idea how you > > treat people. > >

Re: should "self" be changed?

2015-05-30 Thread zipher
On Tuesday, May 26, 2015 at 11:40:20 PM UTC-5, Ben Finney wrote: > zipher writes: > > > Arrgh. Sorry, that was meant privately... > > I'm glad we saw it publicly, so that we get more of an idea how you > treat people. Ben, he asked for it. Stop assuming. > That kind of homophobic slur is ina

Re: Building an extension module with SWIG

2015-05-30 Thread garyr
"garyr" wrote in message news:mkd7nk$isi$1...@speranza.aioe.org... > *snip* > >> Compile it ("cythonize -b foo.pyx") and you'll get an extension module >> that >> executes faster than what SWIG would give you and keeps everything in one >> file to improve readability. >> >> Stefan >> >> >> [1] ht

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Paul Rubin
Chris Angelico writes: > Turing completeness isn't the whole story. How do you go about > sandboxing a Brainf* implementation such that it can be used to > implement Python, but can't be used to read or arbitrary files from > your file system? We're talking about sandboxing, so preventing the san

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread Chris Angelico
On Sun, May 31, 2015 at 5:32 AM, jonathon wrote: > On 29/05/2015 16:01, Mike Driscoll wrote: > >>I was wondering what the community considers to be "intermediate" or "a > dvanced". > > A python script that compiles python code. What do you mean by "compiles"? Something as simple as an import stat

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Chris Angelico
On Sun, May 31, 2015 at 6:00 AM, Paul Rubin wrote: > Steven D'Aprano writes: >> I wouldn't have imagined that the claim "it's easier to secure a small >> language with a few features than a big language with lots of features" >> would have been so controversial. > > Consider that if the small lan

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread Albert-Jan Roskam via Python-list
Metaclasses, abc, asyncio, ast, some of the dunder methods, eg __del__, weakref, perhaps gc-- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Laura Creighton
In a message of Sat, 30 May 2015 20:42:49 +0200, Stefan Behnel writes: >So here the cost of security is actually rewriting the entire language >runtime and potentially also major parts of its ecosystem? Not exactly a >cheap price either. > >Stefan Well, the runtime is mostly generated, you don't

Re: Building an extension module with SWIG

2015-05-30 Thread garyr
*snip* > Compile it ("cythonize -b foo.pyx") and you'll get an extension module > that > executes faster than what SWIG would give you and keeps everything in one > file to improve readability. > > Stefan > > > [1] http://cython.org/ > > Thanks for your reply. My interest is not in computing the g

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Paul Rubin
Steven D'Aprano writes: > I wouldn't have imagined that the claim "it's easier to secure a small > language with a few features than a big language with lots of features" > would have been so controversial. Consider that if the small language is Turing-complete, you can use it to implement the bi

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread jonathon
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 29/05/2015 16:01, Mike Driscoll wrote: >I was wondering what the community considers to be "intermediate" or "a dvanced". A python script that compiles python code. jonathon -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBA

Re: Building an extension module with SWIG

2015-05-30 Thread Stefan Behnel
garyr schrieb am 30.05.2015 um 18:22: > I'm trying to create an extension module using SWIG. I've > succeeded in generating a pyd file but when I import the module I get the > error message: "SystemError: dynamic module not initialized properly." I > added an initfoo() function but that didn't solv

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Stefan Behnel
Laura Creighton schrieb am 30.05.2015 um 13:24: > As a point of fact, We've _already got_ Topaz, a Ruby interpreter, > Hippy, a PHP interpreter, a Prolog interpreter, a Smalltalk > interpeter, and a javascript interpreter. Recently we got Pyket a > Racket compiler. There also exist plenty of expe

Building an extension module with SWIG

2015-05-30 Thread garyr
I'm trying to create an extension module using SWIG. I've succeeded in generating a pyd file but when I import the module I get the error message: "SystemError: dynamic module not initialized properly." I added an initfoo() function but that didn't solve the problem. Below are the various files, a

Re: Python write to spreadsheet?

2015-05-30 Thread Pablo Lucena
Try openpyxl - I've found this to be a really nice library for interacting with MS Excel. On Sat, May 30, 2015 at 5:30 AM, Justin Thyme wrote: > Is it possible to write a Python program that will start MS Excel, create > a spreadsheet and fill cells A1 to A10 (say) with the data in a Python > ar

Re: Minus operator versus unary minus

2015-05-30 Thread Dave Farrance
Peter Otten <__pete...@web.de> wrote: >so both +0.0 and -0.0 would be skipped anyway. Maybe the coder was simply aiming for visibility. The unary minus can be hard to spot in some circumstances. e.g.: I've sneaked a unary minus into this maths proof, which makes it horrible (although correct):

Re: Python write to spreadsheet?

2015-05-30 Thread Tim Chase
On 2015-05-30 10:30, Justin Thyme wrote: > Is it possible to write a Python program that will start MS Excel, > create a spreadsheet and fill cells A1 to A10 (say) with the data > in a Python array? The answer is surely yes, but is there an > outline of how to do it somewhere? it depends on how

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Chris Angelico
On Sat, May 30, 2015 at 10:06 PM, BartC wrote: > On 29/05/2015 23:49, Chris Angelico wrote: >> That's 64-bit integers, not arbitrary-precision, but that's something >> at least. You do still need to worry about what happens when your >> numbers get too big; in Python, you simply don't. So it's sti

Model Dumping Pickle

2015-05-30 Thread subhabrata . banerji
Dear Group, If I use pickle to dump my model as follows, >>> from gensim.models import Word2Vec >>> from nltk.corpus import brown, movie_reviews, treebank >>> b = Word2Vec(brown.sents()) >>> import pickle >>> f = open('my_classifier5.pickle', 'wb') >>> pickle.dump(b, f) >>> f.close() >>> f1= ope

Re: What is considered an "advanced" topic in Python?

2015-05-30 Thread Sturla Molden
Mike Driscoll wrote: > Hi, > > I've been asked on several occasions to write about intermediate or > advanced topics in Python and I was wondering what the community > considers to be "intermediate" or "advanced". I realize we're all growing > in our abilities with the language, so this is going

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread BartC
On 29/05/2015 23:49, Chris Angelico wrote: On Sat, May 30, 2015 at 4:33 AM, Paul Rubin wrote: Chris Angelico writes: Looks to me as if Lua doesn't have integers at all They fixed that in Lua 5.3: http://www.lua.org/manual/5.3/readme.html#changes That's 64-bit integers, not arbitrary-p

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Laura Creighton
In a message of Sat, 30 May 2015 19:00:14 +1000, "Steven D'Aprano" writes: >I wouldn't have imagined that the claim "it's easier to secure a small >language with a few features than a big language with lots of features" >would have been so controversial. I wonder if this claim will be equally as >c

Re: Python write to spreadsheet?

2015-05-30 Thread Laura Creighton
I use this: https://pypi.python.org/pypi/xlutils Documentation here: http://pythonhosted.org/xlutils/ website full of advice here: http://www.python-excel.org/ Tutorial I took at Europython where I learned a lot of stuff http://www.simplistix.co.uk/presentations/python-excel.pdf Laura -- https

Re: Python write to spreadsheet?

2015-05-30 Thread Joel Goldstick
On Sat, May 30, 2015 at 5:40 AM, Tim Golden wrote: > On 30/05/2015 10:30, Justin Thyme wrote: >> >> Is it possible to write a Python program that will start MS Excel, >> create a spreadsheet and fill cells A1 to A10 (say) with the data in a >> Python array? The answer is surely yes, but is there

Re: Python write to spreadsheet?

2015-05-30 Thread Tim Golden
On 30/05/2015 10:30, Justin Thyme wrote: Is it possible to write a Python program that will start MS Excel, create a spreadsheet and fill cells A1 to A10 (say) with the data in a Python array? The answer is surely yes, but is there an outline of how to do it somewhere? This is still a good pl

Python write to spreadsheet?

2015-05-30 Thread Justin Thyme
Is it possible to write a Python program that will start MS Excel, create a spreadsheet and fill cells A1 to A10 (say) with the data in a Python array? The answer is surely yes, but is there an outline of how to do it somewhere? -- Shall we only threaten and be angry for an hour? When the st

Re: Minus operator versus unary minus

2015-05-30 Thread Serhiy Storchaka
On 30.05.15 12:09, Peter Otten wrote: Serhiy Storchaka wrote: On 30.05.15 10:56, Peter Otten wrote: The following modification of the collections.Counter implementation https://hg.python.org/cpython/rev/fe4efc0032b5 was just checked in with the line result[elem] = 0 - count Does this have a

Re: Minus operator versus unary minus

2015-05-30 Thread Peter Otten
Serhiy Storchaka wrote: > On 30.05.15 10:56, Peter Otten wrote: >> The following modification of the collections.Counter implementation >> >> https://hg.python.org/cpython/rev/fe4efc0032b5 >> >> was just checked in with the line >> >> result[elem] = 0 - count >> >> Does this have an advantage over

Re: Creating a reliable sandboxed Python environment

2015-05-30 Thread Steven D'Aprano
On Sat, 30 May 2015 02:48 pm, Paul Rubin wrote: > Chris Angelico writes: >> You can *easily* sandbox something that has very little functionality >> - all you have to do is provide a minimalist "language" that permits >> only a very few actions, and you know it's safe. But that security >> comes

Re: Minus operator versus unary minus

2015-05-30 Thread Serhiy Storchaka
On 30.05.15 10:56, Peter Otten wrote: The following modification of the collections.Counter implementation https://hg.python.org/cpython/rev/fe4efc0032b5 was just checked in with the line result[elem] = 0 - count Does this have an advantage over the obvious result[elem] = -count ? x = 0.

Re: Minus operator versus unary minus

2015-05-30 Thread Peter Otten
Steven D'Aprano wrote: > On Sat, 30 May 2015 05:56 pm, Peter Otten wrote: > >> The following modification of the collections.Counter implementation >> >> https://hg.python.org/cpython/rev/fe4efc0032b5 >> >> was just checked in with the line >> >> result[elem] = 0 - count >> >> Does this have

Re: Minus operator versus unary minus

2015-05-30 Thread Steven D'Aprano
On Sat, 30 May 2015 05:56 pm, Peter Otten wrote: > The following modification of the collections.Counter implementation > > https://hg.python.org/cpython/rev/fe4efc0032b5 > > was just checked in with the line > > result[elem] = 0 - count > > Does this have an advantage over the obvious > > re

Minus operator versus unary minus

2015-05-30 Thread Peter Otten
The following modification of the collections.Counter implementation https://hg.python.org/cpython/rev/fe4efc0032b5 was just checked in with the line result[elem] = 0 - count Does this have an advantage over the obvious result[elem] = -count ? -- https://mail.python.org/mailman/listinfo/pyt