latest response simply proves that
>> there is indeed no remark, however irrelevant, that you will allow to go
>> unanswered.
>
> The Complaints department is down the hall...
Though some discussion participants seemingly want to stay for more
being-hit-on-the-head lessons ;)
Geo
at would you do with it? It's an internal object used
for only exit() and quit(), and of no real use elsewhere.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
pointed to the same integer object? Why should more be made,
> when they all do the same thing, and are not subject to change?
Because for typical usage of integers (which doesn't include your example),
it is more expensive to check if there's already an integer with that specific
value out there than to create a new one.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
they all do the same thing, and are not subject to change?
>>
>> Because for typical usage of integers (which doesn't include your example),
>> it is more expensive to check if there's already an integer with that
>> specific
>> value out there than to create
gt; '__setattr__', '__str__', 'func_closure', 'func_code', 'func_defaults',
> 'func_dict', 'func_doc', 'func_globals', 'func_name']
>
> I'm using Python 2.4.3, if that is at all relevant. Thanks in advance
> for any help.
y is not an attribute of func, it's a default parameter value and as such
stored in func_defaults:
>>> def f(x=1):
... pass
...
>>> print f.func_defaults
(1,)
>>>
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy wrote:
> "Georg Brandl" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> tobiah wrote:
>>> Suppose I fill an list with 100 million random integers in the range
>>> of 1 - 65535. Wouldn't I save much memory if all o
> in order to see HTML source anymore. In other words I will see only an
> empty string. Suggestions?
response = urlopen(url)
content = response.read()
forms = ParseResponse(content)
i.e., adapt ParseResponse to accept a string, or wrap the string in a
StringIO:
import cStringIO
forms = Pa
;>>> lst = range(10)
>>>> lst[:Top]
FWIW, this works with 2.5 and the __index__ slot:
>>> class Top(object):
... def __index__(self):
... return sys.maxint
...
>>> a=range(5)
>>> a[:Top()]
[0, 1, 2, 3, 4]
>>>
Georg
--
http://mail.python.org/mailman/listinfo/python-list
s because the builtin xrange insist on its arguments
> being ints instead of allowing duck typing.
xrange() *could* be implemented as shown above, but do you realize
that it would be a severe performance hit compared to the current
implementation, which doesn't give almost all users a benefit at all?
Georg
--
http://mail.python.org/mailman/listinfo/python-list
n the except clause. If that's successful, your
program will continue normally.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
itself
doesn't offer such an option.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
e character
> from a string if it exists?
fileName = fileName.rstrip("\n")
though this will remove more than one newline if present. If you only want
to remove one newline, use
if fileName[-1:] == '\n':
fileName = fileName[:-1]
Georg
--
http://mail.python.org/mailman/listinfo/python-list
)
> Traceback (most recent call last):
> File "", line 1, in ?
> TypeError: str() takes at most 1 argument (2 given)
str() is not only for converting integers, but all other types too.
An explicit argument for this special case is not Pythonic IMO.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
ror() is that exception() passes the "exc_info=1" keyword
argument to error() which means that the stack trace is added to the
logging message.
The default logger prints to stdout, which is why the stack trace is printed
there too.
(In the sense of the logging docs, an except:-clause *IS* an error handler).
Georg
--
http://mail.python.org/mailman/listinfo/python-list
at
> will have the exact same function as itertools.repeat?
There's no possible value. You'll have to write this like
def myrepeat(obj, times=None):
if times is None:
return itertools.repeat(obj)
else:
return itertools.repeat(obj, times)
Many functions implemented in C have this behavior.
For all functions written in Python, you can look up the default
value in the source.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
line("helloiamsuperman")
>> ['hell', 'oiam', 'supe', 'rman']
>
> there are laws against such use of regular expressions in certain
> jurisdictions.
... and in particularly bad cases, you will be punished by Perl
not less than 5 years ...
Georg
--
http://mail.python.org/mailman/listinfo/python-list
lpful warning that the above should follow the home
> directory in the path list.
>
> PEP 302 says "[PYTHONPATH] is directly needed for Zip imports."
>
> The role of Python25.zip is not clear. Is it required in the path just
> to enable the import X.zip capability?
No. It's there just *in case* you have a Python25.zip lying around containing
the library. By default, it isn't.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
One Way to Do It", I
> didn't bother searching for alternatives.
>
> Is there a list somewhere listing those not-so-obvious-idioms? I've
> seen some in this thread (like the replacement for .startswith).
>
> I do think that, if it is faster, Python should translate
> "x.has_key(y)" to "y in x".
How and when should it do that?
Georg
--
http://mail.python.org/mailman/listinfo/python-list
iwl wrote:
> Hello can I make funktions callable without () like print
> at time the interpreter seems to printout the adres when I type the
> function without ()
print is not a function, it's a statement, and as such equivalent to
raise or assert.
Georg
--
http://mail.pyth
* point of tuples. They are an ordered collection of
values, and you are supposed to know which data is found at which index.
Don't tell me that tuples in maths are sets.
For a mathematical example, take
A = { (x,y) : 0 < x < 1, 0 < y < 1 }
Here, (x,y) is a 2-tuple, and you know that at index 0 there's the x-coordinate
of a point contained in the square A, and at index 1 there's the y-coordinate.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten wrote:
> @decorator
> def f():
># ...
>
> is the same as
>
> def f():
> # ...
> f = decorator(f())
^^
Nope, f is not called here. (Think of staticmethod).
Georg
--
http://mail.python.org/mailman/listinfo/python-list
ound that allow you to do a similar thing, like
class Person(object):
age = 0
@Property
def age():
def fget(self):
return self.age
def fset(self, value):
self.age = value
return locals()
but here, Property is not the built-in "proper
ot;);
return NULL;
}
universe->un_god = PyGod_FromName(god_name);
universe->un_size = 0;
universe->un_expand_rate = COSMOLOGICAL_CONSTANT;
return universe;
}
Georg
--
http://mail.python.org/mailman/listinfo/python-list
#x27;t think he'd have the time for that. I heard he's busy planning
his lawsuit to enforce his claim for more pension.
> Regarding the topic:
>
> I can't see where Perl should be more accessible than Python.
Well, not really. But your $, @, %, {, }, ! etc. keys should b
... and it highlights even Brainf*ck!
The home page is at <http://pygments.pocoo.org>.
Read more in the FAQ list <http://pygments.pocoo.org/faq> or
look at the documentation <http://pygments.pocoo.org/docs>.
regards,
Georg Brandl
--
http://mail.python.org/mailman/listinfo/python-list
,col):
> return table.remove(col)
table.remove() also returns None.
> print enlargetable([[1],[2],[3]],[4])
>
> # and this code works.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
text)
class TestList(ListBox):
items = ['First', 'Second']
_Slight_ misuse of "class" though...
Georg
--
http://mail.python.org/mailman/listinfo/python-list
in (relatively slow) pure Python, while
> the count method executes (relatively fast) C code. So even though count
> may do more work, it may do it faster.
Why does "not b in m" execute in pure Python? list.__contains__ is implemented
in C code as well as list.count.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Michael Tobis wrote:
> Someone asked me to write a brief essay regarding the value-add
> proposition for Python in the Fortran community. Slightly modified to
> remove a few climatology-related specifics, here it is.
Great text. Do you want to put it onto a Wiki page at wiki.python.or
possible to create a new statement, with suite
and indentation rules without hacking the interpreter or
resorting to alternative bytecode compilers such as "pyc".
Creating a _function_ named "loop" is easy as Jonathan's
answer shows.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
>
> You might also look at list comprehensions. Replacing the first line
> in the above with
>
>codes = [x[0] for x in list1]
>
> should yield the same result.
Even another way:
import operator
codes = map(operator.itemgetter(0), list1)
Georg
--
http://mail.python.org/mailman/listinfo/python-list
ill basically look like this:
#!/bin/env python
# these are custom headers, Content-type is mandatory
print "Content-Type: text/html"
# an empty line separates headers from content
print
print "..."
# do stuff here
print "..."
Georg
--
http://mail.python.org/mailman/listinfo/python-list
through the Python Tutorial.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
def functA():
> ... pass
>
> >>> functA
>
>
> And what I'd like to do is:
>
> >>>__internalFuncDict__['functA']
>
Read about globals(), dir() and module.__dict__.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
while loop:
> print "OK"
Seems you forgot "()" after "while loop" above.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
key\'\\012p17\\012S\'hi\'\\012p18\\012sb."',
> 'value': , 'key': 'hi'}
>
>
> I can't really say what goes wrong here, but it looks like a bug to me
> -- comments? I guess I'll have to go to protocol 0 for this, or not
> serialize the cookie but re-parse it on the other side (this pickle
> gets passed down a UNIX socket together with the file descriptor of a
> request, in a load balancing system).
You can report a bug at SourceForge.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
strengths to
>>> non-Python programmers?
>>> Small examples that will make them go "Wow, that
>>> _is_ neat"?
>>>
>>
>> 15 small programs here:
>>
>> http://wiki.python.org/moin/SimplePrograms
>>
>
> IMHO a few python
ot;information"
i get from the list in C structures which can be converted.
Basically, it are list of packages, which have several attributes (next,
prev, etc). But i don't know how to supply a proper list from the binding /
object written in C.
Any suggestions or hints about this?
ster with pyrex,
for some reason it fits me better.
I'd like to use swig, but for some reason i've troubles defining a
completely new type, so a type which is not a wrapper type, but a type
provided to python.
Kind regards,
Georg
Stefan Behnel wrote:
> STiAT wrote:
>> Why do yo
t function directly works properly, the function extends a
C list for the object. Now i want a function adding the whole array to a
the list, using the 2nd function.
Does anyone of you have an idea how to archive this?
Thank you,
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Kurt B. Kaiser schrieb:
> Patch / Bug Summary
> ___
>
> Patches : 380 open (-36) / 3658 closed (+65) / 4038 total (+29)
We should really try to keep the numbers in this magnitude :)
Georg
--
http://mail.python.org/mailman/listinfo/python-list
ndows ("\r\n") newlines. Try
> to ensure that every line ends with "\r\n".
That shouldn't be a problem since Python reads source files in universal
newline mode.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
e):
def __new__(cls, *args):
return tuple.__new__(cls, args)
should work.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
abcd schrieb:
>> As an immutable type, tuple makes use of __new__.
>>
>> class MyTuple(tuple):
>> def __new__(cls, *args):
>> return tuple.__new__(cls, args)
>>
>> should work.
>>
>> Georg
>
> strange. not very consiste
?
There is already a whole bunch of reports for the EU at
http://codespeak.net/pypy/extradoc/eu-report/
HTH,
Georg
--
http://mail.python.org/mailman/listinfo/python-list
s with an explicit encoding before printing
codecs.open() is very helpful for step 1, BTW.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
if (str != null) && (!str.equals(""))
>
> how can i do that in python?
Strings cannot be "null" in Python.
If you want to check if a string is not empty, use "if str".
This also includes the case that "str" may not only be an empty
string, but also None.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
value.
> I think that ideally there should be a runtime error when assigning an
> item of locals() with a key that's not a local variable name (possibly
> excepting functions containing exec, which are kind of screwy anyway).
I would make the locals() result completely independent from the frame,
and document that it is read only.
(though, this needs some other way for trace functions to interact with
the frame's local variables.)
Georg
--
http://mail.python.org/mailman/listinfo/python-list
elapsedTime[-1:] always contains
at most one character.
If you replace "find" by "index", you get a ValueError exception if
"real" was not found, if that helps you.
Whenever one calls str.find(), one has to check the return value for -1.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
't have access to any more
> objects than I explicitly give it?
The function f has a func_globals attribute which points to the globals it
will use for execution. This is of course set at definition time so that
functions from, e.g., another module, have the globals of that module available.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
ver Python/Django.
Given that so many web sites still decide to (re)write in PHP, I don't think
that is much of an argument.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
def f(*a): ...
>
> shows that the "immutable list" interpretation is firmly ensconced in
> the language.
IIRC, for this use case of tuples there was a practical reason rather than
an interpretation one. It is also on the list of potential changes for
Python 3000.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
ings is explicitly set to None?
IMO the docs don't make it clear that getwriter() is the correct API to use
here. I've wanted to write "sys.stdout = codecs.EncodedFile(sys.stdout,
'utf-8')" more than once.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
t it's probably worth proposing there
> (ideally together with a patch to implement it, just to avoid any
> [otherwise likely] whines about this being difficult to implement:-).
The patch is already done -- I have it lying around here :)
Georg
--
Thus spake the Lord: Thou shalt indent with
> File "/home/public/utility.py", line 177, in run
> exec code+'\n' in context
> File "", line 1
> print 'greg'
> ^
> SyntaxError: invalid syntax
> (Note the ^ actually appears under after the ' )
You have
t;> q.doit()
>
> Er.. I guess there are some details you need to work out for that. But
> in principle, it works fine.
No, it does not. The "q" here is *not* assigned to self.quit, but to the
result of self.quit.__enter__().
Georg
--
Thus spake the Lord: Thou shal
y it has any chance is if someone takes the
> time to implement it and posts a full-fledged PEP to python-dev.
BTW, I've implemented a different feature, namely extended unpacking, such as
a, *b, c = range(10)
where I already had to add the concept of a ``starred'' expression.
If
n the instance (I think).
> I had the same troubles trying to dynamically reassign a __call__ method...
This is correct.
It's not properly documented though, and not applied consistently, e.g.
__enter__ and __exit__ are looked up in the instance itself.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
and-line tool and as a library
* ... and it highlights even Brainf*ck!
The home page is at <http://pygments.org>.
Read more in the FAQ list <http://pygments.org/faq> or look at the
documentation <http://pygments.org/docs>.
regards and happy Valentine's day,
Georg
--
the way. It would
> accept a filename rather than a file descriptor, anonymous blocks would
> be handled OS-independently, rather than mapping /dev/zero, and so on.)
I'm sure that we will gladly accept a patch implementing this approach.
Cheers,
Georg
--
http://mail.python.org/mailman/listinfo/python-list
> expense of making the caller pass sys.argv. But it would save you
>> having to muck about with importing "sys", then plucking out the
>> module's argv attribute.
>
> but this is great advice.
Actually, use can use PySys_GetObject("argv") instead.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
here...
> pathetic for sure...
You perhaps shouldn't become so excited. Next time, if you're not sure of
the correctness of your solution, try to wait a bit before posting it,
and see if someone other comes up with the same thing you would have posted.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
my ten years here...
> pathetic for sure...
You perhaps shouldn't become so excited. Next time, if you're not sure of
the correctness of your solution, try to wait a bit before posting it,
and see if someone other comes up with the same thing you would have posted.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
I've just started working with unittests and already hit a snag. I
couldn't find out how to implement a setup function, that is executed
only _once_ before all of the tests. Specifically, I need this for
testing my database interface, and naturally I don't want to create a
new database in-memory an
On Jan 20, 3:57 pm, Roy Smith wrote:
> In article
> <45b0bf56-673c-40cd-a27a-62f9943d9...@r41g2000prr.googlegroups.com>,
> Georg Schmid wrote:
>
> > I've just started working with unittests and already hit a snag. I
> > couldn't find out how to impl
over IRC, in #python-dev on irc.freenode.net,
and the Wiki page http://wiki.python.org/moin/PythonBugDay has all
important information and a short list of steps how to get set up.
Please spread the word!
Georg
--
http://mail.python.org/mailman/listinfo/python-list
them together with the core developers.
We will coordinate over IRC, in #python-dev on irc.freenode.net,
and the Wiki page http://wiki.python.org/moin/PythonBugDay has all
important information and a short list of steps how to get set up.
Please spread the word!
Georg
--
http://mail.python.org/ma
will coordinate over IRC, in #python-dev on irc.freenode.net,
and the Wiki page http://wiki.python.org/moin/PythonBugDay has all
important information and a short list of steps how to get set up.
Hope to see you there!
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Maric Michaud schrieb:
Le Tuesday 16 September 2008 14:47:02 Marco Bizzarri, vous avez écrit :
On Tue, Sep 16, 2008 at 1:26 PM, Georg Altmann <[EMAIL PROTECTED]> wrote:
Marco Bizzarri schrieb:
On Mon, Sep 15, 2008 at 9:37 PM, Georg Altmann <[EMAIL PROTECTED]>
wrote:
But this imp
x27;s quite possible that people do checkout the SVN trunk and play with them.
Course, Fredrik could have said "In 2.5 you'll be able to write..."
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten wrote:
> Python 2.5 will feature similar functions any() and all() which seem to have
> a fixed predicate == bool, though.
You cannot write
all(predicate, list)
but
all(predicate(x) for x in list)
Georg
--
http://mail.python.org/mailman/listinfo/python-list
ere that's it's obsolete now. What's the
> alternative?
This module was not useful enough to remain in the standard library.
However, you can find poly.py in /usr/lib/python2.x/lib-old and use
it from there (either adding this directory to sys.path or copying
the file to your workin
line 1, in ?
AttributeError: 'C' object has no attribute 'a'
>>>
>>> class D(object):
... __dict__ = {}
...
>>> d = D()
>>> d.a = 1
>>> d.__dict__
{}
>>> d.__dict__ = {}
>>> d.a
1
Thanks,
Georg
--
http://mail.python.org/mailman/listinfo/python-list
if you need it, you'll have used a library
PEP328 multi-line imports: a matter of parentheses
PEP331 locale-independent float/string conversions: never heard of it myself ;)
Summa summarum, exactly one new syntax, one new builtin and one new stdlib
module to care about.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Alan Franzoni wrote:
> Georg Brandl on comp.lang.python said:
>
>>>>> d.__dict__
>> {}
>
> Which Python version, on which system? I can see the properly inserted
> attribute in __dict__, both with old style and new style classes.
It's 2.4.2, on Linu
[moving to python-dev]
Alex Martelli wrote:
> Georg Brandl <[EMAIL PROTECTED]> wrote:
>
>> can someone please tell me that this is correct and why:
>
> IMHO, it is not correct: it is a Python bug (and it would be nice to fix
> it in 2.5).
Fine. Credits go to Michal
ly have to
> define it once.
>
> def mux(s, t, f):
> if s:
> return t
> return f
But be aware that this is not a complete replacement for a syntactic
construct. With that function, Python will always evaluate all three
arguments, in contrast to the and/or-for
t needed anymore:
Py_DECREF(seq);
> return newseq;
>
> bubblesort(int list[], int seqlen) is doing the actual job and it is
> working.
>
> What did I do wrong? As I am quite new to C, I probably made many
> mistakes, so please feel free to correct me.
There
Fabian Steiner wrote:
> Georg Brandl wrote:
>> Fabian Steiner wrote:
>>> [...]
>>> for (i = 0; i <= seqlen; i++) {
>>
>> That is one iteration too much. Use
>>
>> for (i = 0; i < seglen; i++)
>>
>>>
thon.org/cgi-bin/moinmoin/PythonBugDay
Cheers,
Georg
--
http://mail.python.org/mailman/listinfo/python-list
dge, viewpoints and experiences, who sometimes disagree.
Had I seen the tracker item and/or read this thread to the end before I made
that checkin, I probably wouldn't have made it... ;)
Georg
--
http://mail.python.org/mailman/listinfo/python-list
stand
how the methods work.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
thinks I shouldn't use something like
>
> for i in lst:
> ...
>
> in my code at the global level because some module in the standard
> library has a function with a local i.
>
> Pychecker also froze on my system.
Pychecker imports the modules. Thus these things can happen when a
module expects not to be imported as-is.
> I don't recommend the use of these tools.
Well, then I don't recommend anyone reading your code
Georg
--
http://mail.python.org/mailman/listinfo/python-list
print 1.090516455488E15 / 100
1090516455.49
print is using str() which formats the float number with 12 digits
precision and therefore rounds the result.
repr() however, which is used by the interpreter when printing
out expression results, uses 17 digits precision which is why
you can
Fabiano Sidler wrote:
> I really wanted to learn the reason for this, nothing else! ;)
I suspect performance reasons. Can't give you details but function
is used so often that it deserves special treatment.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
and more information, see the Wiki page at
http://www.python.org/cgi-bin/moinmoin/PythonBugDay
Cheers,
Georg
--
http://mail.python.org/mailman/listinfo/python-list
changed with Python 3.0.
Most certainly.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
ts which are pink) => true
> all(flying elephants which are not pink) => true
>
> So, these flying elephants -- are they pink or not?
No, you ask two different sets whether they are true.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
> Op 2006-03-28, Georg Brandl schreef <[EMAIL PROTECTED]>:
>> Fabiano Sidler wrote:
>>> I really wanted to learn the reason for this, nothing else! ;)
>>
>> I suspect performance reasons. Can't give you details but function
>
that hard to understand, is it? Whoever made the builtin types new-
style types didn't add the BASETYPE flag to function or slice. Apparently
he thought it wasn't worth the effort as he couldn't imagine a use case for it.
So, when someone had liked them to be subclassable, he'd have written a patch.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
s expected, although they had no reason to suspect so.
I've told you already: if a developer wants a feature not currently
implemented, he/she can
- ask on python-dev why
- submit a feature request
- submit a patch
If he/she's not able to do one of these, he/she can at least convince so
Antoon Pardon wrote:
> Op 2006-03-31, Georg Brandl schreef <[EMAIL PROTECTED]>:
>> Antoon Pardon wrote:
>>
>>> Well that looks somewhat short sighted to me. It is also why python
>>> seems to throws so many surprises at people.
>>>
>>> My
t; x=input ('enter a number betwenen 0 and 1: ')
> for i range (10)
> x=3.9*x*(1-x)
> print x
>
> main()
At the very end of the program, that is here, after main(), just insert
raw_input()
Georg
--
http://mail.python.org/mailman/listinfo/python-list
bayerj wrote:
> Expressions like
>
>>>> 2 + 2
>
> return None, too.
Sorry? 2+2 here returns 4, and certainly should with your Python.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
as the program terminates. To prevent that, add
a call to raw_input() at the end of your script. Python will then prompt you
for input, and therefore the window will stay open.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
function with two operations. Let
> "print" print, and propose a separate function (named "format" --yuck--
> or some such) that returns the same text as a string.
Yes! That's really a good idea. But "format" is a bad name. Let's call it
uld if all expressions in
parentheses were tuples.
Thus, the comma is necessary to disambiguate and explicitly tell the parser
that you mean to construct a tuple.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> hi John,
> Python doesn't provide for loop like C / C++ but using Range() or
> Xrange() you can achive all the functionalities of the C for loop.
Not quite.
Georg
--
http://mail.python.org/mailman/listinfo/python-list
the range. But it's a problem when someone just
does
l = range(100)
and assumes that he's got a list, probably doing
l.remove(5)
and so on.
In Python 3000, plans are that range() will be the same as xrange() is now,
and anyone needing a list can call list(range(...)).
Georg
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
> On Wed, 05 Apr 2006 16:21:02 +0200, Georg Brandl wrote:
>
>> Because of backwards compatibility. range() returns a list, xrange() an
>> iterator: list(xrange(...)) will give the same results as range(...).
>
> Georg is pretty much correct in
201 - 300 of 459 matches
Mail list logo