Usually, oo-style apis are thread-safe as long as each thread uses its own
objects. Shared global state is _very_ uncommon, and if it's most probably
documented.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
y, values)
is stored, and for a passed key, each key in that list is additionally
compared for being equal to the passed one. So another requirement of
hashable objecst is the comparability. In java, this is done using the
equals method.
So in the end, the actual mapping of key, value looks like this:
re easy?
There is an python-based ide which has the same name as your first name -
try that.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
> I know its easy (string.replace()) but why does UTF-16 do
> it on its own then? Is that according to Unicode standard or just
> Python convention?
BOM is microsoft-proprietary crap. UTF-16 is defined in the unicode
standard.
--
Regards,
Diez B. Roggisch
--
http://mail.python.or
ic ASCII characters at the beginning, such as the
use of "#!" of at the beginning of Unix shell scripts. [AF] & [MD]
"""
So they admit that it makes no sense - especially as decoding a utf-8 string
given any 8-bit encoding like latin1 will succeed.
So in the end, I st
s its a
keyword in python). All I had to do to make e.g. examples given in C++ work
was to strip curly braces and type declarations. So again: I don't see the
need for that doc. But that's IMHO, of course.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
ür" and so on for a heuristic. But that is no guarantee.
> Using a BOM with UTF-8 makes it easy to indentify it as such AND it
> shouldn't break any probably written Unicode-aware tools.
As the faq states, that can very well happen.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
parameter in the lambda will keep the right
value for each iteration.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
[lambda: foo(i) for i in xrange(5)]
for f in fs:
f()
fs = [lambda x=i: foo(x) for i in xrange(5)]
for f in fs:
f()
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
that it really makes sense to create full docs at a api
level. It would be hard to be in sync with the qt development itself.
Instead a wiki which captures the various pitfalls would be cool. And it
appears it exists:
http://www.diotavelli.net/PyQtWiki
So maybe enhancing that would be an
> If this is "goodbye" I can't say I'm sorry.
Don't feed the trolls - as tempting as it is
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
mssql driver for unxi-odbc. Its called ftl or tls or
something. As always: Google is your friend...
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
e to see reduce, even if
> it
> is a common idiom like that. Also I don't believe it short circuits.
It doesn't but so doesn't your loop example. Put a break in there once
Result is False.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
on. Instead this can be done by companies - see activestate. So if
you want it, step up and do it yourself so your work _becomes_ the official
mingw port. Community gratitude would be guaranteed.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
lly haven't the need for. And I developed
quite large python apps.
>>> c) Why are the following efforts not _directly_ included in the
>>> python source code base?
>>>
>>> http://jove.prohosting.com/iwave/ipython/pyMinGW.html
Ask the author of the patch. We can't read minds here.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
f.getEmptySlot()
> y = emptySlot[1]
> x = emptySlot[0]
make this:
x,y = self.getEmptySlot()
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
eds. But as lots of
people use python and python based solutions with great commercial success,
you might think of reviewing your needs more critical. After all, there is
no _perfect_ system for all needs.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
mx]
elements[fromy][fromx] = dummy
And use xrange instead of range.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
e.com/group/comp.lang.java.softwaretools/browse_frm/thread/837df2c1188e6e39/18b5dcfd54a6a902?q=Lazaridis+Ilias&_done=%2Fgroups%3Fq%3DLazaridis+Ilias%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Search&&d#18b5dcfd54a6a902
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
administrata wrote:
> Hello. I was about to use tutor-mailing But, When i send to
> tutor@python.org
That just means that somebody subscribed to that list isn't reachable.
Ignore it.
> Plz HELP me;
Please start talking english. This is no l337-script-kiddie forum.
--
Re
to something accessible in the namespace...
Why only the id? A list only stores a reference to the object anyway - no
copy of it. So you don't gain anything by using the id.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
does -
e.g. for a CMS, I'd strongly recommend a zope based solution. Other apps
might be better written in other frameworks.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
Maybe ZODB helps.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> "Diez B. Roggisch" <[EMAIL PROTECTED]> writes:
>> Maybe ZODB helps.
>
> I think it's way too heavyweight for what I'm envisioning, but I
> haven't used it yet. I'm less concerned about object persistence
> (just
you
should skim over the tutorial to get a grasp of how it works.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
ough name - so look there and be a happy camper.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
import types
v = []
if type(v) is types.ListType:
pass
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
laborate yaml/xml serializations to
allow for im- and exports and use with xslt and currently I'm investigating
a switch to postgres.
This point is important, and future developments of mine will take that into
consideration more than they did so far.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
accuracy than seconds, it is returned as
fraction of a second. That is the whole point the result of time being a
float and not an int.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
thon to full fledged app servers like zope. As
usual, google is your friend. No need to dig into the things you mentioned
above - at least not for what you want to do right now.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
r Linux with frambuffer output (see freevo) or a "real" Windows
that is capable of showing a graphical ui.
Maybe somehow the pygame sdl wrapper can be used for gui-stuff. SDL has had
a DOS mode. But it is discontinued.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
inding the created object as first argument to the method. Thus each
instance of a class Foo with a method bar has its own instance of bar - the
bound method bar. But only one per object.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
. It's really great.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Heller wrote:
> "Diez B. Roggisch" <[EMAIL PROTECTED]> writes:
>
>> Maybe somehow the pygame sdl wrapper can be used for gui-stuff. SDL has
>> had a DOS mode. But it is discontinued.
>
> What exactly is discontinued? pygame? SDL?
The dos mod
m the same unbound method and the same instance as you want:
That did escape me so far - interesting. Why is it that way? I'd expect that
creating a bound method from the class and then storing it in the objects
dictionary is what happens.
--
Regards,
Diez B. Roggisch
--
http://mail.pyth
ddress):
digits = address.split(".")
if len(digits) == 4:
for d in digits:
if int(d) < 0 or int(d) > 255:
return False
return True
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
u
> validate the result, with a cut-down validator that relies on the fact
> that there are 4 segments and they contain only digits:
The search case needs a regular expression. But the OP didn't say much about
what he actually wants.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
show it to us, then we can comment on it.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
the components required
> are:
Damn. Certainly not my glory regular expression day.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
forms and compilers. Just not the compiler you perceive as
being a necessity. But that dead horse has been beaten enough already.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
> Unnecessary and deliberately provoking question - python is taken
> seriously, e.g. by multi-billion dollar companies like google and zope.
Of course zope corporation is not amongst the multi-billion dollar companies
- by now. But who knows :)
--
Regards,
Diez B. Roggisch
--
Ilias Lazaridis wrote:
> Diez B. Roggisch wrote:
>>>Should a professional developer take python serious?
> [...] - (ungentle babbling after disrupting coherence of writings)
And that from you *lol*
> I mean, if the team does not manage at least the foundation of a
> m
d by all of us humble developers who
actually _deal_ with problems.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
ll be pretty straightforward. As others (including me) have stated
before: windows is a commercial product. You have to pay to use it, and you
have to pay to develop for it. That's the way MS wants it. The alternatives
are there - but you can't have your cake and eat it.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
ated from that class.
This works as expected:
class ExistentialCrisis:
def __init__(self, text):
self.spam = text
print 'In the constructor of the %s class' % self.__class__.__name__
ExistentialCrisis("egal")
--
Regards,
Diez B. Roggisch
--
http:
http://www.zope.org/
But there are plenty of other python http frameworks. The mod_python is
AFAIK the most basic and primitive one. But build on top of it or fully
python-based you have plenty of options. Google is your friend - this NG
features similar discussions every other week.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
ts main purpose. So you e.g. get session state handling
"for free" - as more or less _all_ web-apps today need them.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
Im not sure if I understand you fully, but if what you are after is how to
pass named parameters analog to positional args, do it as dict:
def foo(name=None):
print name
foo(**{name: "Fuzzy"})
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
re if I understand you fully, but if what you are after is how to
pass named parameters analog to positional args, do it as dict:
def foo(name=None):
print name
foo(**{name: "Fuzzy"})
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
only recreate them and rebind them to new variables. This
prevents whole classes of errors - but of course it also introduces all
kinds of other constraints on your programming style, e.g. using monads and
so on.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> "Diez B. Roggisch" <[EMAIL PROTECTED]> writes:
>> It's not only that way in python, but in java too. So it seems that there
>> is a fundamental principle behind it: In a language that allows
>> sideeffects, these will actually happen.
d hopfully comprehending...) your post. Sorry.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
k the urls - so copy and pasting yields only start or end of the
urls, depending on the browser/edit control your pasting into.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
lf, instance, attribute, value=1):
"""Value and multiplier must be readonly"""
try:
setattr(instance, attribute, value)
self.fail("Value is not read only")
except AttributeError:
pass
Then the testing becomes one line:
self.test_readonly(self.combat, "value")
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
rd unix is a millisecond. And time.time() actually delivers a float
with sub-second precision.
import time
t = time.time()
time.sleep(.25)
print time.time() - t
gives for me (also debian) 0.249767065048 secs.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mail
seq = [[] for i in xrange(10)]
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
ght help. It has a free
evaluation version, and python bindings.
If it's only about text, maybe pdf2text helps.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
e in effect flat 3 element Numeric arrays,
and Numeric ararys can be constructed with Float64 specified as the
datatype.
"""
It was embedded in some disgressing comments (he himself says so, btw.) so
you might have missed it.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
def depth_first(self):
if self.childs:
for child in self.childs:
for node in child.depth_first():
yield node
yield self.payload
tree = Node('root', [Node('child1'), Node('child2')])
for n in tree.depth_firs
e.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
tlines.
>
> Any ideas?
Maybe [c]StringIO can be of help. I don't know if it's iterator is lazy. But
at least it has one, so you can try and see if it improves performance :)
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
7;, 'timedelta', 'tzinfo']
>>>
Maybe this is a clash between a custom datetime module and the python one?
What does
python2.4 -v -c "import datetime"
give you?
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
abuse.
A module is a unit of code that (should) encapsulate a certain
functionality. So it's perfect for your needs. There is no law or even rule
of thumb that makes claims about module size (or the lack of, for this
matter). So create a module - it doesn't cost you anything.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
don see why implicitly calling one
> of these methods would be any more difficult when they are autonomous
> objects than when they are attributes.
I still don't see how that is supposed to work for "a lot of interesting
things". Can you provide examples for one of these in
ming.html#id12
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
all for some part of the code,
then you'd most probably even go for a local variable binding to avoid the
lookups in the different scopes - thus the issue of import format gets
unimportant again :)
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
PEP, an implementation and a
> champion with some persuasive ability :)
Go wild :)
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
t you want to have as delimiter for splitting is written
'\x00'
So do this:
b = a.split('\x00')
Read the python docs about strings and raw strings and escaping of
characters to understand the subtle details here.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
le
are supported; both are needed to actually retrieve a resource at an https:
URL.
'''
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
DENG wrote:
> ok
>
> i find it
>
> map :!d:\python24\python.exe %
>
>
> but it comes with a new pop-up windowsdame~
I'm no windows expert - but maybe pythonw.exe helps here?
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
> widget["filename"]
>
> Is this possible to do?
Yes. Use dicts to store these buttons so that you can later refer to them.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
o(self):
self.l.append(100)
a = A()
b = B(a.a_list)
b.foo()
print a.a_list
-> [0, 100]
There are some resources on the web that explain this in more thourough
detail - but curretntly I have trouble finding them. Search this newsgroup.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
> Both filelist and self.checkbox are the same size (4 items btw). Is
> there any way to get this done?
Use zip:
a, b = [1,2,3], ['a', 'b', 'c']
for i,j in zip(a,b):
print i,j
Or from itertools izip - which should be slightly more performant and less
mem
fig(enabled=False)
Of course this means that cbs has to be a global var. But there exist other
options of course - as part of a object or whatever. that depends on your
code.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
people here usually tend not to be too helpful when asked to do an obvious
homework task. So if you really want help, provide some code you've already
written and that has actual problems. Then we're glad to help. But don't
expect others to do your work.
--
Regards,
D
S)
Evaluate(u'wsdl:description/wsdl:documentation', context=ctx)
"""
Should give you a start.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
n
conjunction with zeo as it has no idea of whatever storage is needed - all
it does is indexing zodb objects - which you get from zeo as well. Of
course that means that you have to keep a catalog for every thread/process
that accesses the objects. Alternatively, you maybe can make the
IndexedCata
what commands actually fail would certainly help.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
inserted.add(e)
listA = res
Or, with a little helperfunction:
inserted = set()
def foo(e):
inserted.add(e)
return e
listA = [foo(e) for e in listA if not e in inserted]
But ist's not really much better.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
problem - e.g. DNS is often a candidate than can slow down network
experience a lot. So maybe thats causing your trouble?
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
; :-)
I usually use much more telling variable names - from the source I just
wrote a minute ago:
self.selection_color_map = {}
self.selection_color = (255,255,0)
self.assigned_color_map = {}
self.default_color = (0,0,0)
self.known_names = sets.Set()
As you can see
f __init__(self, my_vals):
self.__dict__.update(my_vals)
foo = Foo(my_vals)
print foo.a
-> 1
Hope this helps,
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
'size': 367415L,
> 'orientation' : (0x0112) Short=1 @ 42}
You can't sort dicts - they don't impose an order on either key or value.
There are ordered dict implementations out there, but AFAIK the only keep
the keys sorted, or maybe the (key,values) in t
o is to convert your
pattern to a regex:
rex = re.compile(r"/dir/dir/.*/dir/.*/dir/.*")
Then create a list of dirs with os.walk:
dirs = [dirpath for dirpath, foo, bar in os.walk(topdir) if
rex.match(dirpath)]
This is untested, but should do the trick.
--
Regards,
Diez B. Roggisch
> Will anything else work here?
Use %%
print "%%s %s" % "foo"
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
> is there another way to convert a string with quoted sub entries into a
> list of strings?
try the csv-module.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
l end
immediately after the main thread terminated.
Read the threading modules docs.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
Untestet:
def foo(base, depth=2):
for root, dirs, files in os.walk(base, True):
if len(root.split(os.sep)) < depth:
yield root, dirs, files
for root, dirs, files in foo("/tmp"):
print root, dirs, files
--
Regards,
Diez B. Roggisch
--
http://ma
phone = {'mike':10,'sue':8,'john':3}
print [key for key, value in phone.items() if value == 3]
-> ['john']
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hello all,
>
> I need to create 6 buffers in python and keep track of it.
> I need to pass this buffer, say buffer 1 as an index to a test app. Has
> any one tried to do this. Any help with buffer management appreciated.
Use the module array.
--
R
u observe seems to be a result of your "abuse" of classmethod
outside a class scope.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
rrent frame of execution,
so
def foo():
bar = "baz"
makes the bar part of the frames local variables. Scopes just exchange or
stack the dicts for name lookup.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
n't be much more than a few lines of code, more or
less only subclassing your server from Pyro.core.ObjBase instead of
SimpleXMLRPCServer.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
t "--data--", data[key_size:]
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
"C:\\somedir\\test.xbm"
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
the network than soap/xmlrpc. So while the local loopback _might_ be slower
(I'm not even sure about that) than the unix socket, marshalling data as
xml has its own cost overhead.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
Stephen Waterbury wrote:
> Diez B. Roggisch wrote:
>> ... corba is 10-100 times faster over
>> the network than soap/xmlrpc. ...
>
> I'm not challenging these statistics (because I don't know),
> but I would be interested in the source. Are you referring
>
rap the module - which is possible in
several ways, including hand-written code, pyrex, swig and sip. Maybe even
more, I don't know.
Or you access it using the module ctypes that allows to invoke arbitrary
methods/funtctions of C-libs. google for it.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
> accessible with normal development tools since it's stuck in the ZODB.
Plain wrong. You can access them via FTP and WEBDAV. In kde under linux, all
file-io can be done through these protocols, so you can operate on them as
if they were local files.
--
Regards,
Diez B. Roggisch
--
http://
tly using ftp as storage
backend. (x)emacs for example.
> Besides, how to have the
> source code under source control if it's stuck in the ZODB?
You can still fetch it using webdav and ftp and stick it into CVS/SVN.
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
301 - 400 of 3917 matches
Mail list logo