++ is better than C, agree or disagree? (four word maximum)
STL compile error diagnostics.
So do you agree or disagree!? ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
), sequence)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
syntactic sugar for:
``obj.__getitem__(slice(None)).__call__()`` and you want a change in the
implementation of `list.__getitem__()` and `tuple.__getitem__()`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
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,
Marc 'BlackJack' Rintsch
--
http
' and 'ar':
1. B = Shift + B = 2 key strokes.
2. _b = Shift + - and b = 3 key strokes.
At least on my keyboard + layout.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
line_11
line_12
line_13
...
name2 ...
line_21
line_22
splitlines()
for record in iter_records(source):
print 'Start of record...'
for line in record:
print ':', line
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
:
def key_func(item):
return (len(item), item)
data = ['viking', 'spam', 'parrot', 'ham', 'eric']
data.sort(key=key_func)
print data
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to struggle with your solution if he's still running
2.3.
It's available in 2.4 but I don't know when it was introduced.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
and the resulting behavior is IMHO a very
ugly thing and has not much to to with the semantics expected from a
`map()` function. The `None` is not the default fill value but a
placeholder for the identity function.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
the grammar of CDATA in
your link above).
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
!
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
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
it will be called.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
like SQLite or
maybe an object database like zodb or Durus.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
typed or untyped?
Strongly typed.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
tiff and `tiff2pdf` to convert it into PDF.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
be good enough::
r'(\d+,\d+/){5}\d+,\d+'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
though.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, but there are not just programming professionals out there.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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 from countries
that have letters that are not that easy
]: 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
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
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
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
):
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
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
case for code with non-ASCII
identifiers.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
(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
. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
()
# Puts some entries into `something`.
for entry in something:
print entry
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
parser1(data):
chunk = data.next()
# ...
parser2(data)
def parser2(data):
chunk = data.next()
# ...
parser3(data)
# ...
def main():
# Read or create data.
# ...
parser1(iter_chunks(data, 100))
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
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.template = 'spam'
In [16]: tempfile.template
Out[16]: 'spam'
I know
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 in
`Gen.records()`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
in that other namespace? Is it
a closure? (Or like a closure?) Where is this particular aspect
of the import/namespace semantics documented?
You *can* change it, but it is not used by the code in that module.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
written ``raise SomeError`` or
``assert False`` instead of all those useless ``else: pass``. If this
branch is taken, obviously `lGwU` is not bound.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
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
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
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
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 'BlackJack' Rintsch
--
http://mail.python.org/mailman
another object instead.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
than the operating system?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
some example input and wanted output.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
':
print _exitcode
_exitcode = set_exitcode()
print _exitcode
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
instances from a factory function.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the __init__ 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
()` 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
'
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
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
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.
Ciao,
Marc 'BlackJack
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
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
(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
(socket.socket)
Out[5]: type 'type'
`select.select()` is a function:
In [6]: import select
In [7]: type(select.select)
Out[7]: type 'builtin_function_or_method'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
://www.python.org/dev/peps/pep-0008/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
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
working on first.
Still doesn't explain why it is a class.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. 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
if you could get an object from a raw memory address.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
writes a
`__contains__()` method than a `has_key()` method.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
seen at least two times ``somefile.close`` which does just
reference the `close()` method but does not *call* it. Parenthesis are
the call operator in Python and they are not optional!
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
.. _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
class with a method. Quite convoluted.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
. ;-)
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
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
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 `range` was not bound to something different.
Ciao,
Marc 'BlackJack
,
right? :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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
',
'2002',
'2003',
'2004',
'2005',
'2006',
'2007',
'2008',
'2009',
'2010']
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
comment was used. So your costumer might check his Python version and
maybe he should update.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
letters by convention. And maybe it's better to write
`MONTHS` instead the abbreviation.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
In [EMAIL PROTECTED], Gabriel
Genellina wrote:
En Thu, 12 Apr 2007 08:43:49 -0300, Marc 'BlackJack' Rintsch
[EMAIL PROTECTED] escribió:
In [EMAIL PROTECTED], Jorgen Bodde
wrote:
r = c.execute('select * from song where id = 1')
for s in r:
... print s
...
(1
containing all allowed initial characters,
an optional string containing allowed body characters (if omitted,
defaults to the initial character set), and an optional minimum,
maximum, and/or exact length.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
.
In [12]: 'a' * 5
Out[12]: 'a'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
data how can i
proceed?
Just open it in append mode: ``open('blablal', 'ab')``
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
typing and limit
typing errors in long names.
Along with the editor there's always a terminal with IPython running to
test and explore my own code and libraries.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
://www.cnn.com - cnn.com
from urlparse import urlsplit
def get_domain(url):
net_location = urlsplit(url)[1]
return '.'.join(net_location.rsplit('.', 2)[-2:])
def main():
print get_domain('http://www.cnn.com')
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
901 - 1000 of 1496 matches
Mail list logo