,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
in the
tutorial at http://www.python.org/doc/. Assuming 'while' should work,
what's wrong with the code?
Obviously the condition is alway true. Maybe you have to do something
within the loop so it eventually will be false at some point!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
a return value anyway because there's an implicit
``return None`` at the end of every function.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 25 May 2008 00:10:45 -0700, notnorwegian wrote:
sets dont seem to be so good because there is no way to iterate them.
Err:
In [82]: for x in set(['a', 'b', 'c']):
: print x
:
a
c
b
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of
`iter()`, or `itertools.takewhile()`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
application).
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
you don't keep the value, it gets
deallocated and closed by the destructor.
The language neither guarantees *when* an object will be deallocated nor
that its destructor is called *at all*. It's cleaner to explicitly close
the file.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
and every time you want to inform the
player about something, your game logic calls that function with the
message. It doesn't have to know if it will be rendered as graphic on
screen, displayed as text in a terminal, or synthesized as sexy female
computer voice.
Ciao,
Marc 'BlackJack' Rintsch
compiled your C as C++ and name mangling kicked in?
Can you show a minimal C source for a DLL, how you compiled it, what you
did on the Python side to call it, and how it fails?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
as their actual types?
Take a look at the `inspect` module.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
]: a, b, c, d = 5, 5, 5, 6
In [82]: all(x == 5 for x in (a, b, c))
Out[82]: True
In [83]: all(x == 5 for x in (a, b, c, d))
Out[83]: False
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
)])
File ipython console, line 1
' '.join([`x x` for x in range(1, 6)])
^
type 'exceptions.SyntaxError': invalid syntax
The backticks are syntactic sugar for the `repr()` function and
``repr(x x)`` isn't legal syntax either.
Ciao,
Marc 'BlackJack
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, and supposedly cannot possibly interact.
How should such collisions happen? You don't throw all your names into
the same namespace!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 20 May 2008 10:47:50 +1000, James A. Donald wrote:
2. It is not clear to me how a python web application scales.
Ask YouTube. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
-- '/xyz/py/file' isn't even a legal
identifier name in Python!
Ciao,
Marc 'BlackJack' Rintsch.
--
http://mail.python.org/mailman/listinfo/python-list
string length, Java type information, or
checksums encoded in that data!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
are writing then hadoop seems to throw in
some information into the stream.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'is', 'not' for everything else.
That's wrong. Use ``==`` and ``!=`` for testing equality/inequality and
``is`` and ``is not`` for identity testing. And testing for identity is
quite rare. Rule of thumb: Use it only for known singletons like `None`.
Ciao,
Marc 'BlackJack' Rintsch
!? And wasn't the city object bound to
the name New Amsterdam once? :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
Writing meta classes just for alternative constructors seems to be more of
a mess to me. Too much magic for such a simple case for my taste.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of an MP3 file.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
in both directions.
.. _PyLit: http://pylit.berlios.de/
.. _reStructuredText: http://docutils.sourceforge.net/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to the
name `xrange` at runtime.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 13 May 2008 03:25:51 +, Yves Dorfsman wrote:
Marc 'BlackJack' Rintsch wrote:
y, _, d, _, _, _, _, _, _ = time.localtime()
But you still have have a variable that's using memory for nothing. I
find this unsatisfactory...
Get over it…
Than what's the point of wanting
this? This is the thing that
baffles me the most about this thread.
I do it (with a special name) because static source checkers issue a
warning for unused variables.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 13 May 2008 03:25:06 -0700, wxPythoner wrote:
Why is the \ backslash character frowned upon?
Is it frowned upon?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
have a variable that's using memory for nothing. I
find this unsatisfactory...
Get over it…
Or use `operator.itemgetter()`:
In [36]: operator.itemgetter(0, 2)(time.localtime())
Out[36]: (2008, 12)
:-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the argument.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
(#{year}-#{month}-#{day} interpolate linePrint)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
Hello World programs:
Counterexamples for quite short greetings in other programming languages:
(Free)BASIC::
Print Hello World!
OCaml::
print_string Hello World! ;;
Io::
Hello World! linePrint
Haskell::
main = putStrLn Hello World!
Ciao,
Marc 'BlackJack' Rintsch
--
http
On Thu, 08 May 2008 15:49:01 +0200, pistacchio wrote:
Marc 'BlackJack' Rintsch ha scritto:
On Thu, 08 May 2008 04:17:01 -0700, s0suk3 wrote:
Are you a newbie to Python, or to programming in general? I'll assume
you are a newbie to programming in general because of that last
question you
lives in the operating
system's space.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 08 May 2008 23:35:04 +0200, Hrvoje Niksic wrote:
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] writes:
On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote:
The thing is, I'm not using slots by choice. I'm using the standard
lib socket class, which apparently uses slots.
`socket
for reading, reading and processing,
overwriting the file with the new processed data, etc.)
No.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 02 May 2008 19:23:54 +0100, Arnaud Delobelle wrote:
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] writes:
There are no modern processors with an opcode for incrementing a memory
location!? At least my C64 can do that. ;-)
Indeed! I remember a simple use was to make the border
::
rect.topleft = (x, y)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
obviously there
must be a way to write something like generators in C.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
* that method to be called.
Just like `finalize()` in Java, it can't be used for deterministic
destruction, so it's not that useful after all.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
increment the register
write the value into i.
There are no modern processors with an opcode for incrementing a memory
location!? At least my C64 can do that. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of a hack and I was
wondering if there was a faster way of doing it?
That hack isn't even working properly because ``str(10.0**1)`` has no '+'
in its string representation.
Solution:
n = math.log(v, 10)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
not
inconsistent.
How do I convert that line into a list?
Use the `csv` module in the standard library.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
*once* on
string and unicode objects. Okay that's twice. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
]: ['foo/bar']
In [16]: os.path.splitext('foo/bar')
Out[16]: ('foo/bar', '')
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the wanted information
in the documentation, like John did, you are teaching the OP how to fish.
Which is a good thing. Much more helpful than your remark anyway. You
might as well have kept it to yourself. :-þ
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
at `itertools.islice()` if you want/need
an iterator.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 22 Apr 2008 11:13:43 -0600, Jeffrey Barish wrote:
By the way, I have simplified somewhat the code in the explanation.
Please simplify the code to a minimal example that still has the problem
and *show it to us*. It's hard to spot errors in code that nobody except
you knows.
--
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
instance
though.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
and not bare names. In your `bar()`
function it is completely unnecessary for example because the name `fd4`
disappears right after that line anyway.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. Untested:
def foo(xs):
if xs:
for elt in xs[0]:
for ys in foo(xs[1:]):
yield [elt] + ys
else:
yield []
Called as ``foo([A, B])``.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
programmers will decide that using something other
than python is a better coding practice. I've seen
it happen.
So the average quality of Python coders raises. Cool. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the `minimax method`_ for instance.
.. _minimax method: http://en.wikipedia.org/wiki/Minimax
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 14 Apr 2008 00:49:13 -0700, xakee wrote:
Well if you need an easier transition, go for java. But personally i
would recommend you to go for C/C++.
What's that C/C++!? C and C++ are quite different languages.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
spread the spam to those whose news servers filtered the
original message. Thanks...
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to the `PhotoImage`
instance goes out of scope.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
()` are a bad idea because
the GUI may look odd or is even unusable on other peoples computers with
other screen resolutions, fonts, and font sizes.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
as smooth
as possible as far as I can tell.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
text='1',
command=lambda n=1: self.display(n))
# ...
def display(self, number):
print number
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. Take a look at the options of the `grid()` call and figure out
how to tell that the content of the cell should fill it, so that the
Buttons in the grid automatically are equally sized in each row and column.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
\calculatorGUI.py,
line 92, in Display
str = number + str
UnboundLocalError: local variable 'str' referenced before assignment
Just like the message says: You are trying to use `str` (on the right hand
side of the assignment) before anything is bound to that name.
Ciao,
Marc 'BlackJack
But one can tell because the way Python's syntax is based on indentation,
no one has come up with a syntax for anonymous functions without the
limitations of the current ``lambda``, that doesn't need 'curly braces' and
is still as readable as Python is now.
Ciao,
Marc 'BlackJack
reverse
that step?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
and then increase the identifier character by character and
watch the time of the runs grow exponentially.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
length lists and returns a list of pairs. For example, zip(['a', 'b',
'c'], [10, 20, 30]) should evaluate to the list [('a', 10), ('b', 20),
('c', 30)].
Hey not even a rebinding necessary. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
* stupid disclaimer. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
on, don't let you scare away so easily. Put him in the filter
list of your news client.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
for `lines`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of castironpi is
just irritating noise.
More specifically, who is more entertaining? (check one or none)
[X] - Xah Lee
[ ] - castironpi
Castironpibot becomes boring very quickly. Especially when it starts to
answer its own posts.
Ciao,
Marc 'BlackJack' Rintsch
--
http
On Mon, 31 Mar 2008 12:39:54 -0700, hexusnexus wrote:
How do I receive input from the command line in Python?
Direct way `sys.argv`, comfortable way `optparse`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
character), the length of the
resulting string (in characters) varies. How can I fix this?
Use unicode strings instead.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
(chars.upper())
return s[len(s)-len(s2):]
else:
return s.lstrip(chars)
What about this:
def lstrip2(string, chars, ignore_case=True):
if ignore_case:
chars = chars.lower() + chars.upper()
return string.lstrip(chars)
Ciao,
Marc 'BlackJack' Rintsch
--
http
manual...
Usually `pickle` just works. Those methods can be used if you want to
customize the process, for example if you don't want to pickle the entire
object but just parts of it.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to wait until the garbage collector in CPython
detects the cycle, you can use `weakref`\s for one of the two pointers
in each element.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 25 Mar 2008 12:32:17 -0700, blackpawn wrote:
So what's the deal here? :) I want all objects to be freed when I
shut down and their destruction functions to be properly called.
Then you want something that's not guaranteed by the language.
Ciao,
Marc 'BlackJack' Rintsch
like the
return+linefeed line endings that Windows produces when writing files in
text mode? Try 'wb' as mode for the output file.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
not a good idea anyway
because usually the files and the overhead of reading is greater than the
time to iterate over in memory data like the patterns.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
saying that the unicode 2029 can't be encoded...
Can anyone please tell me how I should handle that paragraph seperator?
You have to encode the unicode object in an encoding that know this
character. UTF-8 might be a candidate encoding for this.
Ciao,
Marc 'BlackJack' Rintsch
--
http
in string literals. If you don't want
this meaning, you have to escape it with another backslash.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 19 Mar 2008 17:59:40 +0100, sam wrote:
Can someone tell me why class-based OO is better that Prototype based,
especially in scripting langage with dynamic types as Python is?
Is it better!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. The first one has an empty
string value ('') while the second one pretty clearly says that
there is a parameter but has no value.
Why nil/?
Because there is a difference between no value and the NULL value!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
binary
file that contains all sources and resources of the project.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the result should be integer or float,
independent of any particular set of arguments? Seems unlikely.
The interpreter can at least print out warnings when a normal division
operator is called with two `int`\s at runtime.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
compact and readable:
In [92]: sys.byteorder
Out[92]: 'little'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'
Those are valid XML and valid XML-RPC, but nil/ isn't.
In XML-RPC there is no `None`, so there's the non standard `allow_none`
Option to allow `None` to be represented as ``nil/``.
And is an empty param/ or value/ really valid XML-RPC?
Ciao,
Marc 'BlackJack' Rintsch
--
http
level of encoding/escaping
producing something that is not JSON anymore, so why do you want to ask a
JSON encoder to deliver it?
This is a feature/function you should find in a HTML templating library.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ran my script as a module in IDLE gui. How does _file_ get
defined?
Do you perhaps mean '__name__'?
I guess not. It makes more sense to apply path functions to `__file__`
than to `__name__`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
if are used to delimit the string. If ' are used as delimiters
then \' is a correct escaping. What is the problem with that!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 13 Mar 2008 00:06:52 -0500, Andrew Rekdal wrote:
Problem is layout_ext and Layout code is dependant on a Class instance
'css'.
Then pass that instance to the `Layout` class in the `__init__()` so both,
the base class and the subclass use the same `CSS` instance.
Ciao,
Marc
compile a subset of Python with optional static typing
to C extension modules.
.. _Cython: http://www.cython.org/
.. _Pyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
301 - 400 of 1496 matches
Mail list logo