the second dimension. If you say 2D I think of
something like a table with two columns and not a sequential condition
spread over several lines.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. It seems to depend on the position if it's a keyword or not.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 10 Sep 2007 19:54:49 +1200, Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Marc 'BlackJack' Rintsch
wrote:
On Mon, 10 Sep 2007 15:02:58 +1200, Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Bjoern Schliessmann
wrote:
Lawrence D'Oliveiro wrote:
But then you
, a conversation with a top poster starts
to get mixed and even harder to follow.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 10 Sep 2007 20:19:08 +1200, Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Marc 'BlackJack' Rintsch
wrote:
I see a tree structure here ...
Good, you're improving.
Thanks.
... but still no table.
Who said anything about a table?
Me. If that statement is 2D I
On Mon, 10 Sep 2007 15:48:44 +0200, A.T.Hofkamp wrote:
(I have seen references to a module called datetime, but I have never used
such
a module so no idea what it is or where to get it).
It's just an import away -- in the standard library. :-)
Ciao,
Marc 'BlackJack' Rintsch
file's name afterward.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
with `ctypes`. `memcpy` expects a pointer not an object.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to episode %d/A\n
%
(
LinkToMe({ep : Link[from_episode]}),
Link[from_episode]
)
)
#end for
What do you mean by not possible!? This compiles fine for me.
Ciao,
Marc 'BlackJack' Rintsch
On Fri, 07 Sep 2007 23:53:48 +, wang frank wrote:
From: Marc 'BlackJack' Rintsch [EMAIL PROTECTED]
To: python-list@python.org
Subject: Re: Speed of Python
Date: 7 Sep 2007 23:17:55 GMT
On Fri, 07 Sep 2007 22:59:26 +, wang frank wrote:
I also have tried to use numpy to speed it up
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 08 Sep 2007 18:52:57 +0200, Torsten Bronger wrote:
Is there a portable and simply way to direct file-like IO to simply
nothing? I try to implement some sort of NullLogging by saying
`os.devnull`?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
.
And `MyModule` is a bad name for a package.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 06 Sep 2007 16:48:31 -0700, Zentrader wrote:
On Sep 6, 12:47 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Wed, 05 Sep 2007 22:54:55 -0700, TheFlyingDutchman wrote:
To do a *string wildcard filter use the endswith() function instead
of startswith() and to do a *string
On Fri, 07 Sep 2007 10:40:47 +, Steven D'Aprano wrote:
Nor does it include peek and poke commands for reading and writing
into random memory locations.
I guess `ctypes` offers tools to write `peek()` and `poke()`. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
is the start time you
might override `__cmp__()` of `Step`\s instead::
def __cmp__(self, other):
return cmp(self.startTime, other.startTime)
Now you can just sort the list with ``steps.sort()``.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
number for the exponent.
for example 13 shoud be 0.13000E+02
I always get 1.3E001
I don't know if this is platform dependent but this works for me:
In [41]: '%e' % 1.3
Out[41]: '1.30e+00'
In [42]: ('%e' % 1.3).upper()
Out[42]: '1.30E+00'
Ciao,
Marc 'BlackJack' Rintsch
.
For that easy solution you can use `itertools.count()`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, True, False])
Out[52]: [1, 0, 1, 0]
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
an instance of `int`. There's
nothing special about it.
In [57]: issubclass(bool, int)
Out[57]: True
In [58]: bool.__base__
Out[58]: type 'int'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 07 Sep 2007 22:59:26 +, wang frank wrote:
I also have tried to use numpy to speed it up. However, surprisingly, it is
slower than the pure python code.
Here is the code:
import numpy
arange=numpy.arange
nlog=numpy.log
def bench6(n):
for i in xrange(n):
()`
will go away in the future.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
; self.disablePLmessages([self.dev]);
def a0050(): global self; self.dev.testH.writePLram((PL.BCAL128));
What is this ``global self`` meant to do? And the first line is missing a
colon at the end.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
Python syntax. I guess
there's an older issue of that book that used the SmallTalk programming
language and they switched to Python syntactically but not mentally and not
the vocabulary. A slot in SmallTalk is called attribute in Python.
Ciao,
Marc 'BlackJack' Rintsch
--
http
to access `Main.stepStore`. Unless
you are modifying `stepStore.stepList` while iterating over it, you don't
need to make a copy by the way.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
that the
calling line didn't work.
What meaningless error message are you talking about!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
just hold water back.
And some produce electricity. And most if not all can regulate how many
water is let through. If something goes wrong the valley behind the dam
gets flooded. If this is controlled by a computer you have the need for
reliable software.
Ciao,
Marc 'BlackJack' Rintsch
on a how a set is stored, I'd estimate any membership check in
a set to be O(log N).
Sets are stored as hash tables so membership check is O(1) just like Alex
said.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to
return the `Maybe` type.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
encoding\n')
sys.exit()
So there is an attribute `self.encoding` on that object. Is it set? What
encoding is it? And do you put byte strings with values outside ASCII
into your XML or unicode strings?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
v2.0`_ or `API
for Block Encryption Algorithms v1.0`_ what you are looking for?
.. _API for Block Encryption Algorithms v1.0:
http://www.python.org/dev/peps/pep-0272/
.. _Python Database API Specification v2.0:
http://www.python.org/dev/peps/pep-0249/
Ciao,
Marc 'BlackJack
.
What about -1? C programmers do this all the time. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
string literal.
In [23]: len('\r')
Out[23]: 1
In [24]: len('\\')
Out[24]: 1
In [25]: len(r'\r')
Out[25]: 2
In [26]: len(r'\\')
Out[26]: 2
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
in a browser. (Could not connect…)
Maybe you can download that XML file and use `xmllint` to check if it is
well formed XML!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
:
[EMAIL PROTECTED]:~$ touch C:/test.txt
[EMAIL PROTECTED]:~$ ls -l C:
total 0
-rw-r--r-- 1 bj bj 0 2007-08-30 14:38 test.txt
:-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 30 Aug 2007 15:31:58 +0200, Pablo Rey wrote:
On 30/08/2007 14:35, Marc 'BlackJack' Rintsch wrote:
Maybe you can download that XML file and use `xmllint` to check if it
is well formed XML!?
This is the output of the xmllint command:
[EMAIL PROTECTED] voms2users]$ xmllint
to provide both as well, but it provides only `index()`.
Anyone know the reason for this lack of parallelism?
Historical reasons and IIRC the `find()` method on strings will go away in
Python 3.0.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
:
In [56]: def b():
: return 2
:
In [57]: funcs = [a, b]
In [58]: funcs
Out[58]: [function a at 0xb7792e2c, function b at 0xb779e1ec]
In [59]: funcs[0]()
Out[59]: 1
In [60]: funcs[1]()
Out[60]: 2
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
notation. Return
-1 if sub is not found.
But that is a valid index into a string! So this may go unnoticed if one
doesn't check after every call to `str.find()`. And that method is going
away in Python 3.0.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
error, e:
os.remove(dictpath)
sys.exit(str(e))
except:
os.remove(dictpath)
raise
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
example has to look up the `has_key()`
method on the object first.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
in place
too.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, it started out life as a unidimensional thing, but later needs to
be a flattening of 3 dimensions or something), you won't necessarily need
to change depenent code.
Maybe you should read about the `property()` function.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
is given
back to the OS and reported as free memory again.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
()` the lines and put them into a
`dict()`. This is a neat little project to start learning the language.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, would I be better reading
every line in every file and writing each line to the output file or
is there someway I could execute some shell command.
There are some copy functions that work with file like objects in the
`shutil` module.
Ciao,
Marc 'BlackJack' Rintsch
--
http
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
-escape')
a
b
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
something wrong?
Hard to tell without seeing where `IFRAMED2` is bound and without knowing
what you actually want to do. Can you provide a self contained example
that people here can actually try!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
', 'line3.item':'N73',
'line5.item':'Screen Cover'}
result = defaultdict(dict)
for key, value in d.iteritems():
new_key = key.split('.', 1)[0] # Get the 'line#' part.
result[new_key][key] = value
print result
Ciao,
Marc 'BlackJack' Rintsch
--
http
`` before.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
(object):
@staticmethod
def my_real_static_method():
# Look ma, no `self`. :-)
Static methods are just functions, on classes `classmethod`\s are often
more useful. They get the class as first argument.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
? That is
without having to read another large file first?
AFAIK no.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
in the previous run. So you only gain something on
subsequent reads on the file.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
returning something is
okay, but a calculation that lasts an hour or so would surprise many.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
problem seems to be parsing those lines. That is not a
valid Python dictionary unless the names `Bob`, `Humboldt`, `red`, and
`predatory` are not already defined. So you can't just ``eval`` it.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
!'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
` are deprecated.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
= dict()
for x in xrange(1, 4):
M[x] = Material(x)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 11 Aug 2007 02:41:26 -0700, vedrandekovic wrote:
I was install Python 2.5 and uninstall Python 2.4 now I cannot run my
scripts, only from idle
What should I do?
Install 2.4 again. Both can be installed in parallel.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
But then, even when terminating the interpreter, __del__ is not called.
Because that is not guaranteed by the language reference. The reason why
it is a bad idea to depend on `__del__` for important resource management.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
`` this would
have severe consequences for cached/shared objects. Just imagine:
from your_module import bzzzt
def f():
print 2 + 2
bzzzt(2) # This changes the value of 2 to 3.
f()# This prints '6'!
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
0.1555111512312578270211815834045410156250 instead?
Use string formatting to tell the number of digits you want to see:
In [16]: '%.56f' % 0.1
Out[16]: '0.1555111512312578270211815834045410156250'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
decorators?
*The* predefined decorators? Decorators are just functions after all.
There are some meant to be used as decorators but there are also
ordinary functions that may make sense as decorators.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 11 Aug 2007 17:10:05 +, Adam W. wrote:
On Aug 11, 12:53 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
If `str()` would not round you would get very long numbers because of the
inaccuracies of floating point values. I know Python is lying when 0.1
prints as 0.1, but do you
run but not in the next.
For me CPython, Iron Python and Jython are different implementations as
they are all written from scratch.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 10 Aug 2007 05:54:03 -0700, MD wrote:
On Aug 10, 12:43 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
class A(object):
def foo(self):
bar = 42
The local name `bar` only exists if `foo()` is called on an instance of `A`.
Thanks for your reply. I am calling my
get_x(self):
return ~self.__x
x = property(get_x)
Can anyone please help me understand what the symbol ~ does here ??
This has nothing to do with properties. For integer objects ``~`` is the
bitwise negation or invertion operator.
Ciao,
Marc 'BlackJack' Rintsch
an ``if`` on the result of the search or match. If the regular
expression doesn't match `None` is returned, which is `False` in a boolean
context, otherwise a match object is returned, which is `True` in a
boolean context.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
Abschnitt in DatenTypen: + str(self.abschnitte)
So, I read about deleting Instances with del ... but it does not
work at all.
You can't delete objects with ``del``, just names or references to objects
in containers.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
` or open the file with the `filename`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of the question you might consider actually measuring
your program, as the task may be I/O bound i.e. Python may be faster than
the data comes in regardless of which module, `struct` or `ctypes`, you
use to tear apart and access the data.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
as soon
as the function returns.
It's the very same situation in Python:
class A(object):
def foo(self):
bar = 42
The local name `bar` only exists if `foo()` is called on an instance of `A`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
for the second line and so on.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the trouble.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
on. That's the typical use case for queues.
Why did you put an upper bound to the queue?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 08 Aug 2007 17:11:19 +0200, stef mientki wrote:
Now it's not possible to import in the existing modules the main plugin,
like
from Main_User import *
because this will start the infinite loop.
Which means there's code at the module level. Tell the users to put that
into a
:
(OLSS_AD,
OLSS_DA,
OLSS_DIN,
OLSS_DOUT,
OLSS_SRL,
OLSS_CT) = map(ctypes.c_int, xrange(6))
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
regular expression. I guess you are
confusing groups within one match with multiples matches in the text.
`re.search()` finds exactly one sentence. If you want all sentences use
`re.find_all()` or `re.find_iter()`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
On Tue, 07 Aug 2007 02:13:38 -0700, rozniy wrote:
On Aug 7, 2:11 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Tue, 07 Aug 2007 04:57:19 +, rozniy wrote:
This site
http://python.net/crew/theller/ctypes/tutorial.html#bugs-todo-and-non...
says that enumeration types
: TypeError: 'dictproxy' object does
not support item assignment
Does ``setattr(self.__class__, attr, MyDesc(attr))`` work?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
but removed when
doing multiple runs.
Can you give some example HTML where it fails?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
between function calls in the first function, but
doesn't in the second one?
Not `y` is accumulating but the list object does.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
is called. It is always the
very same list object. And if you mutate it, this will be visible to
other calls to the function.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
it may be expected to see that bloat.
It's a space vs. speed trade off then.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
and can
be compiled as Python extension module.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
and keep it alive forever OR create a new
connection when a method is called and end it after the call is
finished?
Every XMLRPC call uses its own HTTP connection that is closed after the
call is finished.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
`` is executed. So
all calls to this function share the same list object bound to `target`.
Call this function twice without an explicit `target` and you'll see the
problem.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 01 Aug 2007 07:01:42 -0400, Steve Holden wrote:
Marc 'BlackJack' Rintsch wrote:
On Wed, 01 Aug 2007 09:06:42 +, james_027 wrote:
for example I have this method
def my_method():
# do something
# how do I get the name of this method which is my_method here?
Why do
,
showing) whether a function works as expected.
If it is input validation I wouldn't expect it protected by a ``if
__debug__:``. That looks more like debugging/testing.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
def main():
data_file = open('filename', 'rb')
a = list(csv.reader(data_file, delimiter='\t'))
data_file.close()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. In particular
`os.listdir()`, `os.path.isfile()` and `os.path.splitext()`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
that are really needed.
One could argue about `str.encode` and `unicode.decode`. But there are at
least uses for `str.encode` like 'sting-escape', 'hex', 'bz2', 'base64'
etc.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
701 - 800 of 1496 matches
Mail list logo