Re: Experiences/guidance on teaching Python as a first programming language

2013-12-27 Thread Steven D'Aprano
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

Re: need to print seconds from the epoch including the millisecond

2013-12-27 Thread Steven D'Aprano
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

Re: [OT]Royal pardon for codebreaker Turing

2013-12-27 Thread Steven D'Aprano
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

Re: Tkinter problem: TclError> couldn't connect to display ":0

2013-12-29 Thread Steven D'Aprano
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

Re: Tkinter problem: TclError> couldn't connect to display ":0

2013-12-29 Thread Steven D'Aprano
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

Re: need to print seconds from the epoch including the millisecond

2013-12-30 Thread Steven D'Aprano
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

Re: Blog "about python 3"

2013-12-30 Thread Steven D'Aprano
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

Re: Blog "about python 3"

2013-12-31 Thread Steven D'Aprano
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

Re: Blog "about python 3"

2013-12-31 Thread Steven D'Aprano
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

Re: Python 2.x and 3.x usage survey

2013-12-31 Thread Steven D'Aprano
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

Re: PySerial for Python 2 vs. Python 3

2013-12-31 Thread Steven D'Aprano
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

Re: Python 2.x and 3.x usage survey

2014-01-01 Thread Steven D'Aprano
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

Re: About some problem

2014-01-02 Thread Steven D'Aprano
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

Re: Ifs and assignments

2014-01-02 Thread Steven D'Aprano
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

Re: Blog "about python 3"

2014-01-02 Thread Steven D'Aprano
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

Re: Is Python really "Lisp without parentheses"? So would it be easy to *implement* a lot of Python in Scheme/Lisp?

2014-01-03 Thread Steven D'Aprano
oject/clpython/ -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: About some problem

2014-01-03 Thread Steven D'Aprano
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.

Re: Blog "about python 3"

2014-01-04 Thread Steven D'Aprano
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

Re: Blog "about python 3"

2014-01-04 Thread Steven D'Aprano
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

Re: Blog "about python 3"

2014-01-04 Thread Steven D'Aprano
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

Re: Blog "about python 3"

2014-01-05 Thread Steven D'Aprano
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. > >

Re: "More About Unicode in Python 2 and 3"

2014-01-05 Thread Steven D'Aprano
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

Re: Blog "about python 3"

2014-01-05 Thread Steven D'Aprano
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

Re: Blog "about python 3"

2014-01-05 Thread Steven D'Aprano
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

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Steven D'Aprano
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

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Steven D'Aprano
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

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Steven D'Aprano
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

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Steven D'Aprano
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

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Steven D'Aprano
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

Re: class inheritance python2.7 vs python3.3

2014-01-06 Thread Steven D'Aprano
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

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Steven D'Aprano
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

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Steven D'Aprano
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

Re: "More About Unicode in Python 2 and 3"

2014-01-06 Thread Steven D'Aprano
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.

Re: nested dictionaries and functions in data structures.

2014-01-07 Thread Steven D'Aprano
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

Bytes indexing returns an int

2014-01-07 Thread Steven D'Aprano
nal value of a byte: ord(b'y') => 121 -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Bytes indexing returns an int

2014-01-07 Thread Steven D'Aprano
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&

Re: Bytes indexing returns an int

2014-01-07 Thread Steven D'Aprano
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

Re: Bytes indexing returns an int

2014-01-07 Thread Steven D'Aprano
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.

Re: "More About Unicode in Python 2 and 3"

2014-01-08 Thread Steven D'Aprano
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

Re: the Gravity of Python 2

2014-01-08 Thread Steven D'Aprano
;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

Re: the Gravity of Python 2

2014-01-08 Thread Steven D'Aprano
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

Re: extracting string.Template substitution placeholders

2014-01-12 Thread Steven D'Aprano
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

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread Steven D'Aprano
] 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__"

Re:plotting slows down

2014-01-13 Thread Steven D'Aprano
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

Re: Code review?

2014-01-13 Thread Steven D'Aprano
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

Chanelling Guido - dict subclasses

2014-01-14 Thread Steven D'Aprano
;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

Re: Python 3.x adoption

2014-01-14 Thread Steven D'Aprano
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

Re: Question about object lifetime and access

2014-01-15 Thread Steven D'Aprano
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

Re: 'Straße' ('Strasse') and Python 2

2014-01-15 Thread Steven D'Aprano
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

Re: [email protected]

2014-01-15 Thread Steven D'Aprano
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

Re: 'Straße' ('Strasse') and Python 2

2014-01-15 Thread Steven D'Aprano
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

Guessing the encoding from a BOM

2014-01-15 Thread Steven D'Aprano
/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> &#x

Re: Guessing the encoding from a BOM

2014-01-15 Thread Steven D'Aprano
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

Re: Guessing the encoding from a BOM

2014-01-15 Thread Steven D'Aprano
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("

Re: Is it possible to get string from function?

2014-01-15 Thread Steven D'Aprano
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

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Steven D'Aprano
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

Re: Unicode strings as arguments to exceptions

2014-01-16 Thread Steven D'Aprano
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

Re: Guessing the encoding from a BOM

2014-01-16 Thread Steven D'Aprano
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: >

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Steven D'Aprano
ction, we can give you some concrete advice. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Compiling main script into .pyc

2014-01-17 Thread Steven D'Aprano
~]$ 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

Re: doctests compatibility for python 2 & python 3

2014-01-17 Thread Steven D'Aprano
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

Re: doctests compatibility for python 2 & python 3

2014-01-17 Thread Steven D'Aprano
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

Re: question about input() and/or raw_input()

2014-01-18 Thread Steven D'Aprano
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. -

Re: Can post a code but afraid of plagiarism

2014-01-18 Thread Steven D'Aprano
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

Re: Can post a code but afraid of plagiarism

2014-01-20 Thread Steven D'Aprano
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

Re: Can post a code but afraid of plagiarism

2014-01-21 Thread Steven D'Aprano
ess you need to worry about plagiarism. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Can post a code but afraid of plagiarism

2014-01-21 Thread Steven D'Aprano
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

Re: Can post a code but afraid of plagiarism

2014-01-21 Thread Steven D'Aprano
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

Re: Can post a code but afraid of plagiarism

2014-01-22 Thread Steven D'Aprano
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

Re: Case insensitive exists()?

2014-01-23 Thread Steven D'Aprano
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

Re: Can post a code but afraid of plagiarism

2014-01-24 Thread Steven D'Aprano
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.

Trying to understand this moji-bake

2014-01-24 Thread Steven D'Aprano
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

Re: should I transfer 'iterators' between functions?

2014-01-24 Thread Steven D'Aprano
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

Re: Trying to understand this moji-bake

2014-01-25 Thread Steven D'Aprano
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'ñøλπйж'" ñøλÏйж

Re: Python declarative

2014-01-25 Thread Steven D'Aprano
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

Re: Python declarative

2014-01-26 Thread Steven D'Aprano
d Nyarlathotep the Crawling Chaos Elder God to Wolverhampton. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Python declarative

2014-01-26 Thread Steven D'Aprano
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

Re: Help: python 3.3.3 (AMD64) scripts fail as non-admin user on Windows Server 2012 R2

2014-01-26 Thread Steven D'Aprano
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

Re: Unwanted Spaces and Iterative Loop

2014-01-26 Thread Steven D'Aprano
-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

Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Steven D'Aprano
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&#x

Re: Remove unwanted characters from column

2014-01-27 Thread Steven D'Aprano
uestions in English, then we can help you write code to do it. -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: buggy python interpretter or am I missing something here?

2014-01-27 Thread Steven D'Aprano
. 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

Re: buggy python interpretter or am I missing something here?

2014-01-27 Thread Steven D'Aprano
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

Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Steven D'Aprano
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

Re: uninstalling python27 killed vim (actual issue was more complicated and involves Mercurial)

2014-01-28 Thread Steven D'Aprano
formational posts. Regards, -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: end quote help for a newbie

2014-01-30 Thread Steven D'Aprano
; 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

Re: 1 > 0 == True -> False

2014-01-30 Thread Steven D'Aprano
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

Re: Another surprise from the datetime module

2014-01-30 Thread Steven D'Aprano
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

Re: buggy python interpretter or am I missing something here?

2014-01-30 Thread Steven D'Aprano
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? >&

Re: pytz question: GMT vs. UTC

2014-01-30 Thread Steven D'Aprano
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

Re: webbrowser module bug?

2014-01-31 Thread Steven D'Aprano
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

Dunder [was Re: __init__ is the initialiser]

2014-01-31 Thread Steven D'Aprano
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&

Re: __init__ is the initialiser

2014-01-31 Thread Steven D'Aprano
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

Re: __init__ is the initialiser

2014-01-31 Thread Steven D'Aprano
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

Re: __init__ is the initialiser

2014-01-31 Thread Steven D'Aprano
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

Re: Dunder [was Re: __init__ is the initialiser]

2014-01-31 Thread Steven D'Aprano
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

Re: __init__ is the initialiser

2014-02-01 Thread Steven D'Aprano
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

Re: __init__ is the initialiser

2014-02-02 Thread Steven D'Aprano
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

Re: [newbie] copying identical list for a function argument

2014-02-03 Thread Steven D'Aprano
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

Re: Calculator Problem

2014-02-03 Thread Steven D'Aprano
"", 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

<    51   52   53   54   55   56   57   58   59   60   >