i have a problem with pydoc in rpyc. i wanted help(obj), where obj
is a NetProxy object, to work as if it were local.
i followed the code starting from site.help to pydoc.doc, which is the
ultimate function that generates and prints the text. i expected there
would be some function in the middle t
submitted patch:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1530482&group_id=5470
-tomer
-- Forwarded message --
From: tomer filiba <[EMAIL PROTECTED]>
Date: Jul 28, 2006 3:35 PM
Subject: patching pydoc?
To: python-dev@python.org
i have a pro
tching pydoc?
> Newsgroups: gmane.comp.python.devel
> Date: 2006-07-28 18:29:50 GMT (5 hours and 27 minutes ago)
>
> "tomer filiba" gmail.com> wrote in message
> news:1d85506f0607280635q3a693682l230c7821dc6f408f mail.gmail.com...
> ...
> > therefore, i would lik
while working on a library for raising exceptions in the context
of another thread, i've come across a bug in PyThreadState_SetAsyncExc.
if i raise an instance, sys.exc_info() confuses the exception value for
the exception type, and the exception value is set None. if i raise the
type itself, the i
opened a new bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=1538556&group_id=5470&atid=105470
On 8/11/06, tomer filiba <[EMAIL PROTECTED]> wrote:
> while working on a library for raising exceptions in the context
> of another thread, i
so it should be fixed, or at least checked for conformness by the code.-tomerOn 8/11/06, Tim Peters <
[EMAIL PROTECTED]> wrote:[tomer filiba]> while working on a library for raising exceptions in the context
> of another thread, i've come across a bug in PyThreadState_SetAsyncEx
>>> a={1:2, 3:4}>>> [] in aTraceback (most recent call last): File "", line 1, in ?TypeError: list objects are unhashable>>>imo, the _expression_ should just evaluate to False instead of raising an exception.
it's a question of semantics -- i asked whether the object (a list, in this case)is cont
[Aahz]
> -1
>
> This is seriously no different from an attempt to do
>
> >>> a = {}
> >>> a[ [] ] = 1
how so? i'm not trying to modify/store anything in a dict.
i'm only testing if a certain object is contained in the dict.
that's totally different.
imagine this:
>>> x = 6
>>> x < 2
am i trying to
i'd like to suggest adding weak attributes and weak methods to the std weakrefmodule. weakattrs are weakly-referenced attributes. when the value they reference is no longer strongly-referenced by something else, the weakattrs "nullify" themselves.
weakmethod is a method decorator, like classmethod
> I'm sceptical that these would find use in practice.> [..]> Also, I question the utility of maintaining a weakref to a method or> attribute instead of holding one for the object or class. As long as
> the enclosing object or class lives, so too will their methods and> attributes. So what is the
this may still be premature, but i see people misunderstood the purpose.
weakattrs are not likely to be used "externally", out of the scope of
the object.
they are just meant to provide an easy to use means for not holding cyclic
references between parents and children.
many graph-like structures
so, if you remember, i suggested adding __dir__ to objects, so as to make
dir() customizable, remove the deprecated __methods__ and __members__,
and make it symmetrical to other built-in functions.
you can see the original post here:
http://mail.python.org/pipermail/python-dev/2006-July/067095.htm
x27;, '__module__', '__new__', '__reduce__', '__reduce_
ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'bow', 'wow']
-tomer
On 11/6/06, Guido van Rossum <[EMAIL PROTECTED]> wrot
okay, everything's fixed.
i updated the patch and added a small test to:
Lib/test/test_builtins.py::test_dir
-tomer
On 11/7/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> tomer filiba wrote:
> > cool. first time i build the entire interpreter, 'twas fun :)
> > cur
> as well as updating the documentation in various
> places (the dir and PyObject_Dir documentation, obviously, but also the list
> of magic methods in the language reference).
oops, i meant everything except that
-tomer
On 11/7/06, tomer filiba <[EMAIL PROTECTED]> wrote:
>
i found several places in my code where i use positive infinity
(posinf) for various things, i.e.,
def readline(self, limit = -1):
if limit < 0:
limit = 1e1 # posinf
chars = []
while limit > 0:
ch = self.read(1)
chars.append(ch)
e, not
a separate module. here's what i want:
>>> f = 5.0
>>> f.is_infinity()
False
>>> float.PosInf
1.#INF
-tomer
On 11/26/06, Bob Ippolito <[EMAIL PROTECTED]> wrote:
> On 11/26/06, tomer filiba <[EMAIL PROTECTED]> wrote:
> > i found several pl
> Um, you do realize that you're not going to be able to fit sys.maxint
> strings into a list, right?
i can multiply by four, thank you. of course i don't expect anyone to read
a string *that* long.
besides, this *particular example* isn't important, it was just meant to
show why someone might wan
to my understanding of the object model, the code of snippet 1
and snippet 2 should be equivalent. a class is just a "special function"
that returns its locals automatically and passes them to the metaclass
constructor:
--- snippet 1 ---
class foo(object):
x = 5
def f(self):
print
> If you don't follow this reasoning, please write a counter-proposal
> so that people have something to shoot down.
?
i just wanted to be sure it was done on purpose, and what were the
reasons for that.
-tomer
On 12/20/06, "Martin v. Löwis" <[EMAIL PROTECTED]> wr
> The main goal is to prevent threads overhead and problems with race
> conditions and deadlocks.
check out stackless python -- http://www.stackless.com/
-tomer
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/p
On 12/29/06, Jeremy Hylton <[EMAIL PROTECTED]> wrote:
> def spam():
> x = 5
> class eggs(object):
> x = 6
> def spam(self):
> return x
> return eggs
>
> spam()().spam() should return 5.
>
the question that arises is -- is this what we wanted?
if i had to read such code, where i
why not add __enter__ and __exit__ to generator objects?
it's really a trivial addition: __enter__ returns self, __exit__ calls
close().
it would be used to ensure close() is called when the generator is disposed,
instead of doing that manually. typical usage would be:
with mygenerator() as g:
a quick question: i'm working on a pythonic build system, where the
build
scripts are plain python files. but i want to differentiate them from
normal
python files (.py) by a different suffix (say .pyy), but then i can't
import
them.
so i'm wondering, is there a quick way to just add another exten
On 9/14/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> The best way would be to not use import, but provide a separate
> function (e.g. calling it "require").
>
yepp, that's probably the cleanest and quickest solution. i needed
to see all the alternatives to realize this though. sorry.
--
i'm working on some minimalistic asynchronous framework for python,
somewhat like twisted or stackless, but for different purposes. i came
to the conclusion i want to be able to "freeze" functions, and resume
them later, when some condition is matched.
the idea i came up with is, using exceptions
[2].
[1]
while (STACK_LEVEL() > b->b_level) {
v = POP();
Py_XDECREF(v);
}
[2] hrrrmpff
-tomer
On Dec 15, 2007 6:57 PM, Phillip J. Eby <[EMAIL PROTECTED]> wrote:
> At 01:04 AM 12/15/2007 -0800, tomer filiba wrote:
> >* do you suppose it will work? are there any drawb
... which would explain the NULL deref exceptions i was
getting :)
-tomer
On Dec 16, 2007 12:54 AM, Greg Ewing <[EMAIL PROTECTED]> wrote:
> tomer filiba wrote:
> > the idea i came up with is, using exceptions for functional
> > continuations: after all, the exception's
i'm using python to create expression objects, for more intuitive
usage as
predicates, for instance:
x = (Arg(0) > 17) & (Arg(1).foo == "bar")
instead of
x = And(Gt(Arg(0), 17), Eq(GetAttr(Arg(1), "foo"), "bar"))
so now i can use x.eval(18, "spam") and get the result of the
expression.
i'
On Jan 23, 2008 3:19 AM, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> [Steven Bethard]
>
> >We've already lost this if anyone really wants to break it::
> >
> >>>> class C(object):
> >... def __iter__(self):
> >... return iter(xrange(3))
> >... def __contains__(sel
hi
i'm having trouble when forking child processes to serve sockets. the
skeleton is something like the following:
def work():
try:
while True:
s = listener.accept()[0]
log("hello %s", s)
if os.fork() == 0:
try:
s
the following code works on python 2.5:
>>> def f(**kwargs):
... print kwargs
...
>>> f(a=5,b=7,a=8)
{'a': 8, 'b': 7}
>>>
but fails on python2.4, saying that "a" is given twice.
is this a bug or a feature?
-tomer
___
Python-Dev mailing list
Python
On Jun 28, 12:56 am, "Guido van Rossum" <[EMAIL PROTECTED]> wrote:
> No, it could just be a harmless typo in a long argument list.
to elaborate on this point a little, i came across this error when i
ported my code to 2.4. i used the optparse class which takes 10's of
kwargs, and it turned out i'd
hello folksafter several people (several > 10) contacted me and said "IMHO 'construct' is a good candidate for stdlib",i thought i should give it a try. of course i'm
not saying it should be included right now, but in 6 months time, or such a
timeframe (aiming at python 2.6? some 2.5.x release?)a
Indeed, I wish I had known about this a year ago; it would have saved
me a lot of work. Of course it probably didn't exist a year ago... :(
well, yeah. many people need "parsing-abilities", but they resort to ad-hoc parsers using struct/some ad-hoc implementation of their own. there clearly is a
elpful library as a builtin, and so is Construct. the two don't competeon a spot in the stdlib.-tomer
On 4/18/06, Paul Moore <[EMAIL PROTECTED]
> wrote:
On 4/17/06, tomer filiba <[EMAIL PROTECTED]> wrote:> after several people (several > 10) contacted me and said "IMHO
i'm not going to defend and fight for this idea too much. i only bringit up because it bothers me. i'm sure some people here would kill me for
even suggesting this, and i really don't want to be killed right now,so i bring it up as something you should think about. nothing more.PEP-225 has some wei
n already included in the stdlib, i still think it has a room there. existing projects can be ported without too much effort, and new ones could
benefit from it as well.-tomerOn 4/19/06, Giovanni Bajo <[EMAIL PROTECTED]> wrote:
tomer filiba <[EMAIL PROTECTED]> wrote:
> the point is -
overriding __getattr__ and __setattr__ has several negative side effects, for example:* inside__getattr__/__setattr__ you have to use self.__dict__["attr"] instead of
self.attr* it's easy to get stack overflow exceptions when you do something wrong
* you must remember to call the super's [get/set]
many times, templating a string is a tidious task. using the % operator, either with tuples or dicts,is difficult to maintain, when the number of templated arguments is large. and string.Template,although more easy to read, is less intutive and cumbersome:
import stringt = string.Template("hello $n
you'll need it as a builtin-tomerOn 4/20/06, Josiah Carlson <
[EMAIL PROTECTED]> wrote:"tomer filiba" <
[EMAIL PROTECTED]> wrote:> the evaluated string will be evaluated based on the current scope (locals> and globals), just like> normal expressions. the differen
We already have a slew of templating utilities (see Cheetah for example).first of all -- i know there's a bunch of templating engines, but i think it should be a
built-in feature of the language. like boo does. and estr is stronger than simple $name substitution, like Template does.
Be sure to stay
x27;t support quantom superposition?-tomer
On 4/20/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
Tomer, please stop. We've seen your proposal. We've said "-1". Pleasetake it instead of wasting your time trying to argue for it.On 4/20/06, tomer filiba <[EMAIL PROTECTE
yeah, i came to realize nothing helpful will ever come out from this list, so i might as well stop trying. but i have one last thing to try.i'm really missing a binary codec, just like the hex codec, for doing things like
>>> "abc".encode("bin")"01110110001001100011">>> "0111011000100110001
a friend of mine suggested this, and i thought i should share it with the mailing list.many times when you would want to use list/generator comprehensions, you have tofall back to the old for/append way, because of exceptions. so it may be a good idea
to allow an exception handling mechanism in the
x.append(...) except: ...and it's such a big syntactic change.don't worry, i'm not going to argue it past this.-tomer
On 4/26/06, Josiah Carlson <[EMAIL PROTECTED]> wrote:
"tomer filiba" <[EMAIL PROTECTED]> wrote:> "[" for in [if ] [ex
weakattr (weak attributes) are attributes that are weakly referencedby their containing object. they are very useful for cyclic references --an object that holds a reference to itself. when a cyclic reference is found by the GC, the memory may be
freed, but __del__ is not called, because it's impo
#x27;s
not much to test :) )
> Toss it out in python-list, I think some people over there would be able
> to offer more feedback.
will do... although i doubt they will offer any
-tomer
On 7/2/06, Josiah Carlson <[EMAIL PROTECTED]> wrote:
>
> "tomer filiba" <[EMAIL
i'd guess this has been brought up before, but i'm not aware of it.
anyway --
by what i've gathered, today's dir() "collects" the attributes of the
object from __dict__, __methods__, __members__, and ultimately
__class__. also, if i understood correctly, __methods__ and
__members__ are deprecated.
i thought avoiding a second dict lookup should be faster, but it turned out to be completely wrong. it's only marginally faster, but if an exception occurs,it's x10 slower.## the code#>>> import time
>>> b = dict((i, 7) for i in range(1000))
>>> def try_lookup(k):... try:... return b[k]
50 matches
Mail list logo