*binarystar* wrote:
> Hello there,
>
> what method would you use to return the name of the class and/or
> instance introspectively eg.
>
> class Bollocks:
>
> def __init__( self ):
>
> print self.__method_that_returns_class_name__()
> print self.__method_that_ret
Dylan Moreland wrote:
> I have a metaclass generating basic properties such as .name and .city,
> but I don't want to generate a class method for every permutation of
> the attributes. I'd like to have something much like __getattr__ for
> instance attributes, so that if a method like
> Person.find
Will McDonald wrote:
> Hi all.
>
> I'm writing a little script that operates on either stdin or a file
> specified on the command line when run. I'm trying to handle the
> situation where the script's run without any input gracefully but
> can't think how to test for stdin.
>
Hi,
maybe http://d
Peter Hansen wrote:
>> locals().get("dothat")(*c)
This was just meant as a quick example, not as production-level code ;)
Even with globals(), I think its a bit odd ..., but safer than using
eval() ...
HtH, Roland
--
http://mail.python.org/mailman/listinfo/python-list
Francois De Serres wrote:
> All your **kwargs are belong to us.
>
> *args is documented in the Tutorial. I reckon **kwargs represents a
> dictionary of arguments. But I don't quite get the semantics of **x.
> Undefined length tuple of undefined length tuples? Are there other
> practical use cas
Francois De Serres wrote:
> Hiho,
>
> Having a string: "dothat"
> and a tuple: (x, y)
> 1. What's the best way to build a function call like: dothat(x,y)?
Not the best (not at all) but one way:
def dothat(x,y):
print "Called with:", x, y
c = (1,2)
locals().get("dothat")(*c)
Called wit
Roland Heiber wrote:
> class MmapWithSeekAndTell(object):
> def __init__(self, m, size):
.. where m is a mmap-object and size the filesize ... sorry.
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Lotze wrote:
> AIUI (and as a little experimenting seems to confirm), you can't
> reposition an iterator over an mmap'ed file by seeking. True, you have
> both iterating by characters and seeking/telling, but the two
> functionalities don't play together.
A quick and dirty hack!? Maybe i'm
Thomas Lotze wrote:
> It's definitely no help that file-like objects are iterable; I do want
> to get a character, not a complete line, at a time.
Hi,
if i did understand what you mean, what about using mmap? Iterating over
characters in a file like this:
# -*- coding: iso-8859-1 -*-
import os
Vedanta Barooah wrote:
> o = mother()
> o.show()
> y=mother.child()
> y.increase(20)
> # this should print 20
> o.show()
>
> .. is it possible somehow ???
Hi,
this should do what you want:
--- test.py
class mother:
x=0
def __init__(self):
mother.x=1
d
Thomas W wrote:
> print d
Hi,
use sys.stdout.write instead, print is adding linebreaks ...
HtH, Roland
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
class MyClass:
list = []
you have "list" defined as a classmember, not an instancemember. So
"list" ist defined ONCE for all instances.
Try this instead:
class MyClass:
def __init__(self):
self.list = []
[...]
and use self.list ...
HtH, Roland
--
http://mail.python.org/mailman
Irmen de Jong wrote:
However, may I ask you to re-submit the patch but this time
in the patch tracker on SF; http://sourceforge.net/tracker/?group_id=41175
because news/mail clients often mangle source code.
Hi,
I re-submited it as requested. It's just a quick hack, but maybe it's
worth trying.
H
Hi,
after Irmen de Jong did another fine release with Snakelets-1.38 i just
did a dirty hack for using snakelets with SSL-support. SSL-support is
added through the use of tlslite from Trevor Perrin. You'll have to
download and install it from http://trevp.net/tlslite/. Furthermore you
need a ke
Irmen de Jong wrote:
I'm happy to say that Snakelets 1.38 is available.
Fine thing again! Maybe someone is interested in this:
I just tried tlslite and did a dirty hack so you could use snakelets via
SSL. See the patch below. Snip and save it, use it against
snakeserver/server.py.
You've to plac
Marek Franke wrote:
too. The whole project is just for fun. Afaik Freevo and/or MythTV are
written in C/C++ and don't have any support for joysticks (afaik!). And the
Freevo is pure python already ;)
Greetings, Roland
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
when you're under linux and a 2.6er kernel, take a look at hotplug, you
can configure it the way that your script gets executed whenever a
specific device is plugged in/out ...
HtH, Roland
[EMAIL PROTECTED] wrote:
when a new usb disk is plugged into the usb socket, the program will
copy a fi
Roland Heiber wrote:
Tim Daneliuk wrote:
under the impression that "compiled" meant optimized byte code that
You where right, i was totally mislead by "optimized" ... ;)
Greetings, Roland
--
http://mail.python.org/mailman/listinfo/python-list
Tim Daneliuk wrote:
It does - thanks. One more question: Are pyc and pyo file portable
across operating systems? I suspect not since I generated a pyo
on a FreeBSD machine that will not run on a Win32 machine. I was
under the impression that "compiled" meant optimized byte code that
was portabl
Tim Daneliuk wrote:
I use a makefile to create distribution tarballs of freestanding Python
programs and their documentation. I cannot seem to find the right
command line option to just generate a pyc/pyo file from the program
and then exit. If I use 'python - -c"import myprog"' it creates
th
Hi,
i recently migrated from mysql to postgresql and did use severel python
postgres-modules. All do what they are designed for, so which one would
you use? psycopg, pygresql, pypgsql? psycopg seems to be the best
solution for heavy traffic/multiple connections i have no real
testing envir
morphex wrote:
Hi all,
I'm trying to create a script that will superimpose text on an image.
I didn't find any great examples out there on how this can be done (I
presume using PIL is necessary), do you know of any examples?
Thanks,
Morten
Hi,
something like this?
###
from PIL import Image, ImageFo
harold fellermann wrote:
f = open("/bin/exe.x","w")
print >>f , """CategoryY = GRIB
etc.
"""
This would overwrite the existing /bin/exe.x ...
HtH, Roland
--
http://mail.python.org/mailman/listinfo/python-list
limodou wrote:
http://wiki.wookpecker.org.cn/moin.cgi/NewEdit
Try this instead:
http://wiki.woodpecker.org.cn/moin.cgi/NewEdit
^
SCNR, Roland ;)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
Hi "R",
The only explanation I can give is that the environment varialbe REMOTE_ADDR
does not exist! Wrap your high-level code with try and except. Example:
try:
tablesDirectory = tablesDirectoryPrefix + os.environ['REMOTE_ADDR']
except KeyError:
# Code to handle the f
25 matches
Mail list logo