Steven D'Aprano wrote:
I'm arguing with those who insist that objects of type MethodType aren't
methods, and objects of type FunctionType aren't functions but methods,
except when they are, based on that simplified, incomplete glossary entry.
I'm not arguing that based on the glossary entry. I
Steven D'Aprano wrote:
Er, perhaps "code injection" is not the best name for this, on account of it
also being the name for a security vulnerability anti-pattern:
I'm talking about a variety of dependency injection where you either add an
entirely new method to an instance, or give the instan
Steven D'Aprano wrote:
Gregory Ewing wrote:
If things worked the way you want, it would be
impossible to store a function in an instance
attribute and get it out again *without* it
being treated as a method
>
Not impossible, just inconvenient... the
solution is to use a custom descriptor
Bu
On 03Feb2015 18:52, w3t...@gmail.com wrote:
I am trying to extract the following from a data stream using find all what
would be the best way to capture the ip address only from the following text "
ip=192.168.1.36 port=4992 " I also want to make sure the program can handle
the ip that is as h
I am trying to extract the following from a data stream using find all what
would be the best way to capture the ip address only from the following text "
ip=192.168.1.36 port=4992 " I also want to make sure the program can handle the
ip that is as high as 255.255.255.255
Thanks for any help y
On Tuesday, February 3, 2015 at 4:05:57 PM UTC-6, Ian wrote:
> On Tue, Feb 3, 2015 at 10:40 AM, Steven D'Aprano wrote:
> > AT LONG LAST THE LIGHT DAWNS! THE PENNY DROPS!
>
> Careful there, you're starting to sound like Ranting Rick. ;-)
Ha! My meme's are far more catchy and intellectual. But as t
Gregory Ewing wrote:
> Marko Rauhamaa wrote:
>> Right now Python generates the trampoline from the class prototype every
>> time you call a method. If the semantics allowed, you could create the
>> trampoline at instantiation time (for better or worse). That way, the
>> problem you seem to be refe
Anssi Saari wrote:
> Steven D'Aprano writes:
>
>> Here's the one-liner:
>>
>> python -c 'import socket;y="0"*5000;socket.gethostbyname(y)'
>>
>>
>> I think it is likely that y="0"*5000 would segfault due to lack of
>> memory on many machines. I wouldn't trust this as a test.
>
> Hmm, ho
Gregory Ewing wrote:
> Marko Rauhamaa wrote:
>> For (almost) all practical purposes, that is the Python way as well. If
>> object instantiation (conceptually) copied the class's methods into the
>> object's dict, you'd get the semantics I'm looking for.
>
> If things worked the way you want, it w
On 02/03/2015 03:32 PM, Marko Rauhamaa wrote:
> Gregory Ewing :
>
>> You seem to be suggesting an optimisation that pre-creates bound
>> methods when the instance is created. Keeping a cache of bound methods
>> would achieve the same thing without changing the semantics. I think
>> CPython might a
On 03/02/2015 23:32, Marko Rauhamaa wrote:
Gregory Ewing :
You seem to be suggesting an optimisation that pre-creates bound
methods when the instance is created. Keeping a cache of bound methods
would achieve the same thing without changing the semantics. I think
CPython might already be doing
On Wed, Feb 4, 2015 at 10:32 AM, Marko Rauhamaa wrote:
> No, I'm saying Python should behave differently.
>
> Python:
>
>>>> class A:
>...def f(self):
>... print("f")
>...def g(self):
>... print("g")
>...
>>>> a = A()
>>>> a.__class__.f = a.__cla
Gregory Ewing :
> You seem to be suggesting an optimisation that pre-creates bound
> methods when the instance is created. Keeping a cache of bound methods
> would achieve the same thing without changing the semantics. I think
> CPython might already be doing that, but I'm not sure.
No, I'm sayin
On 01/25/2015 03:23 PM, Shalini Ravishankar wrote:
Hello Everyone,
I am trying to read(open) and write files in hdfs inside a python script. But
having error.
Please copy/paste the full error traceback.
Can someone tell me what is wrong here.
Code (full): sample.py
#!/usr/bin/python
Marko Rauhamaa wrote:
Right now Python generates the trampoline from the class prototype every
time you call a method. If the semantics allowed, you could create the
trampoline at instantiation time (for better or worse). That way, the
problem you seem to be referring to wouldn't materialize.
S
On Wed, Feb 4, 2015 at 8:16 AM, Dave Angel wrote:
>> Obviously you have to define the branch somehow, but there are plenty
>> of times when you might want to break out of "everything up to here".
>> How do you define that? How do you return lots of levels all at once?
>> I remember facing this exa
On Wed, Feb 4, 2015 at 4:40 AM, Steven D'Aprano
wrote:
> given that the glossary need not be 100% complete and definitive, "function
> defined inside a class body" is close enough to the truth.
* This *
We are arguing, not about an element in a formal grammar, but about a
glossary entry. If one
> On Feb 3, 2015, at 1:00 PM, Poul Riis wrote:
>
> I just tried the Cairo Python module.
> I ran the test file below.
> It works perfectly but instead of saving the resulting image as a file I want
> to see it displayed directly on the screen.
> How can I do that?
>
I have quiet a bit of expe
On Wed, Feb 4, 2015 at 6:38 AM, Anssi Saari wrote:
> Anyways, here's an example calling gethostbyname directly in python:
>
> from ctypes import CDLL
> o = CDLL('libc.so.6')
> for i in range(0, 2500):
> o.gethostbyname('0'*i)
>
> I don't have a vulnerable system to test on any more though.
Th
On Tue, Feb 3, 2015 at 10:40 AM, Steven D'Aprano
wrote:
> AT LONG LAST THE LIGHT DAWNS! THE PENNY DROPS!
Careful there, you're starting to sound like Ranting Rick. ;-)
--
https://mail.python.org/mailman/listinfo/python-list
On 2/2/2015 6:26 PM, Luke Lloyd wrote:
I am in school and there is a problem with my code:
When I try to run my code in the python code in the python shell it
waits about 10 seconds then shows an error that says “IDLE’s subprocess
didn’t make connection. Either IDLE can’t start a subprocess or p
Steven D'Aprano wrote:
If some methods can be defined outside of the body of a class, then being
defined inside the body of a class does not define a method.
Nobody's disputing that. The business about super() is
just a possible reason for the glossary to define the
word 'method' in a more rest
Gregory Ewing :
> Marko Rauhamaa wrote:
>> For (almost) all practical purposes, that is the Python way as well. If
>> object instantiation (conceptually) copied the class's methods into the
>> object's dict, you'd get the semantics I'm looking for.
>
> If things worked the way you want, it would b
On 01/25/2015 08:45 PM, Chris Angelico wrote:
On Mon, Jan 26, 2015 at 12:31 PM, Marko Rauhamaa wrote:
Backtracking means the part of depth-first traversal where you retreat
to the parent node. If you implement your traversal with a recursive
function, backtracking means — more or less — a retur
Marko Rauhamaa wrote:
For (almost) all practical purposes, that is the Python way as well. If
object instantiation (conceptually) copied the class's methods into the
object's dict, you'd get the semantics I'm looking for.
If things worked the way you want, it would be
impossible to store a func
I just tried the Cairo Python module.
I ran the test file below.
It works perfectly but instead of saving the resulting image as a file I want
to see it displayed directly on the screen.
How can I do that?
Poul Riis
import math
import cairo
WIDTH, HEIGHT = 256, 256
surface = cairo.ImageSurf
On 01/24/2015 09:36 PM, Dan Stromberg wrote:
On Sat, Jan 24, 2015 at 6:24 PM, Chris Angelico wrote:
On Sun, Jan 25, 2015 at 1:11 PM, Dan Stromberg wrote:
For simplicity, let's say I've been running the suite of performance
tests within a single interpreter - so I test one module thoroughly,
t
Steven D'Aprano writes:
> Here's the one-liner:
>
> python -c 'import socket;y="0"*5000;socket.gethostbyname(y)'
>
>
> I think it is likely that y="0"*5000 would segfault due to lack of
> memory on many machines. I wouldn't trust this as a test.
Hmm, how much RAM does that one-liner actu
> On Feb 2, 2015, at 5:20 AM, Antoon Pardon
> wrote:
>
> I need to have a program construct a number of designs. Of course I can
> directly
> use a pfd surface and later use a pdf viewer to check. But that becomes rather
> cumbersome fast. But if I use a cairo-surface for on the screen I sudde
On Tue, Feb 3, 2015 at 4:53 AM, Rustom Mody wrote:
> How many people (actually machines) out here are vulnerable?
>
>
> http://security.stackexchange.com/questions/80210/ghost-bug-is-there-a-simple-way-to-test-if-my-system-is-secure
>
> shows a python 1-liner to check
> --
> https://mail.python.o
Devin Jeanpierre wrote:
> On Mon, Feb 2, 2015 at 6:07 AM, Steven D'Aprano
> wrote:
>> Run this code:
>>
>> # === cut ===
>>
>> class K(object):
>> def f(self): pass
>>
>> def f(self): pass
>>
>> instance = K()
>> things = [instance.f, f.__get__(instance, K)]
>> from random import shuffle
>> s
On 02/03/2015 04:19 AM, Steven D'Aprano wrote:
> Anssi Saari wrote:
>
>> Rustom Mody writes:
>>
>>> How many people (actually machines) out here are vulnerable?
>>>
>>>
> http://security.stackexchange.com/questions/80210/ghost-bug-is-there-a-simple-way-to-test-if-my-system-is-secure
>>>
>>> shows
On 2/3/2015 8:31 AM, Mark Lawrence wrote:
On 03/02/2015 14:34, Emile van Sebille wrote:
On 2/3/2015 6:21 AM, Dennis Lee Bieber wrote:
The second is to use Google...
https://www.google.com/?gws_rd=ssl#q=python+idle+can%27t+make+connection
but the first page of results isn't helping -- lo
On Tue, Feb 3, 2015 at 10:31 AM, Mark Lawrence
wrote:
> I know that you can target sites, but can you exclude them, e.g.
> -site:stackoverflow.com ?
Yes, you can. Compare the results of these two searches, for example:
git initial push
git initial push -site:stackoverflow.com
Skip
--
https://
On 03/02/2015 15:03, Filadelfo Fiamma wrote:
I think You can try the asyncore lib:
https://docs.python.org/2/library/asyncore.html
People can try it but it's effectively deprecated, with its partner
asynchat, in favour of asyncio.
Also please don't top post here, thank you.
--
My fellow Py
On 03/02/2015 14:34, Emile van Sebille wrote:
On 2/3/2015 6:21 AM, Dennis Lee Bieber wrote:
The second is to use Google...
https://www.google.com/?gws_rd=ssl#q=python+idle+can%27t+make+connection
but the first page of results isn't helping -- lots of reports of the
problem, but no firm r
Op 03-02-15 om 13:17 schreef Nobody:
> On Mon, 02 Feb 2015 14:20:56 +0100, Antoon Pardon wrote:
>
>> I need to have a program construct a number of designs. Of course I can
>> directly use a pfd surface and later use a pdf viewer to check. But that
>> becomes rather cumbersome fast. But if I use a
I think You can try the asyncore lib:
https://docs.python.org/2/library/asyncore.html
2015-02-03 15:50 GMT+01:00 Yassine Chaouche <
yacinechaou...@yahoo.com.dmarc.invalid>:
> On Tuesday, February 3, 2015 at 3:17:37 PM UTC+1, Amirouche Boubekki wrote:
> > What you want is to prevent the socket to
On Tuesday, February 3, 2015 at 3:17:37 PM UTC+1, Amirouche Boubekki wrote:
> What you want is to prevent the socket to wait indefinetly for data (based on
> strace output) which is done with socket.setblocking/settimeout [1]
Exactly ! thanks for taking time to reading my original post a second t
On Wed, Feb 4, 2015 at 1:34 AM, Emile van Sebille wrote:
> On 2/3/2015 6:21 AM, Dennis Lee Bieber wrote:
>
>> The second is to use Google...
>>
>> https://www.google.com/?gws_rd=ssl#q=python+idle+can%27t+make+connection
>>
>> but the first page of results isn't helping -- lots of reports
On 2/3/2015 6:21 AM, Dennis Lee Bieber wrote:
The second is to use Google...
https://www.google.com/?gws_rd=ssl#q=python+idle+can%27t+make+connection
but the first page of results isn't helping -- lots of reports of the
problem, but no firm remedy listed.
it was suggested to me rec
Chris Angelico :
> Threading is not such a bugbear as a lot of people
> seem to think. Yes, some platforms have traditionally had poor
> implementations
Java has excellent multithreading facilities. Still, I have seen
seasoned Java developers commit atrocious crimes against thread-safety
that are
> The standard library and nonblocking can't be used in the same sentence.
python 2.x stdlib has no high level support of *async* code. There is
trollius library that ports asyncio to py2 though.
I was a bit quick in my first anwser. What you want is to prevent the
socket to wait indefinetly for
On Mon, Feb 2, 2015 at 4:26 PM, Luke Lloyd wrote:
> I am in school and there is a problem with my code:
>
>
>
> When I try to run my code in the python code in the python shell it waits
> about 10 seconds then shows an error that says “IDLE’s subprocess didn’t
> make connection. Either IDLE can’t
On Mon, Feb 2, 2015 at 4:26 PM, Luke Lloyd wrote:
> I am in school and there is a problem with my code:
>
>
>
> When I try to run my code in the python code in the python shell it waits
> about 10 seconds then shows an error that says “IDLE’s subprocess didn’t
> make connection. Either IDLE can’t
On Wed, Feb 4, 2015 at 12:45 AM, Marko Rauhamaa wrote:
>> But your comment is interesting because, as I understand it, a
>> non-blocking web server is simply a matter of setting timeouts on
>> sockets, catch the exceptions and move on.
>
> Now I think you might have some misconceptions about nonbl
Yassine Chaouche :
> On Tuesday, February 3, 2015 at 12:35:32 PM UTC+1, Marko Rauhamaa wrote:
>> So far I've been happy with select.epoll(), socket.socket() and ten
>> fingers.
>
> [...]
>
> But your comment is interesting because, as I understand it, a
> non-blocking web server is simply a matter
On Tue, Feb 3, 2015 at 11:56 PM, Yassine Chaouche
wrote:
> But your comment is interesting because, as I understand it, a non-blocking
> web server is simply a matter of setting timeouts on sockets, catch the
> exceptions and move on. I don't know why wouldn't that be possible with
> python std
On Tuesday, February 3, 2015 at 12:35:32 PM UTC+1, Marko Rauhamaa wrote:
> So far I've been happy with select.epoll(), socket.socket() and ten
> fingers.
> Marko
There's already software written to take care of much of the HTTP stuff
protocol stuff, the headers etc. I wouldn't rewrite it. I pref
On Mon, 02 Feb 2015 14:20:56 +0100, Antoon Pardon wrote:
> I need to have a program construct a number of designs. Of course I can
> directly use a pfd surface and later use a pdf viewer to check. But that
> becomes rather cumbersome fast. But if I use a cairo-surface for on the
> screen I suddenl
On 03/02/2015 11:04, Yassine Chaouche wrote:
Thanks Marko. It's a lost cause then.
You trimmed out the part where he mentioned asyncio. :)
ChrisA
IIRC asyncio is python 3 only and I'm not ready yet to make the leap.
The leap from Python 2 to Python 3 is about as high as the second
obst
Steven D'Aprano wrote:
In Python 2, they are methods. In Python 3, they are functions, and aren't
converted into methods until you access them via the instance:
They're methods in both cases. They don't have to be
"converted into methods"; they already are, by virtue
of their location and inte
On Mon, 02 Feb 2015 15:21:07 -0800, Gabriel Ferreira wrote:
> Mark Lawrence wrote:
>
>> I don't actually know, but could you please provide some context and
>> write in plain English, those damn ... things are extremely annoying.
>>
>>
> Hi, Mark.
>
> I am developing a research project, which
Chris Angelico :
> On Tue, Feb 3, 2015 at 10:04 PM, Yassine Chaouche
>> IIRC asyncio is python 3 only and I'm not ready yet to make the leap.
>
> Then you're stuck with whatever you have, because the Py2 standard
> library isn't being expanded any. Why not make the leap? Py3 has a lot
> of advanta
Steven D'Aprano wrote:
Both K.f and K.g are methods, even though only one meets the definition
given in the glossary. The glossary is wrong.
Or rather, it is not so much that it is *wrong*, but that it is incomplete
and over-simplified.
I agree with that; a more complete definition would be
"a
Chris Angelico :
> On Tue, Feb 3, 2015 at 9:38 PM, Marko Rauhamaa wrote:
>> It's slightly sad that Python exposes the two-level attribute lookup.
>> It would be more elegant if, conceptually, all methods were retrieved
>> from the object's attribute dict. That way, the class would be simply
>> a
Thanks Chris, it's only a matter of time, I'll eventually make the transition
to python3 when I'll learn it well enough.
--
https://mail.python.org/mailman/listinfo/python-list
Anssi Saari wrote:
> Rustom Mody writes:
>
>> How many people (actually machines) out here are vulnerable?
>>
>>
http://security.stackexchange.com/questions/80210/ghost-bug-is-there-a-simple-way-to-test-if-my-system-is-secure
>>
>> shows a python 1-liner to check
>
> Does that check actually wo
On Tue, Feb 3, 2015 at 10:04 PM, Yassine Chaouche
wrote:
>> > Thanks Marko. It's a lost cause then.
>>
>> You trimmed out the part where he mentioned asyncio. :)
>>
>> ChrisA
>
> IIRC asyncio is python 3 only and I'm not ready yet to make the leap.
Then you're stuck with whatever you have, becaus
> > Thanks Marko. It's a lost cause then.
>
> You trimmed out the part where he mentioned asyncio. :)
>
> ChrisA
IIRC asyncio is python 3 only and I'm not ready yet to make the leap.
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, Feb 3, 2015 at 9:47 PM, Yassine Chaouche
wrote:
> On Tuesday, February 3, 2015 at 10:27:11 AM UTC+1, Marko Rauhamaa wrote:
>> The standard library and nonblocking can't be used in the same sentence.
>
> Thanks Marko. It's a lost cause then.
You trimmed out the part where he mentioned asyn
On Tuesday, February 3, 2015 at 10:27:11 AM UTC+1, Marko Rauhamaa wrote:
> The standard library and nonblocking can't be used in the same sentence.
Thanks Marko. It's a lost cause then. I am thinking about switching to one of
the following :
- CherryPy
- Bottle
- circuits
- Quixote
- Weblay
On Tue, Feb 3, 2015 at 9:38 PM, Marko Rauhamaa wrote:
> It's slightly sad that Python exposes the two-level attribute lookup. It
> would be more elegant if, conceptually, all methods were retrieved from
> the object's attribute dict. That way, the class would be simply a
> mundane optimization tri
Devin Jeanpierre :
> It isn't mystical. There are differences in semantics of defining
> methods inside or outside of a class that apply in certain situations
> (e.g. super(), metaclasses). You have cherrypicked an example that
> avoids them.
It's slightly sad that Python exposes the two-level at
Rustom Mody writes:
> How many people (actually machines) out here are vulnerable?
>
> http://security.stackexchange.com/questions/80210/ghost-bug-is-there-a-simple-way-to-test-if-my-system-is-secure
>
> shows a python 1-liner to check
Does that check actually work for anyone? That code didn't s
Yassine Chaouche :
> I was hoping to use something very simple and already provided by the
> standard library.
The standard library and nonblocking can't be used in the same sentence.
That is, unless and until you go asyncio.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Feb 2, 2015 at 6:20 AM, Steven D'Aprano
wrote:
> Devin Jeanpierre wrote:
>> Oops, I just realized why such a claim might be made: the
>> documentation probably wants to be able to say that any method can use
>> super(). So that's why it claims that it isn't a method unless it's
>> defined
On Mon, Feb 2, 2015 at 6:07 AM, Steven D'Aprano
wrote:
> Run this code:
>
> # === cut ===
>
> class K(object):
> def f(self): pass
>
> def f(self): pass
>
> instance = K()
> things = [instance.f, f.__get__(instance, K)]
> from random import shuffle
> shuffle(things)
> print(things)
>
> # === c
Thank you Amirouch. I was hoping to use something very simple and already
provided by the standard library. If I can fix the script, the better. If the
script can't be fixed, then I'll switch to another library (I already have one
in mind).
--
https://mail.python.org/mailman/listinfo/python-l
Hello Irmen,
> Why? If you have multiple threads serving some requests at the same time,
> doesn't that
> already achieve your goal?
Having multiple requests running at a time is one thing. Making them
non-blocking is another. That's how I understand it.
> In other words, have you tried what
I am in school and there is a problem with my code:
When I try to run my code in the python code in the python shell it waits
about 10 seconds then shows an error that says “IDLE’s subprocess didn’t
make connection. Either IDLE can’t start a subprocess or personal firewall
software is blocking t
71 matches
Mail list logo