ates to i. Pre and post-increments are
almost always confusing unless they are used as the counter-variable
inside for-loops.
--
mvh/best regards Björn Lindqvist
http://www.footballexperts.net/
--
http://mail.python.org/mailman/listinfo/python-list
I think it would be cool if you could refer to instance variables
without prefixing with "self." I know noone else thinks like me so
Python will never be changed, but maybe you can already do it with
Python today?
.import sys
.
.def magic():
.s = ""
.for var in sys._getframe(1).f_locals["s
Thank you for your replies. But they don't deal with my original
question. :) I have read the thousands of posts all saying "self is
good" and they are right. But this time I want to be different m-kay?
I figure that there might be some way to solve my problem by doing
this:
.def instancevar2local
The more features a language has, the harder it becomes to learn. An
example of that is C++ which has almost everything. Classes, structs,
templates, strange keywords that noone uses like auto, inline const,
passing by reference/value, enum, union, lots of macros, multiple
inheritance, namespaces e
x. But the selfless code has
problems with that. I want it to work exactly like how the situation
is handled in Java and C++.
> Alex Martelli:
>> Björn Lindqvist:
>> I think it would be cool if you could refer to instance variables
>> without prefixing with "self." I
> # do other non-extension-related tests here
> if basename.find( "Makefile" ) != -1:
> return "text/x-makefile"
I believe this can be nicelier written as:
if "Makefile" in basename:
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/python-list
> hi all, i´m doing a search engine using python for the spider and php
> to make a web for the search. The Database i have choosen is
> postgreSQL. Do you think it is a good choosen? Any suggestion?
"Databases are implementation details! Considering the database should
be deferred as long as poss
The process seem slow. I've submitted two patches and haven't gotten
any response so far, but it has only been three weeks. Other patches
seem to be idling for months. I'm not complaining, just want to know
why the process is so slow and what you can do when you submit
patches/bug reports to speed
> I am quite new to Python, and have a straight & simple question.
> In C, there is for (init; cond; advance). We all know that.
> In Python there are two ways to loop over i=A..B (numerical.):
> 1) i = A
>while i ...do something...
> i+=STEP
This is indeed quite ugly. You rarely n
I like C++ templates so that you can ensure that a list only contain
items of one type. I also like the JMP instruction in x86 assembler,
you could do some nasty tricks with that.
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/python-list
I like it alot! My only minor complaint is that the name is to long.
Also I *really wish* the Namespace could do this:
r, g, b = col = Namespace(r = 4, g = 3, b = 12)
But alas, I guess that's not doable within the scope of the Namespace PEP.
--
mvh Björn
--
http://mail.python.org/mailman/list
> put it) PyUnit project. I'm sorry if this is a obvious question or one
> that has already been answered, but unit-testing sounds interesting and
> I'm not sure where to start.
Hi Ryan. I belive this (http://www.xp123.com/xplor/xp0201/index.shtml)
is a good way to learn about unit testing by prac
> Python has one feature that I really hate: There are certain special
> names like 'file' and 'dict' with a predefined meaning. Yet, it is
> allowed to redefine these special names as in
>
> dict = [1:'bla']
dir(__builtins__)
Yes, rebinding builtin names accidentally is an annoying and I think
e
The Cookbook features another interesting way to do it:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/204297
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/python-list
Christmas came early this year. Thank you all nice Python developers.
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/python-list
Some more decorator examples.
How to create abstract methods using an @absractmethod decorator:
http://www.brpreiss.com/books/opus7/html/page117.html
Generics, property getters and setters. I don't know what these
decorators are supposed to do:
http://www.cis.upenn.edu/~edloper/pydecorators.html
I haven't read any Python paper books myself but as Christmas is
coming up, I've checked up on what Python books other people
recommend. Everyone who has reviewed Python books seem to like these
books:
* Python Essential Reference
* Python Cookbook
* Python in a Nutshell
The last two are both wri
I like count() and appendlist() or whatever they will be named. But I
have one question/idea:
Why does the methods have to be put in dict? Can't their be a subtype
of dict that includes those two methods? I.e.:
.histogram = counting_dict()
.for ch in text:
.histogram.count(ch)
Then maybe som
py.test is awesome, but there is one slight flaw in it. It produces to
much output. All I want to see when all tests pass is "All X passes
succeded!" (or something similar). py.test's output can be
distracting.
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/python-list
Please do not reply to spam. Replying to spam makes it much harder for
spam filters to catch all the spam or will produce very many false
positives. Atleast that's how gmail's filter works. And if you must
reply, please change the subject line.
On 13 Apr 2005 17:50:06 -0500, "."@bag.python.org <".
t; which exception?)
I like this option the most because it is the most "fail fast". If you
return 'undefined' the error might happen hours later or not at all in
some cases.
--
mvh/best regards Björn Lindqvist
--
https://mail.python.org/mailman/listinfo/python-list
On 8/20/06, Dave Richards <[EMAIL PROTECTED]> wrote:
> Really, really good documentation.
>
> Dave
... Which is the one thing no Python web framework provides. :( A
framework with really good documentation (preferably translated into
multiple languages) would be, I'm sure, the PHP/Ruby on Rails ki
On 10/20/06, Brett Cannon <[EMAIL PROTECTED]> wrote:
> At the beginning of the month the PSF Infrastructure committee announced
> that we had reached the decision that JIRA was our recommendation for the
> next issue tracker for Python development. Realizing, though, that it was a
> tough call bet
Hello, I'm looking for an algorithm to project "MUD maps" such as the
following map: http://www.aww-mud.org/maps/MUD_Maps/Caerin-colour.jpg
MUD:s consists of rooms, each rooms has up to four orthogonal edges
(north, east, west and south) that connects it to another room. So it
is very easy to mode
On 11/5/06, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> BJörn Lindqvist schrieb:
> > Hello, I'm looking for an algorithm to project "MUD maps" such as the
> > following map: http://www.aww-mud.org/maps/MUD_Maps/Caerin-colour.jpg
> >
> > MU
On 28 May 2006 06:20:20 -0700, python <[EMAIL PROTECTED]> wrote:
> at line "for j in linkReturned:" , raise an error:
> File "C:\pythonProgram\test.py", line 308, in main
> for j in linkReturned:
> TypeError: iteration over non-sequence
> how can I get a list from the return of thread.start()
> Personally, I would like to see macros in Python (actually Logix
> succeeding is good enough). But I am no language designer and the
> community has no interest in it. When I absolutely need macros, I will
> go elsewhere.
One must wonder, when is that? When do you absolutely need macros?
--
mv
> > > community has no interest in it. When I absolutely need macros, I will
> > > go elsewhere.
> I *like* 1..5 (ada, ruby) instead of range(5). If I had macros, I would
> have done it myself for *my* code.
I think this example more is a symptom of a childish need to get
things your way than of a
> void
> usage(const char *proggie)
> {
> errx(EXIT_FAILURE, "Usage: %s ", proggie);
> }
>
> int
> main(int argc, char **argv)
> {
> struct in_addr addr;
>
> if (argc != 2 || !inet_aton(argv[1], &addr)) {
> usage(argv[0]);
> }
>
> (void)printf
> > /* $Id: dotquad.c 3529 2005-10-01 10:15:22Z dyoung $ */
> > /*
> > * Copyright (c) 2003, 2004 David Young. All rights reserved.
> > *
> > * This code was written by David Young.
>
> [snip code]
>
> Am I the only one who found it hilarious that this piece of code was made
> up of 24 lines of
Hello,
I have some very serious trouble getting cookes to work. After a lot
of work (urllib2 is severly underdocumented, arcane and overengineerd
btw) I'm finally able to accept cookes from a server. But I'm still
unable to return them to a server. Specifically the script im trying
to do logs on t
On 4 Jul 2006 08:38:47 -0700, Gaurav Agarwal
<[EMAIL PROTECTED]> wrote:
> Thanks Steven, Actually i wanted a do text processing for my office
> where I can view all files in the system and use the first three to
> give a summary of the document. Instead of having somebody actually
> entering the su
Mechanize (http://wwwsearch.sourceforge.net/mechanize/) is another
option, it can even fill out forms!
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/python-list
> > > I have already suggested to the BDFL that he can remedy this situation
> > > in Py3k: all he has to do, of course, is to add a LOT more keywords.
> >
> > Here is another remedy: he adds one of the frameworks to the standard
> > library :)
>
> That didn't help Tk maintain a monopoly on Python
On 8/30/06, Dan <[EMAIL PROTECTED]> wrote:
> Is this discouraged?:
>
> for line in open(filename):
>
In theory, it is. In practice, that is the way Python code is written
because it more natural and to the point. Not just for hacked together
scripts, lots of third party modules incl
On 8/31/06, Jorge Vargas <[EMAIL PROTECTED]> wrote:
> On 31 Aug 2006 08:24:29 -0700, Adam Jones <[EMAIL PROTECTED]> wrote:
>
> I believe that is the most important part of TG, taking the best of
> the best, and letting the framework adapt and morphe.
>
> for example noone plan to move to SA, 0.1 ca
> > > Someone ones said on the mailing list TG is the Ubuntu of web
> > > frameworks, and I think I'll add and you can strip down the kernel and
> > > it wont break :)
> >
> > But that is not really true. If you use Cheetah instead of Kid, you
> > lose out: No widgets,
>
> Untrue. Even though I do
I think this post by the author of SQLAlchemy perfectly summarizes the
differences between the two ORMs:
http://article.gmane.org/gmane.comp.python.sqlalchemy.user/1072/
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/python-list
> I have a reference to certain objects. What is the most pythonic way to
> test for valid reference:
>
> if obj:
>
> if None!=obs:
>
> if obj is not None:
The third way is the most precise way. It is often used in combination
with default arguments.
def __init__(self, amo
On 9/29/06, Johan Steyn <[EMAIL PROTECTED]> wrote:
> I agree that it is meaningless without a break statement, but I still find
> it useful when I want to determine whether I looped over the whole list or
> not. For example, if I want to see whether or not a list contains an odd
> number:
>
> for
> How do you transform this?
>
> height = 0
> for block in stack:
>if block.is_marked():
>print "Lowest marked block is at height", height
>break
>height += block.height
> else:
>raise SomeError("No marked block")
def get_height_of_first_marked_bock(stack):
height =
On 12/4/06, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> Russ schrieb:
> > I love Python, but every time I get an out-of-range error message, I
> > wonder why it didn't just tell me what the out-of-range index was and
> > what the allowable range was. Certainly that information must be
> > availa
On 12/4/06, OKB (not okblacke) <[EMAIL PROTECTED]> wrote:
> I think the same could be said of virtually all exceptions. What I
> think would be ideal is that whenever an exception is raised, the
> traceback tells you:
>
> 1) What the exception is
> 2) The names of the varia
On 12/4/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
BJörn Lindqvist wrote:
> Sorry I haven't thought this through 100%
obviously not.
And you're not helping. Anyway, here's the patch:
Ind
On 12/4/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> BJörn Lindqvist wrote:
>
> >> > Sorry I haven't thought this through 100%
> >>
> >> obviously not.
> >
> > And you're not helping.
>
> I've already explained why some
On 12/4/06, Terry Reedy <[EMAIL PROTECTED]> wrote:
> While Fredrik's reply is a bit short, as is sometimes his habit,
> here are some things that appear to me to not have been thought through
> enough:
> 1. some negative indexes are legal.
That could be fixed. Just substract len(L) from i if i < 0
> I think that people who know more languages and more about programming will
> be much more inclined to use Lisp than Python. Look at the contents of the
> newsgroups for example, c.l.l has a thread on memoization whereas c.l.p has
> a thread about wrestling oiled pigs.
Practicality beats purity.
> > Maybe so. But I've only ever appreciated its functional aspects. I
> > wouldn't choose Lisp or its derivatives for OO related tasks even if
> > I'm high.
>
> But CLOS is the best OO there is. The OMG said so. It can do anything
> any other OO can do. Why /specifically/ would you not use it? Thi
> > > Google doesnt like Python scripts. You will need to pretend to be a
> > > browser by setting the user-agent string in the HTTP header.
> > >
> > and possibly also run the risk of having your system blocked by Google if
> > they figure out you are lying to them?
>
> It is possible. I wrote a '
On 12/20/06, greg <[EMAIL PROTECTED]> wrote:
> Richard Jones wrote:
>
> > Actually, to clarify the DEFAULT configuration for Trac is to leave it open
> > to spam.
>
> That sounds like a really bad choice of default.
>
> A bit like the way Windows comes with all the
> "let anyone in the world send m
With regexps you can search for strings matching it. For example,
given the regexp: "foobar\d\d\d". "foobar123" would match. I want to
do the reverse, from a regexp generate all strings that could match
it.
The regexp: "[A-Z]{3}\d{3}" should generate the strings "AAA000",
"AAA001", "AAA002" ... "A
On 12/21/06, Tshepang Lekhonkhobe <[EMAIL PROTECTED]> wrote:
> Hi,
> I dislike installing the entire Mono stack simply to take notes and
> manage photos, and am totally biased towards Python. At least for
> search I got Tracker, instead of Beagle.
> Are there equvalents applications for Tomboy and
On 23 Dec 2006 14:38:19 -0800, Adam Atlas <[EMAIL PROTECTED]> wrote:
> Is it possible for an object, in its __init__ method, to find out if it
> is being assigned to a variable, and if so, what that variable's name
> is? I can think of some potentially ugly ways of finding out using
> sys._getframe
On 12/24/06, oyster <[EMAIL PROTECTED]> wrote:
> 1. first of all, what is the English jargon (Optimize? But I think
> this is not a very good keyword :( )for this problem? So I can use it
> to search on the internet
The first problem is a magic square. The general term for all your
problems are co
On 12/22/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> BJörn Lindqvist wrote:
> > With regexps you can search for strings matching it. For example,
> > given the regexp: "foobar\d\d\d". "foobar123" would match. I want to
> > do the reverse, from
With some help from the sre_parse module (and the Python Cookbook),
here is the completed module:
# -*- coding: utf-8 -*-
import itertools
from sre_constants import *
import sre_parse
import string
category_chars = {
CATEGORY_DIGIT : string.digits,
CATEGORY_SPACE : string.whitespace,
On 23 Dec 2006 04:23:09 -0800, Chris Johnson <[EMAIL PROTECTED]> wrote:
>
> BJörn Lindqvist wrote:
> > With regexps you can search for strings matching it. For example,
> > given the regexp: "foobar\d\d\d". "foobar123" would match. I want to
> >
> I know that this probably does not exist in the Python library already
> as a platform-independant abstraction (even though it probably could),
> but then I would at least like solutions that works on Windows and on
> Linux.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892
But it
On 12/29/06, Tony Lownds <[EMAIL PROTECTED]> wrote:
> Rationale
> =
>
> Because Python's 2.x series lacks a standard way of annotating a
> function's parameters and return values (e.g., with information about
> what type a function's return value should be), a variety of tools
> and librari
On 6 Jan 2007 16:07:05 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Coming from a C++ / C# background, the lack of emphasis on private data
> seems weird to me. I've often found wrapping private data useful to
> prevent bugs and enforce error checking..
>
> It appears to me (perhaps wrongl
On 27 May 2007 10:49:06 -0700, 7stud <[EMAIL PROTECTED]> wrote:
> On May 27, 11:28 am, Steve Howell <[EMAIL PROTECTED]> wrote:
> > The groupby method has its uses, but it's behavior is
> > going to be very surprising to anybody that has used
> > the "group by" syntax of SQL, because Python's groupb
On 6/10/07, Stef Mientki <[EMAIL PROTECTED]> wrote:
> I can realize it with a simple switch within each function,
> but that makes the code much less readable:
>
> def Some_Function():
>if simulation_level == 1:
> ... do things in a way
>elif simulation_level == 2:
> ... do things
On 6/15/07, Ping <[EMAIL PROTECTED]> wrote:
> >
> > sum(1 for i in a_list if a_callable(i))
> >
> > --
> > Carsten Haesehttp://informixdb.sourceforge.net
>
> This works nicely but not very intuitive or readable to me.
>
> First of all, the generator expression makes sense only to
> trained eyes. S
> I patched Objects/listobject.c to support
> L.count(value, cmp=None, key=None).
> I tested it with the same script above by replacing slist
> with built-in list. It worked correctly with this small
> test. The patch is below (126 lines, I hope that's not
Great! If you want this change includ
> In python I must kick off a sort on the line before I start the
> iteration. (This does make sense because at the end of the day the sort
> has complete BEFORE the for loop can proceed - that is... until the day
> when python lists have a secondary index ;-).
>
> group_list=group_dict.keys()
> g
On 6/20/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> > It's not true that the sort must complete (or that the whole file must
> > be read for that matter), Python has cool generators which makes the
> > above possible.
>
> That's not possible, the input must be read completely before sorted()
On 6/22/07, Eduardo EdCrypt O. Padoan <[EMAIL PROTECTED]> wrote:
> Remember that pure CPython has no different "compile time" and
> runtiime. But Psyco and ShedSkin could use the annotations the way
> they want.
.
> def compile(source: "something compilable",
>filename: "where the c
On 7/9/07, Emin.shopper Martinian.shopper <[EMAIL PROTECTED]> wrote:
> Dear Experts,
>
> What is the preferred doc extraction tool for python? It seems that there
> are many very nice options (e.g., pydoc, epydoc, HappyDoc, and lots of
> others), but what is the "standard" tool or at least what is
On 7/13/07, John Nagle <[EMAIL PROTECTED]> wrote:
> You can sometimes get better performance in C++ than in C, because C++
> has "inline". Inline expansion happens before optimization, so you
> can have abstractions that cost nothing.
C99 has that too.
> Python is a relatively easy lan
On 4/29/07, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> To do that, I needed to generate an index table first. In the book
> "Numerical Recipes in Pascal" by William Press et al there is a procedure
> to generate an index table (46 lines of code) and one for a rank table
> (five lines).
51 lines
On 30 Apr 2007 11:02:19 -0700, Bas <[EMAIL PROTECTED]> wrote:
> stupid question, but would it be possible to somehow merge xrange
> (which is supposed to replace range in py3k) and slice? Both have very
> similar start, stop and step arguments and both are lightweight
> objects to indicate a range.
How is the code different from shlex.split?
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/python-list
On 5/29/07, Eric S. Johansson <[EMAIL PROTECTED]> wrote:
> A huge reason why this is important because the vast majority of software
> developers who are injured fall off the economic ladder. They leave the
> profession and had very few options for work that doesn't involve significant
> handy is.
On 30 May 2007 08:25:48 -0700, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I am creating a distro of Python to be licensed as GPL am
> wondering, what would anyone suggest as to 3rd party modules being put
> into it (non-commercial of course!)? I know I'd put MySQLdb into it at
> the very le
On 8/11/07, Helmut Jarausch <[EMAIL PROTECTED]> wrote:
> How can I find out the predefined decorators?
There are two in the standard library, @classmethod for declaring
class methods and @staticmethod for declaring static methods. They are
listed at the built ins page
http://docs.python.org/dev/li
On 8/13/07, Bjoern Schliessmann
<[EMAIL PROTECTED]> wrote:
> BJörn Lindqvist wrote:
>
> > unpedagogically not separated from ordinary functions.
>
> Decorators _are_ ordinary functions. Remember the "syntactic sugar"
> in this thread?
Remember also "t
On 8/16/07, Gerardo Herzig <[EMAIL PROTECTED]> wrote:
> @is_logued_in
> def change_pass():
> bla
> bla
>
> And so on for all the other functions who needs that the user is still
> loged in.
>
> where obviosly the is_logued_in() function will determine if the dude is
> still loged in, and TH
On 8/17/07, Gerardo Herzig <[EMAIL PROTECTED]> wrote:
> BJörn Lindqvist wrote:
> >def is_logued_in():
> >if not user.is_logged_in():
> >raise NotLoggedInError
> >
> >It costs you one more line, but reduces complexity. And if you are
> >worr
On 8/22/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> On 22 ago, 10:00, "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote:
> > As I said, you can accomplish the exact same thing by calling a
> > function from within the function that requires the user to be l
On 8/24/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> En Thu, 23 Aug 2007 09:20:21 -0300, BJörn Lindqvist <[EMAIL PROTECTED]>
> escribi�:
>
> > def check_user_logged_in(func):
> > def f(*args, **kwargs):
> > if global_state.the_user.is_logge
On 8/30/07, Carsten Haese <[EMAIL PROTECTED]> wrote:
> Is the Pythonic way
>
> try:
> i = somelist.index(thing)
> # Do something with i
> except IndexError:
> # Do something if thing not found
That is not the Pythonic way. "# Do something with i" might also raise
an IndexError and they
I'm pleased to finally announce GtkImageView 1.5.0. I'm even more
pleased to ALSO announce PyGtkImageView 1.0.0:
Description
---
GtkImageView is a simple image viewer widget for GTK+. Similar to the
image viewer panes in gThumb or Eye of Gnome. It makes writing image
viewing and editing ap
On 9/12/07, Dave Hansen <[EMAIL PROTECTED]> wrote:
> The name "self" is just a convention. You can give it any name you
> wish. Using "s" is common.
Not it's not common. And the name "self" is a convention codified in
PEP8 which you shouldn't violate.
And I agree with the OP that the convention
On 5 Mar 2007 16:25:03 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I would like to know the interface concept in Python.How the
> Interface is defined and implemented in Python?.
>
> How to access the interface fromn Client?
You have a class with methods and data. You write many
On 9 Mar 2007 02:31:14 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Thanks for the thoughts.
>
> > This could be implemented without new syntax: just make your editor
> > recognize some special comments, and apply the highlighting to the
> > following block. By example,
> >
> >
> I come from a shell/perl background and have just to learn python. To
> start with, I'm trying to obtain system information from a Linux
> server using the /proc FS. For example, in order to obtain the amount
> of physical memory on the server, I would do the following in shell:
>
> grep ^MemTo
On 19 Mar 2007 07:41:59 -0700, Ben <[EMAIL PROTECTED]> wrote:
> I have recently learned how list comprehension works and am finding it
> extremely cool. I am worried, however, that I may be stuffing it into
> places that it does not belong.
>
> What's the most "pythony" way to do this:
>
> even =
On 4 Apr 2007 06:15:18 -0700, lancered <[EMAIL PROTECTED]> wrote:
> During the calculation, I noticed an apparent error of
> inverion of a 19x19 matrix. Denote this matrix as KK, U=KK^ -1, I
> found the product of U and KK is not equivalent to unit matrix! This
> apparently violate the defi
> Here is some sample tuna:
> ['[7:55pm] My teachings goes back to the last iceage.\r\n',
> '[7:55pm] <%Zack> ahh now it does\r\n', '[7:55pm] <%Zack> ok\r\n',
> '[7:55pm] Or it is down just for you.\r\n', '[7:55pm] <@FC3>
> which one? that -12000 ice age or the one before\r\n', '[7:55pm]
> the e
On 4/10/07, Carsten Haese <[EMAIL PROTECTED]> wrote:
> i = p.index(current_player)
> opponents = p[:i-1] + p[i+1:]
>
> An alternative is this:
>
> opponents = tuple(x for x in p if x is not current_player)
>
> You may disagree, but in my opinion, the alternative is better because
> it is a more nat
On 4/10/07, Steve Holden <[EMAIL PROTECTED]> wrote:
> Paul Boddie wrote:
> > On 10 Apr, 11:48, Antoon Pardon <[EMAIL PROTECTED]> wrote:
> >> On 2007-04-10, Duncan Booth <[EMAIL PROTECTED]> wrote:
> >>
> >>> There is a cost to every new language feature: it has to be implemented,
> >>> documented, m
On 4/10/07, Carsten Haese <[EMAIL PROTECTED]> wrote:
> > > opponents = tuple(x for x in p if x is not current_player)
> > >
> > Your alternative is wrong because it wont raise ValueError if
> > current_player is not present in the tuple. Please revise your
> > "solution."
>
> You have a point. Here
> > while not game_has_ended:
> > for current_player in p:
> > player_does_something(current_player)
> >
>
> I'm curious why someone would even consider using a tuple in this case
> regardless. I think that much of the desire for tuple.index is because
> people use a tuple where they could ha
Your idea isn't new and has already been discussed lots of time
before. It was once planned to be implemented in py3k, but no longer
is.
One of the problems is that with a "using" statement, you always have
to decide whether your code repeats some prefix enough times to use a
"using" statement. Sh
On 14 Apr 2007 07:24:32 -0700, jamadagni <[EMAIL PROTECTED]> wrote:
> > You already can emulate the using statement like this:
>
> You can emulate only assignments like this. How would you emulate
> function calls, like the ones in my example?
You can't, of course. But using the with statement:
u
On 4/14/07, BJörn Lindqvist <[EMAIL PROTECTED]> wrote:
> On 14 Apr 2007 07:24:32 -0700, jamadagni <[EMAIL PROTECTED]> wrote:
> > > You already can emulate the using statement like this:
> >
> > You can emulate only assignments like this. How would you emulate
> This comes up so often that I wonder whether Python should issue a warning
> when it sees [] or {} as a default argument.
>
>
> What do people think? A misuse or good use of warnings?
I think Python should reevaluate the default values.
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/
On 4/17/07, Mirco Wahab <[EMAIL PROTECTED]> wrote:
> The reason why I answered your posting at all (besides
> seeing your x-post going into 5 ng's) is your mentioning
> of 'God'. According to christian tradition (which is
> somehow on topic in a Perl group) it is exactly the
> case of Jesus (imho),
On 9/16/07, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> Maybe I'm being unfair, but it seems to me that the attitude is similar:
> 'there's no point optimizing the common case of printing (say) ints
> stored in a list, Just In Case the programmer wants the incredibly rare
> case of setting sys.std
On 9/16/07, GeorgeRXZ <[EMAIL PROTECTED]> wrote:
> Well you are speed
That's an awesome party trick! But before I mail this to everyone at
the office, must have a better sentence. Well you are speed is to
gibberish. Something microsoft+evil... hm..
--
mvh Björn
--
http://mail.python.org/mailman
1 - 100 of 170 matches
Mail list logo