Friday, February 26, 2010

comp.lang.python - 8 new messages in 6 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* taking python enterprise level?... - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/3dca28b82d10655c?hl=en
* staticmethod and namespaces - 3 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/cec504c0c8648597?hl=en
* Hi, I know it's stupid, but does your foreigner do a lot of OT work? - 1
messages, 1 author
http://groups.google.com/group/comp.lang.python/t/80dc4947449ccb3d?hl=en
* Get Mallika Sherawath Bathing Videos in all Angles - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/e3c6d0accba0c031?hl=en
* %%% Funny College Girls Nude Video HERE %%% - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/20f318e5e7463135?hl=en
* scope of generators, class variables, resulting in global na - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/b1ff4d23cb5ec32c?hl=en

==============================================================================
TOPIC: taking python enterprise level?...
http://groups.google.com/group/comp.lang.python/t/3dca28b82d10655c?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Feb 25 2010 8:01 pm
From: "D'Arcy J.M. Cain"


On Fri, 26 Feb 2010 01:12:00 +0100
"Diez B. Roggisch" <deets@nospam.web.de> wrote:
> > That better way turned out to asynchronous update transactions. All we
> > did was keep feeding updates to the remote site and forget about ACKS.
> > We then had a second process which handled ACKS and tracked which
> > packets had been properly transferred. The system had IDs on each
> > update and retries happened if ACKS didn't happen soon enough.
> > Naturally we ignored ACKS that we had already processed.
>
> sounds like using UDP to me, of course with a protocol on top (namely
> the one you implemented).
>
> Any reason you sticked to TCP instead?

TCP does a great job of delivering a stream of data in order and
handling the retries. The app really was connection oriented and we
saw no reason to emulate that over an unconnected protocol. There were
other wheels to reinvent that were more important.

--
D'Arcy J.M. Cain <darcy@druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

==============================================================================
TOPIC: staticmethod and namespaces
http://groups.google.com/group/comp.lang.python/t/cec504c0c8648597?hl=en
==============================================================================

== 1 of 3 ==
Date: Thurs, Feb 25 2010 8:54 pm
From: darnzen


Having an odd problem that I solved, but wondering if its the best
solution (seems like a bit of a hack).

First off, I'm using an external DLL that requires static callbacks,
but because of this, I'm losing instance info. It will make more sense
after I diagram it:

#Module main.py

class App:
def sperg(self):
pass

app = App()
[main loop and such]
-----------------------------
# Module A.py
import main
class Foo:
@staticmethod
chum(nType, nPtr):
# Need to access function / data in app instance
app.sperg(nType, nPtr)

== 2 of 3 ==
Date: Thurs, Feb 25 2010 9:07 pm
From: darnzen


Having an odd problem that I solved, but wondering if its the best
solution (seems like a bit of a hack).

First off, I'm using an external DLL that requires static callbacks,
but because of this, I'm losing instance info. It could be import
related? It will make more sense after I diagram it:

#Module main.py
from A import *

class App:
def sperg(self):
self.a = A()

app = App()
[main loop and such]
-----------------------------
# Module A.py
import main
class Foo:
Selves=[]
def __init__(self):
Foo.Selves.append(self)
@staticmethod
def chum_callback(nType, nP):
# Need to access function / data in app instance
app.sperg(nP)
# Need to access func data in Foo
# I'm pulling 'self' ouf of list made in constructor
self = Foo.getSelf(nP)

def getSelf(nP):
return self.Selves[nP]

---------------------------------------------------------------------
So basically I added a list of instances to the base class so I can
get at them from the staticmethod.
What's bothering me the most is I can't use the global app instance in
the A.py module.

How can I get at the app instance (currently I'm storing that along
with the class instance in the constructor)?
Is there another way to do this that's not such a hack?

Sorry for the double / partial post :(


== 3 of 3 ==
Date: Thurs, Feb 25 2010 11:12 pm
From: Steven D'Aprano


On Thu, 25 Feb 2010 21:07:55 -0800, darnzen wrote:

> Having an odd problem that I solved, but wondering if its the best
> solution (seems like a bit of a hack).
>
> First off, I'm using an external DLL that requires static callbacks, but
> because of this, I'm losing instance info.
[...]
> How can I get at the app instance (currently I'm storing that along with
> the class instance in the constructor)? Is there another way to do this
> that's not such a hack?

Pass the instance explicitly:

>>> class K(object):
... @staticmethod
... def static(self, x, y):
... print self, x, y
...
>>> k = K()
>>> k.static(k, 1, 2)
<__main__.K object at 0xb7c2544c> 1 2


--
Steven

==============================================================================
TOPIC: Hi, I know it's stupid, but does your foreigner do a lot of OT work?
http://groups.google.com/group/comp.lang.python/t/80dc4947449ccb3d?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Feb 25 2010 11:17 pm
From: Gao


I'm Chinese, I'm working in a famous vendor company which let employee
do a lot of OT work, 2 more hours per day, and sometime work in weekend.
Is that the same in USA and European?

==============================================================================
TOPIC: Get Mallika Sherawath Bathing Videos in all Angles
http://groups.google.com/group/comp.lang.python/t/e3c6d0accba0c031?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Feb 25 2010 11:21 pm
From: MY NAME IS MY NAME


Get Mallika Sherawath Bathing Videos At
http://blogcreationandhosting.blogspot.com/2009/11/earn-money-online.html

< Due to some issues,I have hidden these videos inside an image.In
that website , click on the big vertical Image on right side of
website & get the videos, Enjoy it >

==============================================================================
TOPIC: %%% Funny College Girls Nude Video HERE %%%
http://groups.google.com/group/comp.lang.python/t/20f318e5e7463135?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Feb 25 2010 11:30 pm
From: HOT GIRLS HOT Night


%%% Funny College Girls Nude Video HERE %%%

http://sites.google.com/site/hifiprofile/
http://sites.google.com/site/hifiprofile/
http://sites.google.com/site/hifiprofile/

==============================================================================
TOPIC: scope of generators, class variables, resulting in global na
http://groups.google.com/group/comp.lang.python/t/b1ff4d23cb5ec32c?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Feb 25 2010 11:40 pm
From: Arnaud Delobelle


dontspamleo <dontsendleospam@gmail.com> writes:

> Hi Arnaud et al,
>
> Here is the link to the bug report from which the discussion in PEP
> 289 was extracted:
>
> http://bugs.python.org/issue872326
>
> It looks like they were fixing a bunch of bugs and that this
> discussion was one of the many in that thread.
>
> Here is another post which points to the core of the issue: early/late
> binding. It is also pointed to in PEP 289.
>
> http://mail.python.org/pipermail/python-dev/2004-April/044555.html

Thanks for digging those out!

> Here is Guido's rationale (his text is the items (a) and (b) below. My
> comments follow.
>
> (a) I find it hard to defend automatic variable capture given Python's
> general late-binding semantics
>
> MY COMMENTS: That is a good point. There are however exceptions to the
> "general late-binding semantics" (GLBS) in Python. The outer loop does
> bind early in this case in fact. A point to consider along with GLBS
> is the unintuitive early bind of the external iterator vs late bind of
> the internal iterator. That is a function not of early vs. late
> binding, but of the current translation of generator expressions to
> generator functions. Using Arnaud's approach would fix that and make
> the code IMO so more pythonic.

But see this message from Guido:

http://bugs.python.org/issue872326#msg45190

It looks like he's thinking of early binding of free variables. Later
on he seems to contradict this.

Below it is mentioned that two patches were made, one with the current
behaviour and one with the one you (and I) would prefer.

> (b) I believe that use cases needing early binding are uncommon and
> strained: they all involve creating a list of generator
> expressions, which IMO is a pretty unusual thing to do
>
> MY COMMENTS: This is actually a pretty common use case. Any iteration
> over objects of arity 2 or greater (A matrix, a table, a tree searched
> breadthwise under some data structures, etc.) can conveniently and
> cleanly be expressed using a generator expression.

And also your example when defining a generator expression in a class
scope becomes confusing with the current semantics.

> I'd also add that perhaps the title of Guido's post: "Generator
> Expressions - Let's Move Forward" may have unintentionally discouraged
> people from reexamining the issue.
>
> I would like to see this decision revisited. Obviously before spending
> any time on this I'd like to gauge if there is further interest. Am I
> off the mark? Maybe there is a technical misunderstanding on my part.
> If there are more people affected (Since the last week I found some
> other postings here and on other lists and blogs) who can make a clear
> case, then what is the next step?

I suppose it would be interesting to see how this can be implemented,
maybe look at the gexp.diff.capture file on the bug tracker. I was
intending to look into it a couple of years ago but I could never find
the time :(

--
Arnaud


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate