Would like some design feedback.
I am working on a module that works out this idea of a piline in python http://code.activestate.com/recipes/580625-collection-pipeline-in-python I have a number of design questions I would like some feedback on. 1) In the recipe the '|' is used as the pipe line operator. I like that for its similar use in unix-shells. However I have been thinking about using '>>' instead. What would your preference be and why. 2) I also want these classes to be composable. So that if I would do something like: Process = Map(double) @ Map(add1) range(10) | Process would act the same as range(10) | Map(double) | Map(add1) What operator would I use for this? Should I use the same operator as for question 1 or a different one? If a different one which one? -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list
Re: Global variable is undefined at the module level
jacksonhaenc...@gmail.com writes: > This is not accurate. I just tested this in python3 and using the global > keyword allowed me to declare a variable inside the function that was > then visible from the outer scope. What do you mean by that? Anything other than what was said here? > On Tuesday, September 13, 2016 at 6:50:39 AM UTC-5, dieter wrote: >> In order to define "VVV", you must assign a value to it -- either >> directly in the "global" (i.e. module) namespace or in your function >> (together with a "global VVV" declaration). Without assignment the variable will not exist in the module namespace: >>> def testfunc(): ... global globvar ... pass ... >>> globvar Traceback (most recent call last): File "", line 1, in NameError: name 'globvar' is not defined >>> testfunc() >>> globvar Traceback (most recent call last): File "", line 1, in NameError: name 'globvar' is not defined >>> def testfunc(): ... global globvar ... globvar = 1 ... >>> globvar Traceback (most recent call last): File "", line 1, in NameError: name 'globvar' is not defined >>> testfunc() >>> globvar 1 -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list
Python Resources related with web security
Hello, can anyone post links for python resources that contain tools and scripts related with security and pentesting? not looking for the obvious such as OWASP,etc can anyone post a list of interesting links? you can also include blogs and forums.. Thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: nonlocal fails ?
On 2019-11-14 20:29:01 -0500, Dennis Lee Bieber wrote: > Instead, at a simple level (a common description invokes "Post-It" > notes) > > x = y > > means /find/ the object (somewhere in memory) that has a note "y" stuck to > it. Without moving the "y" note, attach an "x" note to that same object. > The object now has two names bound to it. If the "x" note used to be > attached to an object, the old object no longer has that name -- and if the > object has NO names attached, it is garbage collected. Frankly, I find that model very unsatisfying. It's not just that it doesn't describe any existing or even plausibly possible implementation or that it implies a complexity that isn't there (search for an object with a note attached to it?). It starts to break down even for simple cases: There may be several variables called "x" in a program. How does the system distinguish between multiple objects with an "x" note? What about objects which have no name, like members of a tuple or the return value of a function? Sure, you can come up with arcane rules to on how to label a post-it to reference an object referenced by the x parameter of the lamba on line 7 of the third recursive invocation of function foo within the method bar of the Gazonk class in the fred packagerbut called from Bobble ... (ok, I'll stop now). But why would you? It's much simpler to talk about references or pointers or whatever you want to call them. You can nicely visualize them with arrows (or pieces of string, if you want, but arrows have the advantage of having a direction) and it describes directly and without any mental gymnastics what is going on (on a conceptual level - actual implementations might be somewhat different, as long as they behave the same). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Resources related with web security
Curiosity: why have recent similar enquiries also come from non-resolving domain names? Recently we've seen security-related enquiries (on more than one Python Discussion List) which don't explicitly claim to come from 'white hat hackers' but which do have the potential to have less-than productive aims or interests. Are such email addresses 'open' and honest? Do they create extra and unnecessary scut-work for ListAdmins? Does such meet PSF 'standards' for honest and respectful interchange? WebRef: https://www.python.org/psf/conduct/ On 24/11/19 8:18 AM, Pycode wrote: Hello, can anyone post links for python resources that contain tools and scripts related with security and pentesting? not looking for the obvious such as OWASP,etc can anyone post a list of interesting links? you can also include blogs and forums.. Thanks -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: nonlocal fails ?
On 11/23/19 4:18 PM, Peter J. Holzer wrote: > On 2019-11-14 20:29:01 -0500, Dennis Lee Bieber wrote: >> Instead, at a simple level (a common description invokes "Post-It" >> notes) >> >> x = y >> >> means /find/ the object (somewhere in memory) that has a note "y" stuck to >> it. Without moving the "y" note, attach an "x" note to that same object. >> The object now has two names bound to it. If the "x" note used to be >> attached to an object, the old object no longer has that name -- and if the >> object has NO names attached, it is garbage collected. > Frankly, I find that model very unsatisfying. > > It's not just that it doesn't describe any existing or even plausibly > possible implementation or that it implies a complexity that isn't there > (search for an object with a note attached to it?). It starts to break > down even for simple cases: There may be several variables called "x" in > a program. How does the system distinguish between multiple objects with > an "x" note? What about objects which have no name, like members of a > tuple or the return value of a function? Sure, you can come up with > arcane rules to on how to label a post-it to reference an object > referenced by the x parameter of the lamba on line 7 of the third > recursive invocation of function foo within the method bar of the Gazonk > class in the fred packagerbut called from Bobble ... (ok, I'll stop > now). But why would you? > > It's much simpler to talk about references or pointers or whatever you > want to call them. You can nicely visualize them with arrows (or pieces > of string, if you want, but arrows have the advantage of having a > direction) and it describes directly and without any mental gymnastics > what is going on (on a conceptual level - actual implementations might > be somewhat different, as long as they behave the same). > > hp A post-it note analogy is a very good description to allow a non-technical person to understand how it works. Yes, as presented, it doesn't handle the concept of scope of variables, but that starts to get into more complexity than you might want for a simple model, and it is simple to extend to handle it, either every scope gets a different color post-it note, or when you write the name of the variable, you include the scope. To a non-techie, a 'Pointer' is either a breed of dog or an arrow pointing in a general direction. The key is that you are showing something fundamentally different than a box to hold a value. If you show names as boxes with arrows in them, someone is going to ask how to get one name point to another name (re the discussion about is it call by value or call by reference) -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list
Re: nonlocal fails ?
On Sun, Nov 24, 2019 at 10:19 AM Richard Damon wrote: > Yes, as presented, it doesn't handle the concept of scope of variables, > but that starts to get into more complexity than you might want for a > simple model, and it is simple to extend to handle it, either every > scope gets a different color post-it note, or when you write the name of > the variable, you include the scope. Or you can try to describe a scope as like a notebook where you say "x is Blue K12" where the thing is identified by a matching note (think raffle tickets). Not sure how useful it'd be, but the concept does at least scale. Recursion means setting down one notebook and picking up another (with most/all of the same names). ChrisA -- https://mail.python.org/mailman/listinfo/python-list