Bruce Whealton br...@futurewavedesigns.com wrote:
For lists, when would
you use what appears to be nested lists, like:
[[], [], []]
a list of lists?
Well, you'd use it when you'd want a list of lists ;)
There's nothing magical about a list of lists, it's just a list with
objects inside like
Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid
wrote:
alex23 a écrit :
Python only actually executes a module the first time it's imported,
Beware of multithreading and modules imported under different names...
There can be issues with both in some web frameowrks.
Good
AK andrei@gmail.com wrote:
When I was reading The book of the new sun, though, I could stop and
read a single sentence a few times over and reflect on it for a minute.
Totally understandable, Wolfe is a far, far greater writer than
Rowling :)
--
Niklasro nikla...@gmail.com wrote:
I got 2 files main.py and i18n both with
webapp request handlers which I would like access the variable.
I'd probably use a module for this. Create a third file, called
something like shared.py, containing the line that bruno gave above:
url =
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:
Because machine-generated
code has no place in a source file to be maintained by a human.
Endlessly repeating your bigotry doesn't make it any more true.
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:
Why not just call Scriptomatic directly from within the Python script, then?
Because Scriptomatic _generates scripts to access WMI_, that's what it
_does_. Are you _seriously_ advocating writing Python code to fire up
a Windows
KING LABS kinglabs...@gmail.com wrote:
The following information is exactly what I am trying to collect for
the inventory. I can find vb scripts with googling. I want to do the
same with Python Win32. Use Server/Client architecture .
Client(agent) updates the information to server.
I highly
On Sep 2, 3:49 am, sarvi sarvil...@gmail.com wrote:
Yet I see this forum relatively quite on PyPy or Rpython ? Any
reasons???
For me, it's two major ones:
1. PyPy only recently hit a stability/performance point that makes it
worth checking out,
2. Using non-pure-python modules wasn't
bussiere bussiere bussi...@gmail.com wrote:
it's just as it seems :
i want to know how does ti works to get back an object from a string in
python :
pickle.loads(b'\x80\x03]q\x00(K\x00K\x01e.') #doesn't work
Repeating the question without providing any further information
doesn't really
kj no.em...@please.post wrote:
Example: I went to the docs page for ImageDraw. There I find that
the constructor for an ImageDraw.Draw object takes an argument,
but *what* this argument should be (integer? object? string?) is
left entirely undefined. From the examples given I *guessed* that
Russ P. russ.paie...@gmail.com wrote:
However, I've switched from Python to
Scala, so I really don't care.
Really? Your endless whining in this thread would seem to indicate
otherwise.
--
http://mail.python.org/mailman/listinfo/python-list
John Nagle na...@animats.com wrote:
I was talking to the Facebook guys doing the compiler for PHP, and they
said that it was a huge win for them that PHP doesn't allow dynamically
replacing a function.
I'm not sure if I call all that effort for a 50% speed increase a win.
PyPy is seeing speed
On Aug 13, 4:22 pm, JonathanB doulo...@gmail.com wrote:
writer = csv.writer(open(output, 'w'), dialect='excel')
I think - not able to test atm - that if you open the file in 'wb'
mode instead it should be fine.
--
http://mail.python.org/mailman/listinfo/python-list
Steven W. Orr ste...@syslang.net wrote:
I'm ok in python but I haven't done too much with web pages. I have a web page
that is hand written in html that has about 1000 entries in a table and I want
to convert the table [into html]
Is the data coming from somewhere like a file or db? If so, I'd
Alex Barna alex.lavoro.pro...@gmail.com wrote:
So what happens to this field (Windows GUI automation) ?
Either someone cares enough to do something about it, or everyone just
defaults to using AutoIT-like tools.
Which Python implementation are you planning on contributing to?
--
W. eWatson wolftra...@invalid.com wrote:
I now have the answer I need, and I do not care one more wit
about a one character change.
I'm done here.
That's a fantastic response to give to people who were actually
willing to sacrifice their time to help you with your problems. I'm
always stunned
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:
You’ve got to be kidding. Look at the number of Windows-specific questions
this groups is already full of.
Are you really unable to tell the difference between questions about
Windows-related modules and snarky, off-topic sniping at
On Aug 4, 12:14 pm, elsa kerensael...@hotmail.com wrote:
So, an individual entry might have this form (in printed form):
Title date position data
with each field separated by tabs, and a newline at the end of data.
As James posted, the csv module is ideal for this sort of thing.
chad cdal...@gmail.com wrote:
I could care less about the extra blank line. I guess I was just more
concerned about the namespace question.
Which is why Steven spent far more time answering that question than
commenting on newline handling.
Now say 'thank you'.
--
Stephen Hansen me+list/pyt...@ixokai.io wrote:
You're doing string formatting
to construct your SQL, which is where the trouble comes from.
You're wasting your breath, this topic has been discussed ad nauseum
with Victor for well over a year now. He appears to be teaching
himself relational db
Hans Mulder han...@xs4all.nl wrote:
There's also: hasattr(object, '__call__'). It works in both 2.x and 3.x.
Good work, Hans. I do find that to be a more pythonic approach,
personally, being more concerned with an object's ability than its
abstract type.
--
Stephen Hansen me+list/pyt...@ixokai.io wrote:
P.S. The removal of callable is something I don't understand in Python
3: while generally speaking I do really believe and use duck typing, I
too have on occassion wanted to dispatch based on 'is callable? do x'.
Sometimes its not convenient to do
Stephen Hansen me+list/pyt...@ixokai.io wrote:
What the hell? When did that show up? o.O (Did I not pay attention
enough during the ABC conversations? It seemed so boring).
The PEPs post-release docs detailing Py3 changes were worth reading,
it's noted in the sections on changes to built-ins:
John Bokma j...@castleamber.com wrote:
Now let's hope that your asshat behaviour doesn't stop companies like
this to continue to print those books. I have considered to buy the
complete set a few times. And I hope you're not calling me naive...
Given the current propensity for people to scrape
Paul Rubin no.em...@nospam.invalid wrote:
mod_python is pretty dead.
It's now totally dead[1]. (Not pining for the fjords, either.)
1: http://blog.dscpl.com.au/2010/06/modpython-project-is-now-officially.html
--
http://mail.python.org/mailman/listinfo/python-list
DivX sem.r...@gmail.com wrote:
Another thing is that when you have assembler now you can write some
small C compiler so that you don’t have to write assembly language.
That has to be the most paradoxical argument I've ever heard: when
you use assembler you have the ability to not use assembler
Stephen Hansen me+list/pyt...@ixokai.io wrote:
P.S. This is something which confuses me greatly. Considering how
*great* the spam filters are on Gmail-- I literally get virtually
nothing in my inbox-- how in world are Google Groups so full of junk?
The cynic in me thinks it has a lot to do
geremy condra debat...@gmail.com wrote:
I have a hard time believing that any major company in the world
wants to be associated with this kind of crap. I'm ashamed even
to have it in my inbox.
I can just as easily imagine the furor that would spring up over
Google's evil censorship if they
Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
Perhaps you need to spend some more time helping beginners then, and less
time hanging around Lisp gurus *wink*
I've never used map/reduce outside of Python, this is where I first
encountered it. And I _have_ worked in organisations
Ben Finney ben+pyt...@benfinney.id.au wrote:
No, it wasn't clear at all. That's why I asked, rather than making
assumptions.
Thanks for clarifying.
No problem. Thank you for another pleasant exchange.
--
http://mail.python.org/mailman/listinfo/python-list
Ben Finney ben+pyt...@benfinney.id.au wrote:
It should go without saying, but unfortunately the tenor of this forum
has been worsened (temporarily, I hope) by certain interminable threads
of late. So, to be clear:
Thanks for clarifying that you were not expressing the attitude I
inferred.
shanti bhushan ershantibhus...@gmail.com wrote:
Please guide me the design or direct me the best approach to do all
this.
The best approach?
1. Study
2. Learn
3. Apply
There you go, the advice that keeps on giving.
--
http://mail.python.org/mailman/listinfo/python-list
Ben Finney ben+pyt...@benfinney.id.au wrote:
alex23 wuwe...@gmail.com writes:
(Although I have to say, I have little sympathy for Steven's
hypothetical new programmer who isn't familiar with map and reduce.
With ‘reduce’ gone in Python 3 [0], I can only interpret that as “I have
little
Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
No, I think your code is very simple. You can save a few lines by writing
it like this:
s = input('enter two numbers: ')
t = s.split()
print(int(t[0]) + int(t[1])) # no need for temporary variables a and b
Not that we're playing a
exar...@twistedmatrix.com wrote:
Fore!
print(sum(map(int, input('enter two numbers: ').split(
Well, I _was_ trying to stick to Steven's more simple map-less form :)
(Although I have to say, I have little sympathy for Steven's
hypothetical new programmer who isn't familiar with map and
a...@pythoncraft.com (Aahz) wrote:
If a new-ish term is being introduced,
expecting each person to search for the meaning is rude.
The question then becomes how does one determine whether a term one is
using needs defining? Does OO? How about FP? Or TDD? Is there a metric
for how many years or
Deadly Dirk d...@plfn.invalid wrote:
The book covers Python3 but my understanding was that it should also
cover Python 2.5 and 2.6.
The SECOND EDITION Covers Python 3 banner across the top of the
cover would seem to indicate otherwise. The first line of the About
section confirms it:
This book
James Mills prolo...@shortcircuit.net.au wrote:
The behavior you've demonstrated is exactly what the documentation
says the .capitalize() method does.
Look on the plus side, at least it's not yet another question on SQL
parameters Python string substitutions.
I'm amazed at the endless
On Jun 9, 3:29 am, Terry Reedy tjre...@udel.edu wrote:
On 6/8/2010 2:26 AM, Gabriel Falcão wrote:
There is not much to say,
except to explain 'BDD'.
If only there was some kind of way to quickly look up the meaning of
definitions, preferably one known to people of the programming
Deadly Dirk d...@pfln.invalid wrote:
From what I see, most of the people are still using Python 2.x. My reason
for learning Python is the fact that my CTO decided that the new company
standard for scripting languages will be Python. I've been using Perl for
15 years and it was completely
Tycho Andersen ty...@tycho.ws wrote:
I think his point may have been that there could be more than one
meaning. My first guess would have been binary decision diagram.
Ah, good point. My apologies for the dig, Terry :)
--
http://mail.python.org/mailman/listinfo/python-list
rantingrick rantingr...@gmail.com wrote:
The problem is getting a large enough group of Python users to agree
on anything about GUIs.
No, the problem is it's a lot easier to find fault than it is to
provide a solution. And that maybe, just maybe, other people don't
want to have to do your dirty
Michele Simionato michele.simion...@gmail.com wrote:
It seems I have to take that claim back. A few hours after the
announce I was pointed out tohttp://pypi.python.org/pypi/CLIArgs
which, I must concede, is even easier to use than plac. It seems
everybody has written its own command line
On May 26, 7:21 pm, Lex Lebedeff l...@from.hell wrote:
Has anyone tried to build an implementation of subject in Python?
Any help is appreciated!
http://www.dia.fi.upm.es/~jamartin/download.htm
Seriously, though, any reason why you couldn't just type kohonen
neural network python into Google?
On May 26, 10:52 pm, Steven W. Orr ste...@syslang.net wrote:
I found something on sourceforge called mat2py, but there's nothing there. (It
seems to be just a placeholder.) I figure that if anyone would know of
something
useful, this would be the place to try.
Lex Lebedeff l...@from.hell wrote:
Thanx, I've already googled this stuff. Rather unreadable and freaky code.
Then please remember to mention what you've already seen tried when
asking in the future, it saves us all from wasting each others time.
--
Martin P. Hellwig martin.hell...@dcuktec.org wrote:
What have you tried so far?
Alternatively, how much is it worth to you?
--
http://mail.python.org/mailman/listinfo/python-list
Gregory Ewing greg.ew...@canterbury.ac.nz wrote:
I came across a game on Big Fish Games recently (it was
The Moonstone IIRC) that appeared to have been built using
Python and py2app.
Python tends to be used more for scripting internal game logic than
for every aspect of a game (which is, IMO,
Patrick Maupin pmau...@gmail.com wrote:
One thing you can do is in battleship, you can accept additional
keyword arguments:
def __init__(self, name, ..., **kw):
Then you could invoke the superclass's init:
Craft.__init__(self, name, **kw)
_All_ of which is covered in the tutorial.
Patrick Maupin pmau...@gmail.com wrote:
Although it makes
perfect sense, I never really thought much about the possibility that
the school year would be upside down down under...
Yes, having the school year run within the actual year instead of
across two is such a topsy-turvy concept, it's
Ed Keith e_...@yahoo.com wrote:
For more information on Literate Programming in general see the following
links.
None of which address the question of what you found problematic about
generating Python code. Was it issues with indentation?
--
TomF tomf.sess...@gmail.com wrote:
I'm interested in improving my python design by studying a large,
well-designed codebase. Someone (not a python programmer) suggested
Django. I realize that Django is popular, but can someone comment on
whether its code is well-designed and worth studying?
Ed Keith e_...@yahoo.com wrote:
Tabs are always a problem when writing Python. I get
around this problem by setting my text editor to expand
all tabs with spaces when editing Python, but I have had
problems when coworkers have not done this.
It's best not to trust others to do the right
On May 5, 6:36 am, Terry Reedy tjre...@udel.edu wrote:
The relatively new with statement and associated context managers are
designed, among other things, for this situation, where one needs to
alter and restore a global context. So here is my updated (3.1)
proof-of-concept version.
This is
Ed Keith e_...@yahoo.com wrote:
Knuth wanted the generated source to be unreadable, so people would not be
tempted to edit the generated code.
This is my biggest issue with Knuth's view of literate programming. If
the generated source isn't readable, am I just supposed to trust it?
How can I
Gilles Ganault nos...@nospam.com wrote:
I'm no Python expert, so would appreciate any information on how to
combine a web server and SQLite into a single Python application.
Hey Gilles,
I'm a fan of the http framework, CherryPy[1]. Very quick and easy to
get something up and running. The site
On Apr 30, 8:43 am, John Doe j...@usenetlove.invalid wrote:
I would very much like to stop code from expanding automatically.
Like when several consecutive lines of code have a plus sigh in the
left margin, meaning they are collapsed, when I go to copy or cut one
of those collapsed lines, the
Alex Hall mehg...@gmail.com wrote:
I am stumped. The compiled version of my project works on my pc, but
when I put it on a thumb drive and try it on a laptop without python
installed I get this:
ImportError: DLL load failed: The specified procedure could not be found.
Are you using py2exe? If
GZ zyzhu2...@gmail.com wrote:
I do not think it will help me. I am not trying to define a function
fn() in the class, but rather I want to make it a function reference
so that I can initialize it any way I like later.
It always helps to try an idea out before dismissing it out of hand.
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote:
if you don't trust the language to behave
correctly in this case:
pairs = zip(d.values(), d.items())
what makes you think you can trust d.iteritems(), list comprehensions, or
even tuple packing and unpacking?
Because .iteritems()
On Apr 20, 1:03 pm, Menghan Zheng menghan...@gmail.com wrote:
Is it assured the following statement is always True?
If it is always True, in which version, python2.x or python3.x?
I believe its an implementation detail and should not be relied on. If
you need consistent ordering, use an
Cameron Simpson c...@zip.com.au wrote:
If items(), keys(), values(), iteritems(), iterkeys(), and
itervalues() are called with no intervening modifications to the
dictionary, the lists will directly correspond. This allows the
creation of (value, key) pairs using zip(): pairs =
Xavier Ho wrote:
I ran into a strange problem today: why does Python not allow default
paranmeters for packed arguments in a function def?
def t(a, *b = (3, 4)):
File input, line 1
def t(a, *b = (3, 4)):
^
SyntaxError: invalid syntax
What was the rationale behind
? Every time you start a new thread, you make it harder
for those helping you to keep track of the situation, as well as
annoying those who chose to ignore the original post. Keeping all of
your posts in one large related thread is a better fit for the way
newsreaders email clients work.
Cheers,
alex23
On Apr 16, 5:37 am, gert gert.cuyk...@gmail.com wrote:
So I can make a recursive http download script
My goal is a one click instruction to install and launch my
projecthttp://code.google.com/p/appwsgi/
Here's Guido's take on wget:
import sys, urllib
def reporthook(*a): print a
Mensanator mensana...@aol.com wrote:
You think the right thing to do is just quietly work
around the problem and sit back and laugh knowing sooner
or later someone else will get burned by it?
Haven't we covered argument from fallacy enough in this group by now?
Reporting the bug was exactly
Mensanator mensana...@aol.com wrote:
Planning to buy a Toyota?
Did we just start playing Questions?
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 9, 8:52 am, Ben Racine i3enha...@gmail.com wrote:
I have a list...
['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
'dir_330_error.dat']
I want to sort it based upon the numerical value only.
Does someone have an elegant solution to this?
This approach doesn't rely on
MRAB pyt...@mrabarnett.plus.com wrote:
The string module still exists in Python 3.x, but the string functions
which have been superseded by string methods have been removed.
Awesome, thanks for the heads up.
--
http://mail.python.org/mailman/listinfo/python-list
Mensanator mensana...@aol.com wrote:
3.x won't be adopted by WINDOWS developers WHO USE IDLE until it's fixed.
I think you left your hyperbole level too high so I turned it down for
you. I don't know of _anyone_ who uses IDLE to run production code,
nor do I follow how one errant IDE shows that
vlad_fig vlad_...@yahoo.com wrote:
file.writeStuff(2,a1,a2)
file.writeStuff(3,a1,a2,a3)
file.writeStuff(n,a1,a2,...an)
---
so i want a method i can call based on the number of parameters
n , and that allows me to add these extra parameters based on n
It's not necessary to have to
Alan Harris-Reid aharrisr...@googlemail.com wrote:
Is there any way of writing the code so that the super() call is generic
and automatically recognises the name of the current method (ie.
something like super().thismethod()) or do I always have to repeat the
method name after super()?
To the
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote:
# Untested
last_visited = open(last_visited.txt, 'r').read()
for root, dirs, files in os.walk(last_visited or basedir):
open(last_visited.txt, 'w').write(root)
run program
Wouldn't this only walk the directory the
Victor Subervi victorsube...@gmail.com wrote:
There's a program (vpopmail) that has commands which, when called, request
input (email address, password, etc.) from the command line. I would
like to build a TTW interface for my clients to use that interacts with
these commands.
The
Daniel Klein bri...@gmail.com wrote:
Basically I'm wondering if there are any plans to implemented named
loops in Python, so I can tell a break command to break out of a
specific loop in the case of nested loops.
You should be able to do this with the goto module: http://entrian.com/goto/
But
Alex Hall mehg...@gmail.com wrote:
Why would the sequence
matter, or does it not and I am doing something else wrong? Here is a
sample of my dictionary:
Showing us the code that handles the dictionary lookup + function
calling would probably help us a lot more here.
--
W. eWatson wolftra...@invalid.com wrote:
My claim is that if one creates a program in a folder that reads a file
in the folder it and then copies it to another folder, it will read the
data file in the first folder, and not a changed file in the new folder.
I'd appreciate it if some w7 users
Andreas Waldenburger use...@geekmail.invalid wrote:
But as I said: a) I am (we are) not in a position to impose this (We
don't work with the code, we just run the software).
I personally believe that the end users have _every_ right to impose
quality requirements on code used within their
Michael Rudolf spamfres...@ch3ka.de wrote:
In Java, Method Overloading is my best friend
Guido wrote a nice article[1] on multimethods using decorators,
which Ian Bicking followed up on[2] with a non-global approach.
1: http://www.artima.com/weblogs/viewpost.jsp?thread=101605
2:
Mensanator mensana...@aol.com wrote:
You're not getting the point.
If every link has to be accompanied by a summary of all of the
information at the end of it, what point is there to linking?
(Programmers are the _only_ people I know of who complain about the
arduousness of tasks like typing
nobrowser nobrow...@gmail.com wrote:
Yet there are many, many classes in the
library whose use would be more elegant and readable if the with
statement could be employed. Start with the connection objects in
httplib and you can probably come up with 10 others easily. Maybe it
is the case
W. eWatson wolftra...@invalid.com wrote:
So maybe the only way to execute the compiled code is to [g]o to dist?
Or the compiled code needs to be in a folder that's higher in your
path settings than the python file.
But yes, moving into the dist directory, or running 'dist/snowball'
from the
On Feb 20, 3:26 pm, alex23 wuwe...@gmail.com wrote:
or running 'dist/snowball'
That should, of course, be: 'dist\snowball' :)
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy tjre...@udel.edu wrote:
Now wrap *every* function you are interested in. Builtin functions are
no problem; methods of builtin classes cannont be wrapped without
subclassing.
It's a shame it's not possible to do:
type.__call__ = func_wrap(type.__call__)
Or even:
MRAB pyt...@mrabarnett.plus.com wrote:
Python 3.0 had a relatively short run before it was superseded by Python
3.1 due to certain issues, so, IMHO, I wouldn't worry about it unless
someone especially requests/requires it.
And even then, I'd just tell them I accept patches :)
--
Alf P. Steinbach al...@start.no wrote:
it's great that you provide the kind
of help that you did, pointing out a probably very good module that it seems
gives the required functionality, and giving an URL.
Yes, because that's _actually helping people_ and not just
contributing the usual
On Feb 16, 6:16 pm, Joan Miller pelok...@gmail.com wrote:
Is possible to get a third class with the class variables of another
two classes?
class A:
foo = 1
class B:
bar = 2
Through multiple inheritance?
class C(A, B):
... pass
...
C.foo
1
News123 news...@free.fr wrote:
What is the best way with python to get a list of all windows services.
As a start I would be glad to receive only the service names.
However it would be nicer if I could get all the properties of a service
as well.
I highly recommend Tim Golden's fantastic
On Feb 16, 1:28 pm, Alf P. Steinbach al...@start.no wrote:
It's probably Very Good, but one Microsoft-thing one should be aware of: using
WMI functionality generally starts up a background WMI service...
Probably? You haven't even used the module but you felt the need to
contribute anyway? And
catonano caton...@gmail.com wrote:
You know what I'm doing now ? I'm drawing the map of
twisted.web.client on a paper with a pencil :-(
You're a programmer. Why are you complaining about the problem instead
of endeavouring to solve it?
--
http://mail.python.org/mailman/listinfo/python-list
Alf P. Steinbach al...@start.no wrote:
Telling someone to learn to read is a Steve Holden'sk way to imply that the
person is an ignoramus who hasn't bothered to learn to read.
Ad hominem.
So, you
are misrepresenting -- again -- and in a quite revealing way, sorry.
Ad hominem.
Yes, in
Alf P. Steinbach al...@start.no wrote:
Hm. While most everything I've seen at effbot.org has been clear and to the
point, that particular article reads like a ton of obfuscation.
Must. Resist. Ad hominem.
Python passes pointers by value, just as e.g. Java does.
There, it needed just 10
Adam Tauno Williams awill...@opengroupware.us wrote:
This is obvious even in the Python documentation itself where one
frequently asks oneself Uhh... so what is parameter X supposed to be...
a string... a list... ?
Could you provide an actual example to support this?
The only places I tend to
On Feb 4, 8:47 am, Phlip phlip2...@gmail.com wrote:
Yes, calling os.path.walk() and os.path.join() all the time on raw
strings is fun, but I seem to recall from my Ruby days a class called
Pathname, which presented an object that behaved like a string at
need, and like a filesystem path at
Timothy N. Tsvetkov timothy.tsvet...@gmail.com wrote:
Jonathan Gardner jgard...@jonathangardner.net
Python is much, much cleaner. I don't know how anyone can honestly say
Ruby is cleaner than Python.
I developed on both (Python was first) and I think that ruby I
very clean and maybe
On Feb 3, 9:02 am, John Nagle na...@animats.com wrote:
I know there's a performance penalty for running Python on a
multicore CPU, but how bad is it? I've read the key paper
(www.dabeaz.com/python/GIL.pdf), of course.
It's a shame that Python 3.x is dead to you, otherwise you'd be able
to
keakon kea...@gmail.com wrote:
def h2(x=[]):
y = x
y.append(1)
return y + []
h2() is about 42 times slower than h2([]), but h() is a litter faster
than h([]).
Are you aware that 'y = x' _doesn't_ make a copy of [], that it
actually points to the same list as x?
My guess is that the
alex23 wuwe...@gmail.com wrote:
keakon kea...@gmail.com wrote:
def h2(x=[]):
y = x
y.append(1)
return y + []
Are you aware that 'y = x' _doesn't_ make a copy of [], that it
actually points to the same list as x?
Sorry, I meant to suggest trying the following instead:
def h2(x
keakon kea...@gmail.com wrote:
The default value is mutable, and can be reused by all each call.
So each call it will append 1 to the default value, that's very
different than C++.
Being different from C++ is one of the many reasons some of us choose
Python ;)
This tends to bite most
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote:
You're using that term wrong. It looks to me that you don't actually know
what a straw man argument is. A straw man argument is when somebody
responds to a deliberately weakened or invalid argument as if it had been
made by their
701 - 800 of 1391 matches
Mail list logo