ted as an integer, without "boxing" into a
> general object.
How is it clear that `i` is restricted to integers? That works only if
you assume `range` refers to the built-in `range()` function. So the
smart compiler has to check all possible control flows up to this point
and be sure
` is 0? The increment happens after the division,
right? :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ery rare? Otherwise it would not be necessary to have and use a
mechanism to declare everything private. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
I suggest an itersplit be introduced for
> lazy evaluation, if you don't want to take up recourses, and it could
> be used just like java's StringTokenizer.
>
> Comments?
Does it really make such a difference?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
intermediate lists.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
; syntax is incorrect
> ---
>
> Can anyone tell me why?
You are trying to execute a program named::
D:/release/win.exe 0.5 1000 100 D:/images/img.ppm out.ppm
Such a program does not exist on your computer. ;-)
Give `subprocess.Popen()` a list with the program name and the individual
arguments as elements instead.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
> My question is: does anyone actually follow guidelines here and if yes
> which ones and are they resonable ( e.g. stable with regard to
> refactoring etc. )?
I follow PEP 8 in my (mostly unpublished) code if that does matter to you. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
;):
> pass
> elde:
> pass
Additional to the speed argument, the ``in`` operator works with more
types, like lists, sets and "iterables". And if someone implements a
"container" class with membership testing, it is more likely he writes a
`__contains__()` method than a `has_key()` method.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
as able to
>> > parse the entire log without problem. Very quirky.
>
> […]
>
> I've attached the whole script. Thanks again for your help.
There are ``break`` statements in the loop body!? Do you really want to
leave the loop at those places?
And I've seen at leas
s an index
entry called `in operator` which leads to the page Comparisons_, telling
how to overwrite the behaviour in your own classes.
.. _Sequence Types: http://docs.python.org/lib/typesseq.html
.. _Comparisons: http://docs.python.org/ref/comparisons.html
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
function one needs to write an
anonymous class with a method. Quite convoluted.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
out
classes like the Io language. Everything there is an object and the base
object has a `clone()` method to make a copy. So you make copies of
objects and modify them to tweak them into the way you want them.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
you could get an object from a "raw" memory address.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
8 -- Style Guide for Python Code:
http://www.python.org/dev/peps/pep-0008/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
The HP RPL leaves even more questions. If the square brackets mean the
``else`` part is optional, what would be the result of the expression if
`c` is `False`?
Hypothetical HP RPL syntax construct in Python::
x = 42 if False end
print x # -> ???
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
functions as static methods of the
module's class. Modules are objects too and can be seen as singletons.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ng function is what I'm working on first.
Still doesn't explain why it is a class.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
king wrong?
You are trying to subclass a module here, just like the error message
says. The module contains a `socket` type:
In [3]: import socket
In [4]: type(socket)
Out[4]:
In [5]: type(socket.socket)
Out[5]:
`select.select()` is a function:
In [6]: import select
In [7]: type(select.select)
Out[7]:
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, saif.shakeel
wrote:
> File writing can be done in that way,but my query is
> something different.I have to rename the output file by default with
> input file name(only changing the extension.
Take a look at the functions in `os.path`.
Cia
p_list:
if re.search(regexp, line):
skip = True
break
And if you don't intent to count the `skip`\s a `True` seems to be more
readable.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
able and never returns
> to the calling python script.
> I tried "os.fork" it will start an independent process,
> since logic of my program depends on the results of executable.
Take a look at `os.system()` or the `subprocess` module.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, jocknerd wrote:
> The biggest difference in my two apps is the C app uses linked lists.
> I feel my Python app is doing too many lookups which is causing the
> bottleneck.
Then replace those linear searches you wrote in Python with a dictionary.
Cia
ere any formatting functions available or do I need
> to make my own? Perhaps there is something similar to C's printf
> formatting.
You mean like `time.strftime()`!? :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
nit__ of B.
>
> Several variants of the program produces similar results.
>
> Please, could someone explain which way is the correct way?
Call the `__init__()` of `A`:
class B(A):
def __init__(self, a):
A.__init__(self)
self.v2 = 2
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
d())
>>>> testUNI.close()
>>>> testUNI = file("c:\\temp\\test2.txt",'r')
>>>> testUNI.read()
> '\xff\xfe\n\x00'
> Bit pattern on disk:\0xff\0xfe\0x0a\0x00
> Bit pattern I was expecting:\0xff\0xfe\0x0d\0x00\0x0a\0x00
>>>> testUNI.close()
Files opened with `codecs.open()` are always opened in binary mode. So if
you want '\n' to be translated into a platform specific character sequence
you have to do it yourself.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
is shorter than using `replace()`:
In [9]: s = '12345 4343 454'
In [10]: s = s[:-1] + 'r'
In [11]: s
Out[11]: '12345 4343 45r'
BTW most things in the `string` module are deprecate because they are
available as methods on string objects.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
der:
> _csv.Error: string with NUL bytes
> Exit code: 1 , 0001h
As Larry said, this most likely means there are null bytes in the CSV file.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
; Is this not what you want? These are the only methods in the Foo
> class.
The OPs problem is, there is no access to the class or type because
there is no name. You can get just instances from a factory function.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
e
>
> 1 2
> 1 3
> 1 4
> 1 5
> 2 3
> 2 4
> 2 5
> 3 4
> 3 5
> 4 5
But only if the elements in the list are unique. And the runtime is
suboptimal because `index()` is doing a linear search -- the outer loop
becomes slower and slower with each iteration.
Ciao,
ts
isn't as compact and readable as simple regular expressions. So both `re`
and higher level parsers are useful together and don't supersede each
other.
The same holds for C and Python. IMHO.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to be written.
> I have my code, but it makes python intepreter crash everytime on my
> Vista.
Show minimal (non-)working code, tell us the exception plus traceback and
explain "crash".
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
turn the value(s) instead:
_exitcode = 0
def set_exitcode():
return 1
if __name__ == '__main__':
print _exitcode
_exitcode = set_exitcode()
print _exitcode
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ok at the
methods it implements and do this for your "number like" class.
> I'm not satisfied with Python Docs.
Why? What does `Emulating numeric types`_ in the reference manual lack in
your opinion?
.. _Emulating numeric types: http://docs.python.org/ref/numeric-types.html
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
set(local) - set(remote))
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
some 3-4 times faster than
> the for loop
>
> How is this possible?
Good question. ``for`` loops are of course reliable. Can you give a
short self contained example that shows the behavior?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ph and node classes this
notification can be injected by wrapper classes to some degree.
For very fine grained observation of an algorithm you might try to
implement a step by step debugger.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
from IPython.Shell import IPShellEmbed
>ipshell = IPShellEmbed()
>print "Please set these variables: project_name, group_name ...and
> then type create()"
>### I even tried to put all my
>ipshell() # this call anywhere in your program will start IPython
You have to call the function with arguments. The default values are only
evaluated once when the ``def`` statement is executed, not every time the
function is called.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
as a function called urlopen.
Do you have a file called `urllib.py` in the current directory? Then this
gets imported instead of the module in the standard library.
Add this directly after the ``import`` to see what's happening:
print urllib.__file__
print dir(urllib)
Ciao,
Marc '
mean just recommendations from the programmer. So
you can say this name should be an `int` and the JIT compiler produces
code in advance, but it's okay to pass another object instead.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ames.
Doesn't this depend more on the file system than the operating system?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
I think I have vague idea how the input looks like, but it would be
helpful if you show some example input and wanted output.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
es
have some methods with the same names and the same semantics they share
the same interface. And a class that isn't meant to be instantiated or
doesn't implement all methods is an abstract class.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
If you want to change the outcome of the functions and objects then simply
give the prefix as argument.
In [21]: tempfile.mktemp(prefix='eggs')
Out[21]: '/tmp/eggsBqiqZD'
In [22]: a = tempfile.NamedTemporaryFile(prefix='eric')
In [23]: a.name
Out[23]: '/tmp/eri
ne 80 lGwU does not
> appear.
It is not assigned, otherwise you would not get this error. The line
number is also correct because it's the start of the construct or "logical
line" where the name is referenced. Just look at the very next line in
the source.
> Another strange
ry readable,
> and I wonder if it's efficient.
Give it a name and it gets more readable:
def get_name(setobj):
return iter(setobj).next()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
d of fixing the code
that doesn't!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, James T. Dennis wrote:
> Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>> In <[EMAIL PROTECTED]>, James T. Dennis wrote:
>
>> You can change it by simply assigning to the name:
>
>> In [15]: tempfile.templ
> def __init__(self):
> self.genB = GenB()
>
> def records(self):
> for a in Gen.records(self, A()):
Here you create an instance of `A` and pass that *instance* and not the
*class*. If you would pass the class here, you must create objects
result = data[offset:offset + chunksize]
if not result:
break
yield result
def parser1(data):
chunk = data.next()
# ...
parser2(data)
def parser2(data):
chunk = data.next()
# ...
parser3(data)
# ...
def main():
# Read or create data.
omething`
objects like this:
something = Something()
# Puts some entries into `something`.
for entry in something:
print entry
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
you don't know how to input them with your
keymap or keyboard layout.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
You can test for the prefix with the `startswith()` method and use string
slicing to create a new string without the prefix:
In [3]: prefix = 'Timeout '
In [4]: longname = 'Timeout N_Bs'
In [5]: longname.startswith(prefix)
Out[5]: True
In [6]: longname = longname[len(prefix):]
In [7]: longname
Out[7]: 'N_Bs'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
't
supported it last time I tried. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
6) Ω, and I think
some omegas in the mathematical symbols area too.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, Michel Claveau
wrote:
> And Il1 O0 ?
Hm, we should ban digits from identifier names. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ackwards
compatibility was such a high priority. The 2.x series will be supported
for some time parallel to 3.x, so there is enough time to migrate.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ntext, but
e.g. software that should map the workflow of a local company with local
laws and regulations and internal "names" for things and concepts looks
strange in both, pure "english" and mixed local language and english. But
the latter is easier to map to the specifications and language of the end
users.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
e starts to argument like you. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
any thing, and afford to keep them in a particular order. Is
> there any way I can speed up this as I have to do this for around 4000
> times with tree size being ~5000.
What about this:
def search(tree, path):
while path:
result = tree.get(path)
if result is not None:
return result
path = path[:-1]
raise KeyError('path not on tree')
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
and a bit faster too as a method lookup is
spared.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
en end users with
transliterated identifiers. If the OpenOffice API wouldn't be so
"javaesque" this would be a good use case for code with non-ASCII
identifiers.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
rogramming professional it
may be mandatory to be able to write english identifiers, comments and
documentation, but there are not just programming professionals out there.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
at the `code` module in the standard library:
In [31]: code?
Type: module
Base Class:
String Form:
Namespace: Interactive
File: /usr/lib/python2.4/code.py
Docstring:
Utilities needed to emulate Python's interactive interpreter.
Ciao,
Marc
In <[EMAIL PROTECTED]>, Stefan Behnel wrote:
> René Fleschenberg wrote:
>> Marc 'BlackJack' Rintsch schrieb:
>>> There are potential users of Python who don't know much english or no
>>> english at all. This includes kids, old people, people fro
:
In [75]: a = 5
In [76]: b = 5.0
In [77]: a == b
Out[77]: True
In [78]: f(a) == f(b)
Out[78]: False
And `f()` doesn't even use something like `random()` or `time()` here. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
if pattern_re.match(path)]
This lacks `glob.glob()`\s special handling of patterns containing
directory names though.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
pairs different" constraint is something
I would not even attempt to put in a regex. For searching candidates this
should be good enough::
r'(\d+,\d+/){5}\d+,\d+'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
py several tiffs into one
multipage tiff and `tiff2pdf` to convert it into PDF.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ly. What about names with letters
not in the ASCII range?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
anguage with implicit declaration. "
>
> Is Python strongly typed or untyped?
Strongly typed.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ects?
Anyway… If the data doesn't fit into memory anymore it's time to put
them into a database. Either a `shelve`, an SQL database like SQLite or
maybe an object database like zodb or Durus.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
talking about the Python Imaging Library (PIL) here? What
have you tried and in which way did it fail?
What about the `resize()` method on image objects?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
good idea because there are no
really hard guaranties by the language if and when it will be called.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ontain valid characters of this type
http://www.w3.org/TR/REC-xml/#NT-Char (linked from the grammar of CDATA in
your link above).
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
mplemented I can do
> this simply by counting the lines!
for line_nr, line in enumerate(f):
# Do something with `line_nr` and `line`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ll Python use swap memory or will it fail?
What about putting the data into a database? If the keys are strings the
`shelve` module might be a solution.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
;t
have to be an SQL database. The `shelve` module or an object DB like zodb
or Durus are databases too.
Maybe you should try it and measure before claiming it's going to be too
slow and spend time to implement something like a database yourself.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
t;>", y
`map()` expects a function as first argument that will be applied to the
elements in the other the arguments which have to be iterable. That you
can give `None` as a function and the resulting behavior is IMHO a very
ugly thing and has not much to to with the semantics exp
gt; return cmp( a[0], b[0] )
>
> cards.sort( mycmp )
> #print cards
Maybe it's easier to use a key function instead of a compare function. A
key function receives an element and must return something that is then
sorted and the element ends up where the computed key is in t
In <[EMAIL PROTECTED]>, Steve Howell
wrote:
>> def key_func(item):
>> return (len(item), item)
>>
>> data = ['viking', 'spam', 'parrot', 'ham', 'eric']
>> data.sort(key=key_func)
>> print data
>&g
n
error in the docs. You are reading documentation for Python 2.5 and
expect everything in it to work in older versions too?
Pick the right documentation from http://www.python.org/doc/versions/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
build when stumbling over a list comp and it's wasteful because an
unnecessary list of `None`\s is build and thrown away for no reason other
than to have a one liner. This is not Perl! ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ing code for the first
> time?
for func in funcs:
func()
Because it is explicit and readable and matches the english description
"for every function in functions: call that function" very closely while a
list comprehension or your "perlish" line noise is much more magic to
explain and harder to remember.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
is there a way to force python to release this memory ?!
AFAIK not. But why is this important as long as the memory consumption
doesn't grow constantly? The virtual memory management of the operating
system usually takes care that only actually used memory is in physical
RAM.
Ciao,
do the
> math. (Too lazy to explain further...)
Let's leave 'foo' and 'ar':
1. B = + = 2 key strokes.
2. _b = + <-> and = 3 key strokes.
At least on my keyboard + layout.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ummy, record_lines in groupby(mark_records(lines), fst):
yield imap(snd, record_lines)
def main():
source = """\
> name1
line_11
line_12
line_13
...
> name2 ...
line_21
line_22
...""".splitlines()
for record in iter_records(source)
Find some page with actual weather reports or forecasts and use the
BeautifulSoup module to scrape the information you need.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
A.__init__(self, x, y)
def main():
B.from_str('42,23')
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
Maybe you should stop searching the explanation within Python or
`ElementTree` and accept having a broken XML file on your disk. :-)
Have you checked the local XML file with something like `xmllint` or
another XML parser already?
Ciao,
Marc 'BlackJack' Rintsch
--
http://ma
t the image, not the name. Read the binary file and print
it.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ence all exceptions with a bare except here. This
swallows any errors in `replaceFieldsAndIndices()`. Maybe some of them
are not the exception you expect, but real errors in your program!?
Ciao,
Marc 'BlackJack' Rintscj
--
http://mail.python.org/mailman/listinfo/python-list
[74]: a = iter(A())
In [75]: a.next()
---
Traceback (most recent call last)
/home/bj/ in ()
/home/bj/ in __getitem__(self, key)
:
So there's no reliable way to test for "iterables" other than actually
iterate over the object.
Ciao,
Marc
On Wed, 25 Jul 2007 15:46:14 -0400, Carsten Haese wrote:
> On Wed, 2007-07-25 at 19:11 +0000, Marc 'BlackJack' Rintsch wrote:
>> And just calling `iter()` doesn't work either:
>>
>> In [72]: class A:
>>: def __getitem__(se
ext()` consumes an element if `obj` is not "re-iterable".
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 25 Jul 2007 10:47:33 -0700, Paddy wrote:
> But then,what would _0 be, the number 0 or the name _0 analagous to
> a0
Of course the name because numbers have to start with a digit or a dot.
Otherwise this would break backwards compatibility.
Ciao,
Marc 'BlackJa
tedious and error prone.
If you are the designer of `f` then just receive the whole `x` as *one*
argument.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
s you would do in Python: convert the argument into a tuple
if you *really* need a tuple, or just use it as sequence or via iterator.
And pay attention to errors of course.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
serialized form, is about bytes in some encoding. So this can
only be stored in `str` objects. `unicode` is already decoded. If you
want to feed `unicode` objects to an XML parser, simply encode it before
passing it.
The question remains why you have "serialized XML" as `unicode` in
inefficient because the file gets read 36
times. If the data is already sorted you can use `itertools.groupby()` to
get the groups and write them to several files. Otherwise if the files
can be read into memory completely you can sort in memory and then use
`itertools.groupby()`.
Ciao,
On Fri, 27 Jul 2007 12:15:25 +0200, Bruno Desthuilliers wrote:
> 4/ print "//-+alibaba sinage"[4:].startswith('a')
print "//-+alibaba sinage".startswith('a', 4)
This does not create an extra string from the slicing.
Ciao,
Marc 'Black
701 - 800 of 1811 matches
Mail list logo