ver go anywhere?
Apparently Facebook are now working with it:
http://www.fastcolabs.com/3019948/more-about-d-language-and-why-facebook-is-experimenting-with-it
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
before your message.
Methinks too many people have been hitting the Christmas eggnog a little
harder than is wise...
:-)
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
about the
situation in Russia, where the government is engaging in 1930s-style
scape-goating and oppression of homosexuals. They haven't quite reached
the level of Kristallnacht or concentration camps, but the rhetoric and
laws coming out of the Kremlin are just like that coming out of the
Reichstag in the thirties.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ame, className, interactive,
wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":0"
So you need to X-forward from the remote machine to the machine you are
physically on, or perhaps it's the other way (X is really weird). I have no
idea how to do that, but would love to know.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 30 Dec 2013 10:30:11 +1100, Chris Angelico wrote:
> On Mon, Dec 30, 2013 at 10:22 AM, Steven D'Aprano
> wrote:
>> So you need to X-forward from the remote machine to the machine you are
>> physically on, or perhaps it's the other way (X is really weird). I
&g
ozen lines is
more than enough to demonstrate the problem to any reasonable person, they
can extrapolate from that. If half a dozen quoted lines isn't enough to
persuade them to read the link, a million lines won't be.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
are planning to move to Python 3, the "Python Wall Of Shame" stopped
being a wall of shame a long time ago (I think it was a year ago? or at
least six months ago). Alex's article is, basically, FUD.
More comments will have to follow later.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
> On Mon, 30 Dec 2013 19:41:44 +, Mark Lawrence wrote:
>
>> http://alexgaynor.net/2013/dec/30/about-python-3/ may be of interest to
>> some of you.
[...]
> I'd like to know where Alex gets the idea that the transition of Python 2
> t
ackless, and Java guys using Jython, and many more besides, most of whom
are sure that their little tiny part of the Python ecosystem is
representative of everyone else when in fact they hardly talk at all.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
n who was
still using 1.5 professionally. Software never quite dies so long as there
is hardware capable of running it.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ion. If you'd be so kind as to copy and paste the actual
exception, assuming it isn't a secret, perhaps we'll be able to tell you
what it actually says.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
hich will take you
to the "What's New in Python 3" document, which reveals that the StringIO
module is renamed to io.StringIO, and so you should use this instead:
from io import StringIO
https://duckduckgo.com/?q=StringIO%20renamed%20Python%203
If googling fails, feel free to ask here!
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ntaxError.
You know how the world ended when Python 2.6 broke backwards compatibility
and split the Python community into two? No, me neither.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ocess(obj)
Is that really better than this?
items = alist + blist + clist
for i, obj in enumerate(items):
items[i] = process(obj)
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
x27; or ...
No, you have this completely backwards. New features don't help you support
old versions of Python that lack those new features. New features are an
incentive to drop support for old versions.
> In any case I think we will be maintaining python 2.x code for at least
> another 5 years; the version gap is then a real hindrance.
Five years sounds about right.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
oject/clpython/
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
André Malo wrote:
> * Steven D'Aprano wrote:
>
>> Mark Lawrence wrote:
>>
>>> raise "Not Valid DB Type"
>>>
>>> is perfectly valid in Python 2.
>>
>> Actually, no it isn't. It's only valid up to Python 2.4.
ls around in a circle
from A to B a million times then shoots off straight to Z without passing
through any of the other cities.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ncorrect. Python 2 has never used UTF-8 internally for Unicode
strings. In narrow builds, it uses UTF-16, but makes no allowance for
surrogate pairs in strings. In wide builds, it uses UTF-32.
Other implementations, such as Jython or IronPython, may do something else.
--
Steven
--
https://m
Roy Smith wrote:
> I wrote:
>> > I realize I'm taking this statement out of context, but yes, sometimes
>> > fast is more important than correct.
>
> In article <[email protected]>,
> Steven D'Aprano wrote
Devin Jeanpierre wrote:
> On Sat, Jan 4, 2014 at 6:27 PM, Steven D'Aprano
> wrote:
>> Fast is never more important than correct. It's just that sometimes you
>> might compromise a little (or a lot) on what counts as correct in order
>> for some speed.
>
>
aising from None",
> or is there something else going on?
Remember that "raise Spam from None" only works from Python 3.3 onwards.
Personally, I think that releasing nested tracebacks before having a way to
suppress the display was a strategic blunder, but it's fixed now, at least
for those who can jump straight to 3.3 and not bother supporting 3.1 and
3.2.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
a SECOND of packages.
Yes, but judging by what you described as their packing algorithm that's
probably only a tenth of a cubic metre of *books*, the rest being empty box
for the book to rattle around in and get damaged.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ciety as a whole (less redundant shipping and less ecological harm), but
not better for Amazon. Since Amazon gets to decide what's better, their
greedy, short-term outlook wins, at least until such time as customers find
an alternative. Amazon would absolutely not agree with you that packing the
books
astring):
result = []
for c in astring:
i = ord(c)
if ord('a') <= i <= ord('m') or ord('A') <= i <= ord('M'):
i += 13
elif ord('n') <= i <= ord('z') or ord('N') <= i <= ord('Z'):
i -= 13
result.append(chr(i))
return ''.join(result)
But why would you want to do it the slow way?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
with this. Dealing
> with protocols where bytes is the norm and embedded ascii is prevalent --
> well, I can easily imagine the nightmare.
Is it one of those nightmares where you're being chased down an endless long
corridor by a small kitten wanting hugs? 'Cos so far I'm not seeing the
terror...
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ext, you'd be wrong -- the field
> names are also encoded, as are the Character and Memo fields.
What Character and Memo fields? Are you trying to say that the NAME and AGE
are *not* actually ASCII text, but a mere coincidence, like my example of
1095189760? Or are you referring to the fact that they're actually encoded
as ASCII? If not, I have no idea what you are trying to say.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
rings.
Quite the opposite -- I never quite understood the difference between text
strings and byte strings until I started using Python 3.
Perhaps you would care to explain what these everyday problems are that you
have seen?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
uts up.
- Give in to his (and by extension, everyone elses) complaints, whether
justified or not, and make Python worse.
- Counter his bad press with good press, and come across as arrogant idiots
by denying actual real problems (if any).
- Wait for the Internet to move on.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
dropped. Inheriting
from object became optional. Either way, you would get the same behaviour,
and __new__ is always used. So if you have a buggy __new__ method, it could
be ignored in Python 2 and suddenly run in Python 3, giving you an error.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
Ethan Furman wrote:
> On 01/06/2014 09:27 AM, Steven D'Aprano wrote:
>> Ethan Furman wrote:
>>
>> Chris didn't say "bytes and ascii data", he said "bytes and TEXT".
>> Text != "ascii data", and the fact that some people apparently
nse, (2) demonstrate at least
a minimal level of competence rather than making utter n00b mistakes while
insisting that you know so much more than experts in the field, and (3)
give actual evidence for your assertions, this will not be a debate.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 06 Jan 2014 16:32:01 -0500, Ned Batchelder wrote:
> On 1/6/14 12:50 PM, Steven D'Aprano wrote:
>> Ned Batchelder wrote:
>>
>>> You are still talking about whether Armin is right, and whether he
>>> writes well, about flaws in his statistics, etc.
return "eggs"*n
d = {1: spam, 2: eggs}
print( d[1](3) )
print( d[2](3) )
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
nal value of a byte:
ord(b'y') => 121
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
Ervin Hegedüs wrote:
> hi,
>
> On Tue, Jan 07, 2014 at 10:13:29PM +1100, Steven D'Aprano wrote:
>> Does anyone know what the rationale behind making byte-string indexing
>> return an int rather than a byte-string of length one?
>>
>> That is, given b = b&
problem,
and it causes them grief. This little difference between bytes in 2.7 and
bytes in 3.x is a point of friction which makes porting harder, and I'm
trying to understand the reason for it.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ython3 docs that does call them bytestrings please submit a bug report.
The name of the class is "bytes", but what they represent *is* a string of
bytes, hence "byte-string". It's a standard computer science term for
distinguishing strings of text from strings of bytes.
ident rather than by design, or because my users had never fed it
> anything that would make it fall over. Of course, my first reaction was
> a defensive one, but once I had got over that and got my head around
> Python 3's view of the world, I was pleased I had. ...
Well said
;s all fine.
What's not fine though is people holding the rest of us back with their
negativity and FUD that Python 3 is a mistake.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
t a single Python version,
rather than libraries and frameworks that target many different versions,
migrating is a once-off cost, and for most apps, not a large one.
Certainly much less than re-writing the app in another language.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ntil there's nothing left to
substitute, then no, not directly. You would have to manually expand the
template yourself.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
]
Using a wide build is the same:
# on my machine "orac"
>>> sys.maxunicode
1114111
>>> assert 'Straße'[4] == 'ß'
Traceback (most recent call last):
File "", line 1, in
AssertionError
But once you run the "from __future__"
uary/664430.html
you will see that the message is correctly indented with tabs.
> Your message shows it all flushed to the left margin, probably due to
> posting in html mode. Use text mode here.
Looks like perhaps Gmane is stripping tabs from their mirror. You should
report t
to ask questions about Python 1.5, we can answer
them! The core language is still recognisably Python, a surprisingly
large number of libraries were around back then (it was Python 1.4 or 1.5
which first got the reputation of "batteries included"), and I for one
still have it instal
;s not a violation of the Liskov Substitution
Principle, because it's more restrictive, not less. What am I missing?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
old
versions of PHP. These guys offer PHP 5.2 to 5.5:
http://www.a2hosting.com/php-hosting
WordPress will run on PHP 4.1!
So it is no surprise that Python hosting companies still mostly provide
2.7.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
t occurs: in CPython, it will be
immediate, in Jython or IronPython it will occur when the garbage
collector runs.)
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
nicode anywhere near as
well as he thinks he does. The question is, will he cherish his
ignorance, or learn from this thread?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
o. But I'm not exactly an encoding expert.
Failed how? Please copy and paste your exact exception traceback, in full.
Ultimately, dealing with email is a hard problem. So long as you only
receive 7-bit ASCII mail, you don't realise how hard it is. But the
people who write the mail l
is just another encoding.
I'm not entirely sure how a programming language data type (str) can be
considered a transformation.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
/undefined.py", line 19, in
encode
raise UnicodeError("undefined encoding")
UnicodeError: undefined encoding
py> 'abc'.encode('unknown')
Traceback (most recent call last):
File "", line 1, in
LookupError: unknown encoding: unknown
py>
On Thu, 16 Jan 2014 16:01:56 +1100, Chris Angelico wrote:
> On Thu, Jan 16, 2014 at 1:13 PM, Steven D'Aprano
> wrote:
>> if sig.startswith((b'\xFE\xFF', b'\xFF\xFE')):
>> return 'utf_16'
>> elif sig.startswith((b'\x0
On Thu, 16 Jan 2014 14:47:00 +1100, Ben Finney wrote:
> Steven D'Aprano writes:
>
>> enc = guess_encoding_from_bom("filename") if enc == something:
>> # Can't guess, fall back on an alternative strategy ...
>> else:
>> f = open("
T_STRINGS[name] = get_giant_string(key)
I'm sure you get the picture. Then each method just needs to know it's
own name:
class Foo(TestCase):
def test_t1(self):
RECEIPT = DICT_OF_GIANT_STRINGS["test_t1"]
which I must admit is much easier to read than
RECEIPT = "...2500 hex encoded characters..."
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 16 Jan 2014 10:51:42 +, Robin Becker wrote:
> On 16/01/2014 00:32, Steven D'Aprano wrote:
>>> >Or are you saying thatwww.unicode.org is wrong about the definitions
>>> >of Unicode terms?
>> No, I think he is saying that he doesn't know Unico
x27;)
Traceback (most recent call last):
File "", line 1, in
ValueError
I believe this might be accepted as a bug report on ValueError.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
2014, 7:06 PM
>
> On Fri, Jan 17, 2014 at 5:01 AM,
> Björn Lindqvist
> wrote:
> > 2014/1/16 Steven D'Aprano :
> >> def guess_encoding_from_bom(filename, default):
> >> with open(filename, 'rb')
> as f:
>
ction, we can give you some concrete advice.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
~]$ ls sample.pyc
ls: sample.pyc: No such file or directory
[steve@ando ~]$ python -m compileall sample.py
Compiling sample.py ...
[steve@ando ~]$ ls sample.p*
sample.py sample.pyc
[steve@ando ~]$ python sample.pyc
Hello!
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
to get 95% of the way by using print.
def func(a):
"""
>>> print(func(u'aaa'))
aaa
"""
return a
ought to behave identically in both Python 2 and Python 3.3, provided you
only print one object at a time. This ought to work wit
On Fri, 17 Jan 2014 12:12:35 +, Robin Becker wrote:
> On 17/01/2014 11:41, Steven D'Aprano wrote:
>> def func(a):
>> """
>> >>> print(func(u'aaa'))
>> aaa
>> """
>> return a
On Sat, 18 Jan 2014 13:30:20 -0500, Roy Smith wrote:
> Pardon me for being cynical, but in the entire history of the universe,
> has anybody ever used input()/raw_input() for anything other than a
> homework problem?
Yes. They are excellent for interactive command line tools.
-
ibraries, but we try not to write your code for you. If you make a good-
faith attempt to solve the problem, and then ask for help, we shall try
to assist. But as I said, you should find out what your school or
university's policy is.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
The question in my mind is how to
encourage students to learn from each other rather than to merely
mechanically copy from each other?
Relevant:
http://qz.com/157579/confession-of-an-ivy-league-teaching-assistant-heres-why-i-inflated-grades/
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ess you need to worry about
plagiarism.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
one crazy on this
subject; not figuratively crazy, but certifiably, clinically,
sociopathically insane. I'm talking delusional, loss of contact
with reality insanity."
-- Professor Steven Dutch, University of Wisconsin
http://www.uwgb.edu/dutchs/PSEUDOSC/PlagShame.HTM
More
I have ever read. It doesn't look to me like that attitude is intended to
be welcoming to students who are trying to walk the narrow tightrope of
being part of a community of programmers who value sharing and
collaboration while avoiding running foul of overly strict academic rules
about
n seen once or twice:
if len(db[23]) == 1:
print("key 23 has been seen only once")
else:
print("key 23 has been seen twice or more times")
Does this answer your question?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
problem, by renaming the files, or at least
moving them into a consistent location, rather than have to repeatedly
search multiple directories. Good luck!
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
human being:
for each key:
if the key is the one the user inputted, skip this key
otherwise:
get all the lists for this key
for each list:
search for the value
Now change that to Python code. Don't just ask us to solve the problem
for you.
using Centos and the
other Debian.
Anyone have any idea what's going on? I can replicate the display error
using Python 3 like this:
py> s = 'ñøλπйж'
py> print(s.encode('utf-8').decode('latin-1'))
ñøλÏйж
but I'm not sure why it's happening at the command line. Anyone have any
ideas?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
u can exit the function,
unbind (delete) the variable, re-assign to something else, whatever, and
you should never get a core dump.
(I've only ever seen a single core dump in Python in 15+ years.)
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 25 Jan 2014 17:08:56 +1100, Chris Angelico wrote:
> On Sat, Jan 25, 2014 at 3:37 PM, Steven D'Aprano
> wrote:
>> But using Python 2.7, I get a really bad case of moji-bake:
>>
>> [steve@ando ~]$ python2.7 -c "print u'ñøλπйж'" ñøλÏйж
ming languages:
3+4*5
Here it is written as XML:
345
Source:
http://www.ibm.com/developerworks/xml/library/x-sbxml/index.html
More here:
http://www.codinghorror.com/blog/2008/05/xml-the-angle-bracket-tax.html
http://myarch.com/why-xml-is-bad-for-humans/
If you expect a human being to routinely *read*, let alone *write*, XML
in preference to some real programming language, that is a horrible,
horrible thing. Using XML as an internal, machine-generated, format not
intended for humans is not too bad. Anything else is abusive.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
d Nyarlathotep the Crawling Chaos Elder God
to Wolverhampton.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
showed a screenshot earlier that illustrated a
> 'button' definition.
The idea of drag-and-drop GUI designers is hardly new. I was using one
back in 1986 or '88, Apple's Hypercard. Now that was a user-friendly
programming language/environment/toolkit.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
exe is executable by all users, but the standard library files
are only readable by the Administrator user.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
-1] # everything else
street_name = " ".join(street_name)
and so on for the post code. Then, at the very end, assemble the parts
you want to write out, join them with tabs, and write:
fields = [farmid, street_number, street_name, street_type, ... ]
outHandler.write("\t".join(fields))
outHandler.write("\n")
Or use the csv module to do the actual writing. It will handle escaping
anything that needs escaping, newlines, tabs, etc.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
n only a single function or method, so in even a fairly small
project you might have a few dozen distinct variables, each of which
might appear only three or five times.
> Is anyone aware of tools like this for
> Python? Bonus points for pointers to an Emacs implementation.
Sorry, can
uestions in English, then we can help you write
code to do it.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
. If someone is so sensitive as to not be able to
> discuss a technical matter without making it personal or seeing it as an
> attack against their religion then I neither want nor need their input.
> There are plenty of technical resources in the world that don't require
> idol worship.
What does idol worship have to do with anything? Oh wait, do you think
Ethan and Chris are pissed off because you're not genuflecting at
Python's awesomeness? That's another comically wrong conclusion.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ot;. input also provides visual feedback while you type, an
optional prompt, handling of newlines, buffering, and possibly more.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
therefore the FSR is rubbish.
The South American Potoo is a member of the Nyctibiidae family, therefore
the FSR is rubbish.
We get the point, thank you.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
formational posts.
Regards,
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
; changing my keyboard from UK to USA, without any effect, and tried
> adding a space after the final double quote,
UK or USA keyboard won't make any difference. You need to use an ordinary
text editor (or better still, a programmer's text editor) but not a word
processor such as W
But too many parens obscure the meaning of the expression too. Aim
for a good balance, neither too few nor too many. Your judgement
of the right number of parens is a skill, which will come with
experience.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
y_performing_a_replacement_on_the_copy
... ('well', 'excessively long')
... )
'excessively long named'
While explicit is better than implicit, sometimes you can be *too*
explicit.
If timedelta objects were mutable, then I would expect that you would
just write the fi
On Thu, 30 Jan 2014 18:13:54 +1300, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>> On Mon, 27 Jan 2014 12:22:22 -0800, Rick Johnson wrote:
>>
>>>Why do we even need an "input" function anyway if all it is going to do
>>>is read from stdin?
>&
On Fri, 31 Jan 2014 04:08:46 +, Dan Sommers wrote about temperatures:
> And -1 K.
You josh, but there are negative temperatures in Kelvin. They're hotter
than infinitely hot.
http://en.wikipedia.org/wiki/Negative_temperature
--
Steven
--
https://mail.python.org/mailman/listinf
7;re the doctor, you tell me."
You might have a bit more success asking for help with a bug if you tell
us what bug it is.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
e
word). The best I can come up with is "KUH TOR" or possibly "SEE TOR",
both of which are clumsy, and only save a single syllable.
On the other hand, "double leading and trailing underscore" is ten
syllables. "Dunder" is two, a significant saving, and it&
e least amount
of cognitive dissonance to users' understanding of Python, not whether
they have to learn new terminology, and in the context of Python's object
module, "constructor" and "initialiser" best describe what __new__ and
__init__ do.
[1] Yes, despite being declared with a "cls" parameter, __new__ is
actually hard-coded as a static method.
[2] By explicitly or implicitly calling object.__new__.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
uestion: no, in context of programming, I would *not*
call the putting-paint-to-canvas stage of artist painting to be
"creation". I would call it *using* the constructed object (the canvas).
Whether that *use* of the canvas happens to be *artistic* creation or
mere derivative pap is an
On Sat, 01 Feb 2014 15:35:17 +1100, Chris Angelico wrote:
> On Sat, Feb 1, 2014 at 2:42 PM, Steven D'Aprano
> wrote:
>> I've met people who have difficulty with OOP principles, at least at
>> first. But once you understand the idea of objects, it isn't that ha
On Sat, 01 Feb 2014 15:05:34 +1100, Chris Angelico wrote:
> On Sat, Feb 1, 2014 at 1:52 PM, Steven D'Aprano
> wrote:
>> "Constructor" is three syllables; "ctor" isn't readily pronounceable in
>> English at all, rather like Cthulhu. (I can't
e that it is accurate-down-to-the-last-footnote - any difference
> between the reference documentation and the implementation is a bug in
> either the documentation or the implementation.
+1
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 03 Feb 2014 12:38:00 +1300, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>> (In hindsight, it was probably a mistake for Python to define two
>> create- an-object methods, although I expect it was deemed necessary
>> for historical reasons.
>
> I'm
want five *copies*. You can copy a list using slicing:
mylist = [1, 2, 3]
copy = mylist[:]
Instead of using list multiplication to repeat five identical lists, we
make five copies using a list comprehension:
list_of_lists = [mylist[:] for i in range(5)]
then expand it in the function call as before:
result = function(*list_of_lists)
Hope this helps,
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
"", line 1
SyntaxError: can't assign to literal
So you must have run a different program. Please show us the program you
*actually* used, and then we can help you.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
5501 - 5600 of 15564 matches
Mail list logo