Re: interactive help on the base object
On Mon, Dec 9, 2013 at 6:31 PM, Alan Bawden a...@scooby-doo.csail.mit.edu wrote: I don't believe that this was done for any deep principled reason, but rather it was just permitted because the algorithm for computing method resolution order didn't actually care whether there were inheritance cycles -- it still terminated and returned an ordered list of component classes. How does that work, exactly? How do you have a class inherit (ultimately) from itself, and how does that impact the component class list? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: python programming help
On Mon, Dec 9, 2013 at 4:10 PM, ru...@yahoo.com wrote: We all use buggy software every day. *Every* piece of non-trival software is buggy -- you already know that. So you are saying that bugs that annoy *you* are ones that *others* should change their practice to join your boycott to fix. The ones that have interoperability problems are the ones that need to be fixed. When a MUD client uses CP-1252 instead of either Latin-1 or UTF-8, that's a fault in it. (Confession: My own RosMud has that exact problem, because of what it uses under the covers for screen display. But it's being retired in favour of Gypsum, which supports full Unicode and defaults to UTF-8 transport.) You sound like some Unix hard-asses of the 1990's who, by god, weren't going pollute their software with any kind of MS Windows compatibility. No supporting a broken OS for them. They would keep the software pure and Unix-only and force Microsoft to fix their broken OS. Well, most of that software and those programmers have been eliminated by Darwinian selection, and today cross-platform (or Windows only) software is the norm. And there were Microsoft people in the same era who, by Bill, weren't going to pollute their software with any kind of standards compatibility. Let's look at just one product, Internet Explorer: IE6: Microsoft enjoys a near monopoly and uses this to encourage people to use IE-only features Myriad intranet sites get set up that won't work properly on any other browser. IE7: Other browsers now actually have some market-share, and people are agitating for IE to match them in behaviour. Oh dear. Guess we'd better add tabbed browsing, everyone else has it... the monopoly isn't enough to maintain itself on its own. IE8: Actually, it looks like standards compliance is becoming important. But so is compatibility with IE6. What a pain, what a pain. IE9 and IE10: The market shift to other browsers and thus the pressure shift to standards compliance continues. Unfortunately, it's just not possible to maintain IE6 compatibility, so lots of corporates have to keep XP and IE6 for their daily use. (I was in a Subway buying a sandwich a few weeks ago, and the system was having trouble. Guy was on the phone to the US trying to get it sorted out. Everything was in IE6. I pity them.) Windows-only is hardly the norm. There's at least as much software that's Mac-only or Linux-only as Windows-only. And far far more that's cross-platform or at least multi-platform. The most important thing is interoperability - sometimes that means stuff like Samba (specifically written to talk to a foreign system), but more often it means coding to the pre-written standards. I can write all sorts of TELNET servers and clients, and I can be confident that they'll work nicely with other people's clients and servers, and that they'll understand each other when they say IAC DO NAWS or IAC SB TERMTYPE IS Gypsum IAC SE. If one of them is buggy, it must be fixed, or it must not be used. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Qml Error on CentOS6.4 when ./configure ?
I install latest QT5 and PyQt5 on CentOS6.4 And here is some error: g++ -c -pipe -O2 -fPIC -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/Qt/5.1.1/gcc_64/mkspecs/linux-g++ -I. -I. -I../../QtQml -I/opt/python/include/python2.7 -I/opt/Qt/5.1.1/gcc_64/include -I/opt/Qt/5.1.1/gcc_64/include/QtQml -I/opt/Qt/5.1.1/gcc_64/include/QtNetwork -I/opt/Qt/5.1.1/gcc_64/include/QtGui -I/opt/Qt/5.1.1/gcc_64/include/QtCore -I. -o qpyqml_register_type.o qpyqml_register_type.cpp qpyqml_register_type.cpp: In function ??QQmlPrivate::RegisterType* init_type(PyTypeObject*, bool, int, PyTypeObject*)??: qpyqml_register_type.cpp:262: error: insufficient contextual information to determine type qpyqml_register_type.cpp:263: error: insufficient contextual information to determine type qpyqml_register_type.cpp:264: error: insufficient contextual information to determine type qpyqml_register_type.cpp:265: error: insufficient contextual information to determine type qpyqml_register_type.cpp:266: error: insufficient contextual information to determine type qpyqml_register_type.cpp:267: error: insufficient contextual information to determine type qpyqml_register_type.cpp:268: error: insufficient contextual information to determine type qpyqml_register_type.cpp:269: error: insufficient contextual information to determine type qpyqml_register_type.cpp:270: error: insufficient contextual information to determine type qpyqml_register_type.cpp:271: error: insufficient contextual information to determine type qpyqml_register_type.cpp:272: error: insufficient contextual information to determine type qpyqml_register_type.cpp:273: error: insufficient contextual information to determine type qpyqml_register_type.cpp:274: error: insufficient contextual information to determine type qpyqml_register_type.cpp:275: error: insufficient contextual information to determine type qpyqml_register_type.cpp:276: error: insufficient contextual information to determine type qpyqml_register_type.cpp:277: error: insufficient contextual information to determine type qpyqml_register_type.cpp:278: error: insufficient contextual information to determine type qpyqml_register_type.cpp:279: error: insufficient contextual information to determine type qpyqml_register_type.cpp:280: error: insufficient contextual information to determine type qpyqml_register_type.cpp:281: error: insufficient contextual information to determine type make[2]: *** [qpyqml_register_type.o] Error 1 make[2]: Leaving directory `/root/Downloads/PyQt-gpl-5.1.1/qpy/QtQml' make[1]: *** [sub-QtQml-make_first] Error 2 make[1]: Leaving directory `/root/Downloads/PyQt-gpl-5.1.1/qpy' make: *** [sub-qpy-make_first-ordered] Error 2-- https://mail.python.org/mailman/listinfo/python-list
ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')' at
from BeautifulSoup import BeautifulSoup import re, urllib2, MySQLdb #MySQLdb.escape_string( ) import sys import unicodedata if __name__==__main__: #link = raw_input(Enter the url link: ) db = MySQLdb.connect(localhost,root,, ebay) cursor=db.cursor() link = http://www.ebay.com/sch/Mens-Shoes-/93427/i.html?_pppn=r1_dcat=93427LH_ItemCondition=1000%7C1500; link1 =db.escape_string(link) page = urllib2.urlopen(link) soup = BeautifulSoup(page) Contents = soup.findAll(itemprop = name) lst_content = [] for x in Contents: x = x.string lst_content.append(x) Price = soup.findAll(itemprop = price) lst_price =[] for y in Price: y = y.string lst_price.append(y) for x , y in zip(lst_content, lst_price): sql = insert into `category` (url, catagory,price) VAlUES ('%s', '%s', '%s')%(link1,x,y) #print sql sql = unicodedata.normalize('NFKD', sql).encode('ascii','ignore') #sys.exit(0) cursor.execute(sql) db.commit() db.close() +++ error occur ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')' at line 1) -- https://mail.python.org/mailman/listinfo/python-list
Re: using ffmpeg command line with python's subprocess module
在 2013年12月6日星期五UTC+8下午10时59分43秒,Chris Angelico写道: On Sat, Dec 7, 2013 at 1:54 AM, iMath redstone-c...@163.com wrote: fp=tempfile.NamedTemporaryFile(delete=False) fp.write((file '+fileName1+'\n).encode('utf-8')) fp.write((file '+fileName2+'\n).encode('utf-8')) subprocess.call(['ffmpeg', '-f', 'concat','-i',fp.name, '-c', 'copy', fileName]) fp.close() You need to close the file before getting the other process to use it. Otherwise, it may not be able to open the file at all, and even if it can, you might find that not all the data has been written. But congrats! You have successfully found the points I was directing you to. Yes, I was hinting that you need NamedTemporaryFile, the .name attribute, and delete=False. Good job! ChrisA we don't have permission to use the temporary file while it has not been closed,but when the file is closed , it will be destroyed by default(delete=True),but once we set delete=False,then we couldn't depend on the convenience of letting the temporary file automatically delete itself after it has been used(then we have to delete it later by os.remove()) ,thus there is nearly no convenience in creating a temporary file or a persistent one when using NamedTemporaryFile. I think this is a design flaw and should be improved like this :when delete=True,the file should be removed upon destruction of the object or on function return or on garbage collected,only when delete=False,the file can remain on the disk . -- https://mail.python.org/mailman/listinfo/python-list
Re: ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')'
On Mon, Dec 09, 2013 at 12:41:57AM -0800, Jai wrote: sql = insert into `category` (url, catagory,price) VAlUES ('%s', '%s', '%s')%(link1,x,y) sql = unicodedata.normalize('NFKD', sql).encode('ascii','ignore') cursor.execute(sql) ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')' at line 1) Though you haven't given the full traceback, I suspect that the lines above are what is causing your problem. My best guess is that you're being hit by a form of SQL injection[0], in that the values you are combining in to your query have single quotes which are resulting in an SQL statement that looks like: insert into `category` (url, category, price) VALUES ('...', 'MEN'S SIZE 11.5 NEW IN BOX', '$49.99'); As you can see, the second value you are passing has mismatched quotes. This is a common problem, so the MySQLdb library handles it by allowing you to pass in the values you want to cursor.execute; it then takes care of escaping them correctly: sql = insert into `category` (url, catagory,price) VAlUES ('%s', '%s', '%s') cursor.execute(sql, (link1, x, y)) I'm not 100% sure what the Unicode normalisation is meant to be doing, so you'll have to work out how to integrate that yourself. Cheers, Dan [0] https://en.wikipedia.org/wiki/SQL_injection -- https://mail.python.org/mailman/listinfo/python-list
Re: python programming help
On 09/12/2013 05:07, ru...@yahoo.com wrote: On 12/08/2013 05:27 PM, Mark Lawrence wrote: On 09/12/2013 00:08, ru...@yahoo.com wrote: On 12/08/2013 12:17 PM, Chris Angelico wrote: On Mon, Dec 9, 2013 at 6:06 AM, rafaella...@gmail.com wrote:[...] [...] To the OP, please ignore the above, it's sheer, unadulterated rubbish. Nobody has ever been bullied into doing anything. People have however been asked repeatedly to either A) use the link referenced above to avoid sending double spaced crap here from the inferior google groups product or B) use an alternative technology that doesn't send double spaced crap. Mark, I appreciate your calm and reasonable requests for people to checkout the page you gave a link to, that's why I repeated your advice. It is also why I responded to Chris and not to you. However it does not change the fact that people here have responded in rather extreme way to GG posts including calling GG users twits and claiming GG posts damage their eyesight, as well as repeatedly denying the obvious fact that GG is much easier to use for many than to subscribe to a usenet provider or to a mailing list. One frequently sees words like crap, slimy, rubbish etc to describe GG posts which is pretty intimating to people who just want some help with a python question using a tool they already know how to use and have had no complaints about in other places. Well you can ask iMath, amongst others, not to send double spaced google nonsense. They've been asked repeatedly, politely, but apparently have no consideration at all for people who have no interest in seeing this ill formed dross spread throughout web land. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')'
On Mon, Dec 9, 2013 at 7:41 PM, Jai jaiprakashsingh...@gmail.com wrote: for x , y in zip(lst_content, lst_price): sql = insert into `category` (url, catagory,price) VAlUES ('%s', '%s', '%s')%(link1,x,y) #print sql sql = unicodedata.normalize('NFKD', sql).encode('ascii','ignore') #sys.exit(0) cursor.execute(sql) My reading of your error message suggests that you just came across an item category with an apostrophe in it. What you've done here is horribly dangerous - it's an invitation for SQL injection attacks. Do not EVER do this sort of thing, it will always come back to bite you! Look into parameterized queries. They are the right way to do this. Read up on SQL injection and how to avoid it. Also: Encoding to ASCII, ignore, is a bad idea. You'll do far better to tell MySQL to use UTF-8 and then store true Unicode. Though you may find that you'll do better to get a better database like PostgreSQL, as MySQL has been known to have some issues with Unicode (not sure if they're all fixed; MySQL has enough other problems that I don't bother with it any more). Small tip, also: Spelling VAlUES with a lower-case L is only going to confuse people, mainly yourself :) You also seem to be inconsistent with your names - the table is called category (I don't think it's a reserved word, so the escaping is unnecessary there), and the column is catagory. Is one of those incorrect? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On 09/12/2013 06:44, rusi wrote: On Monday, December 9, 2013 10:56:28 AM UTC+5:30, ru...@yahoo.com wrote: On 12/08/2013 09:46 PM, rusi wrote: On Monday, December 9, 2013 9:46:30 AM UTC+5:30, Steven D'Aprano wrote: On Sun, 08 Dec 2013 18:58:09 -0800, rusi wrote: [...] Does GG not give you some way of inspecting the post's full headers? Well I spent half hour looking around -- both inside GG and of course searching before asking. If you click on the little down triangle to the right of the reply button for a message, you'll get a menu that includes Show Original. You can see the headers including the Content-Type: in that original. Thanks rurpy -- I only looked for how one may set and not just what is. So now I look at my own post in GG and see Content-Type: text/plain; charset=UTF-8 So far so good. However when I point firefox at my own post in the archive https://mail.python.org/pipermail/python-list/2013-December/662015.html firefox shows encoding as Windows-1252. Note Ive looked at a dozen random pages and for all FF shows encoding as utf-8 except the python list archive ones which show as Win 1252 Note looking into the html I see META http-equiv=Content-Type content=text/html; charset=us-ascii How us-ascii becomes Win-1252 is outside the reach of my meagre intelligence! Though I still suspect something is not quite right with the python mailing-list and/or archive in respect of char encodings. [Am I beginning to sound like jmf is my guru :-) ] I'd mention that I never seem to have a problem using Thunderbird on Windows 7, but I won't as I don't want to be accused of bullying, hating GG, or whatever. Doh!!! :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On Sun, Dec 8, 2013 at 4:01 PM, Mark Janssen dreamingforw...@gmail.com wrote: Likewise, WITH A COMPUTER, there is a definite order which can't be countermanded by simply having this artifice called Object. If you FEE(L)s hadn't noticed (no longer using the insult foos out of respect for the sensativities of the brogrammers), this artifice has just been *called on the floor* with this little innocent question that fired up this discussion again (don't hate the messenger). Again: people entering the community are pointing out a problem -- that Object is both trying to be the BASE and the SUPERclass of all objects. You're mixing two different terminologies. Whereas superclass contrasts with subclass and connotes an imaginary spatial relationship, base contrasts with derived (not top), which pairing does not suggest any spatial relationship at all. There is no inconsistency in that these two words happen to mean the same thing. Likewise it doesn't matter whether we draw class hierarchies from the top down or the bottom up or even sidewise: Have you caught it by now, friends: IT MATTERS TO THE COMPUTER. No, I'm pretty sure the computer doesn't care one whit whether the inheritance hierarchy that I scribble on a random sheet of paper happens to be represented as top-down, bottom-up, left-right, right-left, center-out, ana-kata, or using any other conceivable spatial relationship that I may have omitted. The computer only cares (inasmuch as I'm willing to personify it) about the actual *code* that I feed into it. How the programmer abstracts or visualizes that code is irrelevant. -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On 12/9/13 12:11 AM, Steven D'Aprano wrote: On Sun, 08 Dec 2013 15:01:59 -0800, Mark Janssen wrote: On Sun, Dec 8, 2013 at 2:33 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 07 Dec 2013 20:21:06 -0800, Mark Janssen wrote: Is it just me, or is this basically useless? class object | The most *base* type [[Terry Reedy:]] How about something like. The default top *superclass* for all Python classes. How 'bout you fools just admit that you didn't realize you've been confused this whole time? (It *is* possible isn't it?) Mr. Ewing says base has to be interpreted as an *adjective* because otherwise it would mean the BOTTOM (like the BASE of the pyramid), while Terry responds that it is the TOP (*super*class). Earlier, Steven D'Aprano wanted to argue that this distinction was irrelevant, What are you talking about? Until this very post, I haven't made any comments in this thread. It was a few months ago. You do know what I'm talking about because you just expounded with the exact same argument below. It's like a broken record. While I am gratified that you apparently memorise and obsess over things I wrote months ago, I'm sorry to tell you that I wasn't lying when I said that I didn't know what you were talking about. I had no idea that you were referring to a completely different conversation, nor do I recall every post I write here. If I repeated the same argument, it is because the argument is still valid. Drawing the root of the tree at the top of the page is just a convention, just driving on the left side of the road, or calling the elected head of state Prime Minister. There are other ways to do such things which are equally valid, and so long as both parties agree on the convention, it doesn't matter whether you write from left-to-right like in Australia, right-to-left like in Egypt, or alternate like in Israel. (Now if *I* sound like a broken record, it's because no seems to see the obvious, but carry on.) It must be such a trial to be the only sane man in a world gone mad. [...] What matters is the relationships between the entities, not the specific direction they are drawn in relative to some imaginary absolute space. [yadda, yagni, yadda] But, there IS A DIFFERENCE. Let me explain the concept of a object model (or type model if you prefer). In a family inheritance tree, there is this difference -- called the calendar -- which imposes an ordering which can't be countermanded by flipping your silly chart around. You made a bullshit example to simply argue a point and *fooled yourself* into ignoring this. Yes? No. You haven't explained anything, you have merely made an assertion with no supporting evidence at all. In a family tree of ancestors and descendants, the relationship being draw is time-based. Ancestors exist before descendants. Descendants are derived in some way from ancestors, not the other way around. We all agree that your father existed before you. The temporal direction of the relationship is absolutely fixed, past before present, ancestors before descendants. We can agree on this. Explain to me this: what (apart from mere human convention) imposes the ordering past must be at the top of the page? If you are reading this as email, your mail client very likely has an option to sort message in order that they were received, either most- recent at the top or oldest at the top. Do you really mean to imply that one of those is logical and the other is delusional? Likewise, WITH A COMPUTER, there is a definite order which can't be countermanded by simply having this artifice called Object. If you FEE(L)s hadn't noticed (no longer using the insult foos out of respect for the sensativities of the brogrammers), this artifice has just been *called on the floor* with this little innocent question that fired up this discussion again (don't hate the messenger). Again: people entering the community are pointing out a problem -- that Object is both trying to be the BASE and the SUPERclass of all objects. How is this a problem? They mean the same thing. A television is both an appliance and a device. object is both the base class and a superclass of all other classes. CS554: A type/object *model* has to define the relationship of these nice abstractions so that they can be mapped to the *actual concreteness* of the machine. And there, bro, there is an ordering. Yes, the ordering is that the subclass is derived from the superclass. Nobody disputes that. But we can show that relationship using any convention we like: superclass - subclass subclass - superclass superclass extended by subclass subclass extends superclass superclass ↓ subclass subclass ↑ superclass Python syntax: class MySubclass(MySuperclass): ... Smalltalk syntax: MySuperclass :subclass #MySubclass Java syntax: class MySubclass extends MySuperclass {...} You're not going to magically flip the hierarchy so that
Programming puzzle with boolean circuits
Hi group, it's somewhat OT here, but I have a puzzle to which I would like a solution -- but I'm unsure how I should tackle the problem with Python. But it's a fun puzzle, so maybe it'll be appreciated here. The question is: How do you design a boolean circuit that contains at most 2 NOT gates, but may contain as many AND or OR gates that inverts three inputs? IOW: Build three inverters by using only two inverters (and an infinite amount of AND/OR). Surprisingly, this is possible (and I even know the solution, but won't give it away just yet). I found this puzzle again and was thinking about: How would I code a brute-force approach to this problem in Python? And to my surprise, it isn't as easy as I thought. So I'm looking for some advice from you guys (never huts to improve ones coding skills). Best regards, Johannes -- Wo hattest Du das Beben nochmal GENAU vorhergesagt? Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa hidbv3$om2$1...@speranza.aioe.org -- https://mail.python.org/mailman/listinfo/python-list
Experiences/guidance on teaching Python as a first programming language
Hi all, I work in a University Engineering faculty teaching, among other things, programming. In our last meeting about improving our teaching syllabus and delivery we've identified the first year programming courses as an area where there is room for improvement and we're considering (mainly on my suggestion) switching to using Python as the first programming language that we use to introduce our students to programming. I'm interested to know if anyone can share experience of a similar situation or can point to any case studies about this. The course is for ~100 1st year students with half studying Engineering Mathematics and the other half Electrical Engineering. Currently we introduce programming with C for the 1st semester and then C++ for the 2nd semester. In the 3rd semester they learn Matlab and following on from that they can take optional units run by the CS department in Java, Haskell and many more. Our faculty does not currently offer any Python courses for students at any level in CS or Engineering. Many of the students complain that the C course is too hard and my experience is that it doesn't equip them with the general understanding of programming that we really want them to get from the first programming course. I'm not sure about the Electrical Engineering students but the Engineering Mathematics students tend not to use C/C++ once they have covered Matlab and just use Matlab for all future projects, including in situations where it is highly inappropriate. In our recent meeting I proposed that Python should be the first programming language, and others proposed that Java should be the second. So we're currently evaluating the option of having Python in the first semester followed by Java in the second. Both courses would have to be created from scratch meaning that we would need to draw a complete outline and syllabus by mid-January in order to roll this out for the next academic year. I think that the benefits of this would be that using an easy language would be less distracting while we introduce the general concepts of programming. What we really want is for the students to focus on things like why would I write a program?, what kind of things can I do with a program? and how would I go about writing a program that does X?. Ideally by the end of the course we want that, given a description of a simple command line program that would perhaps calculate something or do some simple data processing, then the students would feel confident that they could do that. I think that using C distracts them from learning these more important general lessons as they struggle with simple things like how to print output, or avoid segmentation faults. Also ideally they would continue to use the language, where appropriate, for subsequent project work (which is when they would *really* learn the language). Some of the objections to the idea that were voiced in the meeting were that: 1) Some people felt that Python is not an industry standard unlike C/C++/Java and that it is not as good for employability. 2) Students should learn to program in a statically typed language because it leads to good programming discipline. 3) Python is too close to Matlab (which is considered essential for some industries our students often go in to). 4) It is better for students to be introduced to programming with a low-level language so that they gain a better understanding of how computers really work. 5) Learning to program should be painful and we should expect the students to complain about it (someone actually said that!) but the pain makes them better programmers in the end. I'm particularly interested to know if anyone can share experience of switching to teaching Python as a first programming language in a similar context. A written up case study that I could circulate among the relevant staff would be especially useful. Thanks in advance, Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Monday 09 December 2013 07:51:12 Oscar Benjamin did opine: Hi all, I work in a University Engineering faculty teaching, among other things, programming. In our last meeting about improving our teaching syllabus and delivery we've identified the first year programming courses as an area where there is room for improvement and we're considering (mainly on my suggestion) switching to using Python as the first programming language that we use to introduce our students to programming. I'm interested to know if anyone can share experience of a similar situation or can point to any case studies about this. The course is for ~100 1st year students with half studying Engineering Mathematics and the other half Electrical Engineering. Currently we introduce programming with C for the 1st semester and then C++ for the 2nd semester. In the 3rd semester they learn Matlab and following on from that they can take optional units run by the CS department in Java, Haskell and many more. Our faculty does not currently offer any Python courses for students at any level in CS or Engineering. Many of the students complain that the C course is too hard and my experience is that it doesn't equip them with the general understanding of programming that we really want them to get from the first programming course. I'm not sure about the Electrical Engineering students but the Engineering Mathematics students tend not to use C/C++ once they have covered Matlab and just use Matlab for all future projects, including in situations where it is highly inappropriate. In our recent meeting I proposed that Python should be the first programming language, and others proposed that Java should be the second. So we're currently evaluating the option of having Python in the first semester followed by Java in the second. Both courses would have to be created from scratch meaning that we would need to draw a complete outline and syllabus by mid-January in order to roll this out for the next academic year. I think that the benefits of this would be that using an easy language would be less distracting while we introduce the general concepts of programming. What we really want is for the students to focus on things like why would I write a program?, what kind of things can I do with a program? and how would I go about writing a program that does X?. Ideally by the end of the course we want that, given a description of a simple command line program that would perhaps calculate something or do some simple data processing, then the students would feel confident that they could do that. I think that using C distracts them from learning these more important general lessons as they struggle with simple things like how to print output, or avoid segmentation faults. Also ideally they would continue to use the language, where appropriate, for subsequent project work (which is when they would *really* learn the language). Some of the objections to the idea that were voiced in the meeting were that: 1) Some people felt that Python is not an industry standard unlike C/C++/Java and that it is not as good for employability. 2) Students should learn to program in a statically typed language because it leads to good programming discipline. 3) Python is too close to Matlab (which is considered essential for some industries our students often go in to). 4) It is better for students to be introduced to programming with a low-level language so that they gain a better understanding of how computers really work. 5) Learning to program should be painful and we should expect the students to complain about it (someone actually said that!) but the pain makes them better programmers in the end. I'm particularly interested to know if anyone can share experience of switching to teaching Python as a first programming language in a similar context. A written up case study that I could circulate among the relevant staff would be especially useful. Thanks in advance, Oscar I toss out that 1. a semester is insufficient to gain a working familiarity with either python or java. And neither should be introduced until a decent foundation has been laid. 2. If you want to start at the nuts and bolts level, (and you should) then nothing can compare with a semester or more in assembly language for an easy to learn 8/16 bit mcu like a 6809. IMO learning the Intel assembly for the 8088 and its git, or even the higher level motorola stuff is counter productive because they get lost in the details that are really best handled by a compiler. We actually have a reasonably complete, unix like OS for that mcu, used to be os9 30 years ago, migrated to community supported now and called Nitros9 as we have about doubled its speed over the original. I helped in its conversion to run on the smarter 6309, and I've written some of its lesser used drivers, like a serial mouse. Once they get the concept
Re: Programming puzzle with boolean circuits
On Mon, Dec 9, 2013 at 10:49 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: The question is: How do you design a boolean circuit that contains at most 2 NOT gates, but may contain as many AND or OR gates that inverts three inputs? IOW: Build three inverters by using only two inverters (and an infinite amount of AND/OR). I found this puzzle again and was thinking about: How would I code a brute-force approach to this problem in Python? Ooooh interesting! Well, here's a start: There's no value in combining the same value in an AND or an OR, ergo every gate you add must bring together two different values. To start with, you have three values (the three inputs). Every time you combine two of them, with either type of gate, you create a new value. You can also combine a single value with a NOT to create its inverse, but only if you have done so no more than once. The goal is to produce something which is provably the opposite of each of the three inputs. I'm not sure if this helps or not, but one thing I learned from geometry is that setting down everything you know and need to know is a good basis for the search! The hardest part, so far, is proving a result. The algorithm that's coming to mind is this: def find_solution(inputs, not_count): # TODO: First, see if inputs contains three values that are the inverses of # the three values i1,i2,i3. If they are, throw something, that's probably # the easiest way to unwind the stack. if not_count 2: for val in inputs: find_solution(inputs + [not val], not_count + 1) for val1 in inputs: for val2 in inputs: if val1 is not val2: find_solution(inputs + [val1 and val2], not_count) find_solution(inputs + [val1 or val2], not_count) find_solution([i1, i2, i3], 0) So, here's a crazy idea: Make i1, i2, i3 into objects of a type with an __eq__ that actually does the verification. Schrodinger's Objects: they might be True, might be False, and until you call __eq__, they're in both states. This probably isn't the best way, but I think it's the most fun! I couldn't make this work with the and/or/not operators, so I'm using the /|/~ operators, which can be overridden. So! There's the basics, but it's a depth-first search, which means it's bound to hit the recursion limit. Refinement needed; specifically, it needs to not add any input that's equal to any other. That's easy enough. Unfortunately I haven't been able to prove that the code works, because even with some changes it's taking way too long. But hey, it's a crazy fun piece to work with! class Schrodinger: def __init__(self, bit): self.state = bit def coalesce(self, master): return bool(master self.state) def __len__(self): return 1; def __invert__(self): return Negated(self) def __and__(self, other): return Anded((self, other)) def __or__(self, other): return Ored((self, other)) def __eq__(self, other): for master in range(8): if self.coalesce(master) != other.coalesce(master): return False return True def __repr__(self): return $%d % self.state class Negated(Schrodinger): def coalesce(self, master): return not self.state.coalesce(master) def __len__(self): return len(self.state) + 1 def __repr__(self): return not %r % self.state class Anded(Schrodinger): def coalesce(self, master): return self.state[0].coalesce(master) and self.state[1].coalesce(master) def __len__(self): return len(self.state[0]) + len(self.state[1]) + 1 def __repr__(self): return %r and %r % self.state class Ored(Schrodinger): def coalesce(self, master): return self.state[0].coalesce(master) or self.state[1].coalesce(master) def __len__(self): return len(self.state[0]) + len(self.state[1]) + 1 def __repr__(self): return %r or %r % self.state class SolutionFound(Exception): pass def find_solution(inputs, not_count): # First see if the newest input is equal to anything we already have. # If it is, we gain nothing by probing this. if inputs[-1] in inputs[:-1]: return # Then, see if inputs contains three values that are the inverses of # the three values i1,i2,i3. If they are, throw something, that's probably # the easiest way to unwind the stack. try: raise SolutionFound(Solution: ~$1 = %r ~$2 = %r ~$4 = %r % ( inputs[inputs.index(~inputs[0])], inputs[inputs.index(~inputs[1])], inputs[inputs.index(~inputs[2])], )) except ValueError: pass # ValueError means one of the negations wasn't found. if not_count 2: for val in inputs: find_solution(inputs + [~val], not_count + 1) for val1 in inputs: for val2 in inputs: find_solution(inputs + [val1 val2], not_count)
Re: Experiences/guidance on teaching Python as a first programming language
On Mon, Dec 9, 2013 at 11:23 PM, Oscar Benjamin oscar.j.benja...@gmail.com wrote: 1) Some people felt that Python is not an industry standard unlike C/C++/Java and that it is not as good for employability. Disprove that by checking any job listing site in your area/industry. You'll find plenty of Python jobs there. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Mon, Dec 9, 2013 at 8:24 AM, Gene Heskett ghesk...@wdtv.com wrote: On Monday 09 December 2013 07:51:12 Oscar Benjamin did opine: Hi all, I work in a University Engineering faculty teaching, among other things, programming. In our last meeting about improving our teaching syllabus and delivery we've identified the first year programming courses as an area where there is room for improvement and we're considering (mainly on my suggestion) switching to using Python as the first programming language that we use to introduce our students to programming. I'm interested to know if anyone can share experience of a similar situation or can point to any case studies about this. The course is for ~100 1st year students with half studying Engineering Mathematics and the other half Electrical Engineering. Currently we introduce programming with C for the 1st semester and then C++ for the 2nd semester. In the 3rd semester they learn Matlab and following on from that they can take optional units run by the CS department in Java, Haskell and many more. Our faculty does not currently offer any Python courses for students at any level in CS or Engineering. Many of the students complain that the C course is too hard and my experience is that it doesn't equip them with the general understanding of programming that we really want them to get from the first programming course. I'm not sure about the Electrical Engineering students but the Engineering Mathematics students tend not to use C/C++ once they have covered Matlab and just use Matlab for all future projects, including in situations where it is highly inappropriate. In our recent meeting I proposed that Python should be the first programming language, and others proposed that Java should be the second. So we're currently evaluating the option of having Python in the first semester followed by Java in the second. Both courses would have to be created from scratch meaning that we would need to draw a complete outline and syllabus by mid-January in order to roll this out for the next academic year. I think that the benefits of this would be that using an easy language would be less distracting while we introduce the general concepts of programming. What we really want is for the students to focus on things like why would I write a program?, what kind of things can I do with a program? and how would I go about writing a program that does X?. Ideally by the end of the course we want that, given a description of a simple command line program that would perhaps calculate something or do some simple data processing, then the students would feel confident that they could do that. I think that using C distracts them from learning these more important general lessons as they struggle with simple things like how to print output, or avoid segmentation faults. Also ideally they would continue to use the language, where appropriate, for subsequent project work (which is when they would *really* learn the language). Some of the objections to the idea that were voiced in the meeting were that: 1) Some people felt that Python is not an industry standard unlike C/C++/Java and that it is not as good for employability. 2) Students should learn to program in a statically typed language because it leads to good programming discipline. 3) Python is too close to Matlab (which is considered essential for some industries our students often go in to). 4) It is better for students to be introduced to programming with a low-level language so that they gain a better understanding of how computers really work. 5) Learning to program should be painful and we should expect the students to complain about it (someone actually said that!) but the pain makes them better programmers in the end. I'm particularly interested to know if anyone can share experience of switching to teaching Python as a first programming language in a similar context. A written up case study that I could circulate among the relevant staff would be especially useful. Thanks in advance, Oscar I toss out that 1. a semester is insufficient to gain a working familiarity with either python or java. And neither should be introduced until a decent foundation has been laid. 2. If you want to start at the nuts and bolts level, (and you should) then nothing can compare with a semester or more in assembly language for an easy to learn 8/16 bit mcu like a 6809. IMO learning the Intel assembly for the 8088 and its git, or even the higher level motorola stuff is counter productive because they get lost in the details that are really best handled by a compiler. We actually have a reasonably complete, unix like OS for that mcu, used to be os9 30 years ago, migrated to community supported now and called Nitros9 as we have about doubled its speed over the original. I helped in its conversion to run on the smarter 6309, and I've written some of its
Re: One liners
On 2013-12-07, Dan Stromberg drsali...@gmail.com wrote: BTW, what's pipelining style? Like bash? I think, in Python, it might refer to composing your program of a series of generators. names = (p.name for p in db.query_people() if p.total_purchases 0) names = (n.upper() for n in names) names = (n for n in names if not n.startswith(Q)) for n in names: # Finally actually do something. Coincidentally it's a nice way to break up an ugly one-liner. I also really like that if I choose to no longer filter out customers whose name begins with Q, I can just comment out that one line. Try doing that with the one-liner version! I'm pleased to see Python getting more popular, but it feels like a lot of newcomers are trying their best to turn Python into Perl or something, culturally speaking. They're probably writing code using the idioms they are used to from whatever language they have come from. Newcomers nearly always do this. The more newcomers you get, the less Pythonic the code you're going to see from them. Nod. That's the sound of practicality slapping purity with a fish. A new Python programmer can generally just get her code working in a fairly comfortable way, then possibly rewrite it once her first few programs become horrifying years later. I haven't found time to rewrite all of mine yet. I still have a program I use almost every day with an __init__ that returns invalid objects but helpfully sets self.valid to 0. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Monday, December 9, 2013 5:53:41 PM UTC+5:30, Oscar Benjamin wrote: Hi all, I work in a University Engineering faculty teaching, among other things, programming. In our last meeting about improving our teaching syllabus and delivery we've identified the first year programming courses as an area where there is room for improvement and we're considering (mainly on my suggestion) switching to using Python as the first programming language that we use to introduce our students to programming. I'm interested to know if anyone can share experience of a similar situation or can point to any case studies about this. 1 Some Background = Early in my teaching career - 1988 -- I experienced what it means to switch from Pascal to Scheme to teach programming. And in 2002 I swtiched to using python. I may talk a bit about this but before that… 2 Some Philosophical Context Some years ago I read in a book (I think it was called Heart of Philosophy) about the difference between 'ideas' and 'concepts.' Ideas are large vague touchy-feely things like freedom, love, justice etc; things that matter but poets deal with better than intellectuals. Concepts are the basic currency for an academic. In a typical 1-hour class you deal with a few and in a lifetime you deal with thousands; in short they are a dime a dozen -- especially if you are an academic. And yet if you have a conscience you'd know that covering the concepts specified in a formal printed syllabus is cheating. What really needs to be conveyed are a few ideas: - modular code - code invariants - abstractions - Syntax, semantics and the large grey in between which for want of a better word we may call 'structure' - Recursion much wider than people think see http://blog.languager.org/2012/05/recursion-pervasive-in-cs.html - Interpretation see http://blog.languager.org/2013/08/applying-si-on-sicp.html - Computable and non-computable - The meaning and significance of the word 'code' - (Even more vaguely) beautiful (and ugly) code Before reading on, I suggest you think what for a while what for you are important/core ideas and then what vehicles/mediums are conducive/obstructive to them. 3 My Prejudices === Historically I've been associated with functional programming. While I am not so passionate about it as when I was half my age. still I'd say: - FP *as a philosophy* collects a bunch of stuff -- technology, practices, culture -- that conduces to good programming even for kids who after the course never use FP *as a technology* See http://blog.languager.org/2012/10/functional-programming-lost-booty.html - By contrast OOP is mostly (at best) clerical common sense -- organizing libraries to be easily searchable is better by data than by code. At worst OOP is hogwash -- inheritance. And so… - Python which can be quite functional, imperative and object oriented has a rather special place. Because it is object oriented you will be able to use it to silence those who are subscribed to that religion. Because it is imperative you can write straightforward code -- 'scripts' -- without undue fanfare Because it is functional (well almost -- I have some beefs in this regard) you can use it as a vehicle to actually convey important *ideas* in short space and time - For me Lisp (closely followed by APL) are the ultimate in programming paradigms. However they are not serious technology in 2013. [Even the birthplace of Scheme -- MIT -- has switched to python]. And so in 2013 python occupies a sweet spot in the sense of being academically clean and realistically usable. - That said there are some important elements of FPLs, most notably a polymorphic type discipline, that are sorely missing from python. Unfortunately Haskell is much harder to teach/learn than python and with each new addition only gets harder. So python remains even with its lacks, an academically sound language. 4 CS-Edu Writings = My CS-101 syllabus from the early 90s -- uses gofer a predecessor of a predecessor of Haskell http://www.the-magus.in/Publications/ip.pdf Some more general CS-Edu related writings, containing strewn about FP is a good idea http://blog.languager.org/2011/02/cs-education-is-fat-and-weak-1.html and following 2 posts -- रुसि मोदि [Rusi Mody in devanagari so that GG will not use an obsolete charset] -- https://mail.python.org/mailman/listinfo/python-list
Re: One liners
On Tue, Dec 10, 2013 at 12:49 AM, Neil Cerutti ne...@norwich.edu wrote: names = (p.name for p in db.query_people() if p.total_purchases 0) names = (n.upper() for n in names) names = (n for n in names if not n.startswith(Q)) for n in names: # Finally actually do something. Coincidentally it's a nice way to break up an ugly one-liner. I also really like that if I choose to no longer filter out customers whose name begins with Q, I can just comment out that one line. Try doing that with the one-liner version! # With the restriction: for n in (p.name.upper() for n in names if not n.startswith(Q)): # Without the restriction: for n in (p.name.upper() for n in names ):# if not n.startswith(Q)): You just have to use the special comment-out-partially operator, which looks like ):# and is inspired by some kind of insane smiley with weird hair. ChrisA (Anyone got the cheek de-tonguer handy?) -- https://mail.python.org/mailman/listinfo/python-list
Re: squeeze out some performance
Am Samstag, 7. Dezember 2013 00:01:49 UTC+1 schrieb Dan Stromberg: On Fri, Dec 6, 2013 at 2:38 PM, Mark Lawrence bream...@yahoo.co.uk wrote: On 06/12/2013 16:52, John Ladasky wrote: On Friday, December 6, 2013 12:47:54 AM UTC-8, Robert Voigtländer wrote: I try to squeeze out some performance of the code pasted on the link below. http://pastebin.com/gMnqprST Several comments: 1) I find this program to be very difficult to read, largely because there's a whole LOT of duplicated code. Look at lines 53-80, and lines 108-287, and lines 294-311. It makes it harder to see what this algorithm actually does. Is there a way to refactor some of this code to use some shared function calls? A handy tool for detecting duplicated code here http://clonedigger.sourceforge.net/ for anyone who's interested. Pylint does this too... Thanks again. I'll try to compress the code and have a look at the multiple comparisons topic. Robert -- https://mail.python.org/mailman/listinfo/python-list
Re: squeeze out some performance
On 09/12/2013 14:19, Robert Voigtländer wrote: Am Samstag, 7. Dezember 2013 00:01:49 UTC+1 schrieb Dan Stromberg: On Fri, Dec 6, 2013 at 2:38 PM, Mark Lawrence bream...@yahoo.co.uk wrote: On 06/12/2013 16:52, John Ladasky wrote: On Friday, December 6, 2013 12:47:54 AM UTC-8, Robert Voigtländer wrote: I try to squeeze out some performance of the code pasted on the link below. http://pastebin.com/gMnqprST Several comments: 1) I find this program to be very difficult to read, largely because there's a whole LOT of duplicated code. Look at lines 53-80, and lines 108-287, and lines 294-311. It makes it harder to see what this algorithm actually does. Is there a way to refactor some of this code to use some shared function calls? A handy tool for detecting duplicated code here http://clonedigger.sourceforge.net/ for anyone who's interested. Pylint does this too... Thanks again. I'll try to compress the code and have a look at the multiple comparisons topic. Robert Would you be kind enough to compress your messages while you're at it by reading and actioning https://wiki.python.org/moin/GoogleGroupsPython thanks, a quick glance above will tell you why :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On 09/12/2013 10:12, Ian Kelly wrote: On Sun, Dec 8, 2013 at 4:01 PM, Mark Janssen dreamingforw...@gmail.com wrote: Likewise, WITH A COMPUTER, there is a definite order which can't be countermanded by simply having this artifice called Object. If you FEE(L)s hadn't noticed (no longer using the insult foos out of respect for the sensativities of the brogrammers), this artifice has just been *called on the floor* with this little innocent question that fired up this discussion again (don't hate the messenger). Again: people entering the community are pointing out a problem -- that Object is both trying to be the BASE and the SUPERclass of all objects. You're mixing two different terminologies. Whereas superclass contrasts with subclass and connotes an imaginary spatial relationship, base contrasts with derived (not top), which pairing does not suggest any spatial relationship at all. There is no inconsistency in that these two words happen to mean the same thing. Likewise it doesn't matter whether we draw class hierarchies from the top down or the bottom up or even sidewise: Have you caught it by now, friends: IT MATTERS TO THE COMPUTER. No, I'm pretty sure the computer doesn't care one whit whether the inheritance hierarchy that I scribble on a random sheet of paper happens to be represented as top-down, bottom-up, left-right, right-left, center-out, ana-kata, or using any other conceivable spatial relationship that I may have omitted. The computer only cares (inasmuch as I'm willing to personify it) about the actual *code* that I feed into it. How the programmer abstracts or visualizes that code is irrelevant. MASCOT is the One True Way http://en.wikipedia.org/wiki/Modular_Approach_to_Software_Construction_Operation_and_Test -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Meta Fight About Posting (was: python programming help)
On Dec 9, 2013, at 1:34 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 09/12/2013 05:07, ru...@yahoo.com wrote: On 12/08/2013 05:27 PM, Mark Lawrence wrote: On 09/12/2013 00:08, ru...@yahoo.com wrote: On 12/08/2013 12:17 PM, Chris Angelico wrote: On Mon, Dec 9, 2013 at 6:06 AM, rafaella...@gmail.com wrote:[...] [...] To the OP, please ignore the above, it's sheer, unadulterated rubbish. Nobody has ever been bullied into doing anything. People have however been asked repeatedly to either A) use the link referenced above to avoid sending double spaced crap here from the inferior google groups product or B) use an alternative technology that doesn't send double spaced crap. Mark, I appreciate your calm and reasonable requests for people to checkout the page you gave a link to, that's why I repeated your advice. It is also why I responded to Chris and not to you. However it does not change the fact that people here have responded in rather extreme way to GG posts including calling GG users twits and claiming GG posts damage their eyesight, as well as repeatedly denying the obvious fact that GG is much easier to use for many than to subscribe to a usenet provider or to a mailing list. One frequently sees words like crap, slimy, rubbish etc to describe GG posts which is pretty intimating to people who just want some help with a python question using a tool they already know how to use and have had no complaints about in other places. Well you can ask iMath, amongst others, not to send double spaced google nonsense. They've been asked repeatedly, politely, but apparently have no consideration at all for people who have no interest in seeing this ill formed dross spread throughout web land. As long as we’re in full scale rant drift, I’d like to remind others of the time honored tradition of changing the post subject, when, er, uh, the subject changes. Because this obviously is not programming help anymore. The python mailing list is the only one I know of that is cross posted between 3 different technologies. Maybe it’s an outgrowth of the “multi paradigm” philosophy of python or something. It would be an interesting experiment, to shut down the cross forum replication engines for a month. Personally, I think they should each thrive, or die, on their own. If there’s enough mass on the groups to answer the occasional one off question, it’ll go on, indifferent of the existence of the mailing list. Comp.lang.python can truly become a troll haven. :) And the mailing list can be for the more thorough threads, or something. If you’re worried about “fragmentation”… these weekly rants seem to indicate it’s happened anyway, and the impedance mismatch between styles/technologies/formats is generating more heat from friction than it is contributing light to the cross-sharing. Besides, there’s nothing stopping periodic posts being sent to any of the sites saying “by the way, did you know there’s also a mailing list…” The nice thing about doing it for a month (or so), is that it’s not a “huge disturbance in the force.” If it stinks, you turn them back on in a month (or so). tongue in=“cheek”If you’re still not sold, and find yourself solidly in the “keep it all together” group, I propose, we embrace that idea, and set up a bi-directional engine between the IRC channel (which I’ve found very helpful often) and the mailing list. / -- https://mail.python.org/mailman/listinfo/python-list
Re: squeeze out some performance
On 06/12/2013 22:07, Joel Goldstick wrote: .. Not that this will speed up your code but you have this: if not clockwise: s = start start = end end = s Python people would write: end, start = start, end this works for some small number of variables, but on my machine with python 2.7 I start losing with 4 variables eg C:\code\optichrome\74663python -mtimeit -sa=1;b=2;c=3;d=4 a,b,c,d=b,c,d,a 100 loops, best of 3: 0.206 usec per loop C:\code\optichrome\74663python -mtimeit -sa=1;b=2;c=3;d=4 t=a;a=b;b=c;c=d;d=t 1000 loops, best of 3: 0.118 usec per loop It doesn't seem to make much difference that the variables are related as I see a similar behaviour for simple assignments C:\code\optichrome\74663python -mtimeit -sa=1;b=2;c=3;d=4;e=5;f=6;g=7;h=8 a,b,c,d=e,f,g,h 100 loops, best of 3: 0.204 usec per loop C:\code\optichrome\74663python -mtimeit -sa=1;b=2;c=3;d=4;e=5;f=6;g=7;h=8 a=e;b=f;c=g;d=h 1000 loops, best of 3: 0.103 usec per loop for less than 4 variables the tuple method is faster. -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
In article mailman.3776.1386595668.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Mon, Dec 9, 2013 at 11:23 PM, Oscar Benjamin oscar.j.benja...@gmail.com wrote: 1) Some people felt that Python is not an industry standard unlike C/C++/Java and that it is not as good for employability. Disprove that by checking any job listing site in your area/industry. You'll find plenty of Python jobs there. ChrisA I have access to the resume search feature on careers.stackoverflow.com. Just for fun, I ran the following searches (for skills advertised by people who have listed their resumes): C1k C++ 1.3k Java 1.7k Python 1.2k The search qualifiers were within 200 miles of the United States, legal right to work here required, full time, exclude students, and, only active candidates. Not sure what the proves, other than these are the languages people who are looking for jobs know (or at least claim to know). -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Monday 09 December 2013 10:46:42 Larry Martell did opine: On Mon, Dec 9, 2013 at 8:24 AM, Gene Heskett ghesk...@wdtv.com wrote: On Monday 09 December 2013 07:51:12 Oscar Benjamin did opine: Hi all, I work in a University Engineering faculty teaching, among other things, programming. In our last meeting about improving our teaching syllabus and delivery we've identified the first year programming courses as an area where there is room for improvement and we're considering (mainly on my suggestion) switching to using Python as the first programming language that we use to introduce our students to programming. I'm interested to know if anyone can share experience of a similar situation or can point to any case studies about this. The course is for ~100 1st year students with half studying Engineering Mathematics and the other half Electrical Engineering. Currently we introduce programming with C for the 1st semester and then C++ for the 2nd semester. In the 3rd semester they learn Matlab and following on from that they can take optional units run by the CS department in Java, Haskell and many more. Our faculty does not currently offer any Python courses for students at any level in CS or Engineering. Many of the students complain that the C course is too hard and my experience is that it doesn't equip them with the general understanding of programming that we really want them to get from the first programming course. I'm not sure about the Electrical Engineering students but the Engineering Mathematics students tend not to use C/C++ once they have covered Matlab and just use Matlab for all future projects, including in situations where it is highly inappropriate. In our recent meeting I proposed that Python should be the first programming language, and others proposed that Java should be the second. So we're currently evaluating the option of having Python in the first semester followed by Java in the second. Both courses would have to be created from scratch meaning that we would need to draw a complete outline and syllabus by mid-January in order to roll this out for the next academic year. I think that the benefits of this would be that using an easy language would be less distracting while we introduce the general concepts of programming. What we really want is for the students to focus on things like why would I write a program?, what kind of things can I do with a program? and how would I go about writing a program that does X?. Ideally by the end of the course we want that, given a description of a simple command line program that would perhaps calculate something or do some simple data processing, then the students would feel confident that they could do that. I think that using C distracts them from learning these more important general lessons as they struggle with simple things like how to print output, or avoid segmentation faults. Also ideally they would continue to use the language, where appropriate, for subsequent project work (which is when they would *really* learn the language). Some of the objections to the idea that were voiced in the meeting were that: 1) Some people felt that Python is not an industry standard unlike C/C++/Java and that it is not as good for employability. 2) Students should learn to program in a statically typed language because it leads to good programming discipline. 3) Python is too close to Matlab (which is considered essential for some industries our students often go in to). 4) It is better for students to be introduced to programming with a low-level language so that they gain a better understanding of how computers really work. 5) Learning to program should be painful and we should expect the students to complain about it (someone actually said that!) but the pain makes them better programmers in the end. I'm particularly interested to know if anyone can share experience of switching to teaching Python as a first programming language in a similar context. A written up case study that I could circulate among the relevant staff would be especially useful. Thanks in advance, Oscar I toss out that 1. a semester is insufficient to gain a working familiarity with either python or java. And neither should be introduced until a decent foundation has been laid. 2. If you want to start at the nuts and bolts level, (and you should) then nothing can compare with a semester or more in assembly language for an easy to learn 8/16 bit mcu like a 6809. IMO learning the Intel assembly for the 8088 and its git, or even the higher level motorola stuff is counter productive because they get lost in the details that are really best handled by a compiler. We actually have a reasonably complete, unix like OS for that mcu, used to be os9 30 years ago, migrated to community supported
Re: Experiences/guidance on teaching Python as a first programming language
On Tue, Dec 10, 2013 at 3:06 AM, Roy Smith r...@panix.com wrote: Not sure what the proves, other than these are the languages people who are looking for jobs know (or at least claim to know). That's the converse of what I was talking about. Employability of a skill depends on how many employers are looking for that skill; sightings on resumes aren't quite that. But since people will put on their resumes what they think employers will actually care about (mine doesn't mention my ability to use Q-BASIC's CALL ABSOLUTE command to make use of a mouse), they're going to be at least somewhat connected. Of course, it might be that stackoverflow careers attracts Python programmers and something else attracts C programmers, but unless there's some really major skew, I'd say it's still at least somewhat valid to point to that and show that Python matters to employment. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Meta Fight About Posting (was: python programming help)
On Monday, December 9, 2013 9:14:08 PM UTC+5:30, Travis Griggs wrote: As long as we’re in full scale rant drift, I’d like to remind others of the time honored tradition of changing the post subject, when, er, uh, the subject changes. Because this obviously is not programming help anymore. snipped I believe you are missing what's actually at issue here. Lets just look at this thread: New poster asks help for a homework problem without saying so Different list members express concern/annoyance with this [NO technological (3 different technologies) issues here yet] This -- annoyance+answers -- continues for while until it morphs into GG-annoyance The *context* of the earlier annoyance -- kid asking for homework help without clearly saying so -- is lost in the GG annoyance. Now GG is clearly annoying As are kids who ask for homework help without saying so ¿¿Whats the connection?? -- https://mail.python.org/mailman/listinfo/python-list
Re: Meta Fight About Posting (was: python programming help)
On Monday, December 9, 2013 9:55:19 PM UTC+5:30, rusi wrote: On Monday, December 9, 2013 9:14:08 PM UTC+5:30, Travis Griggs wrote: As long as we’re in full scale rant drift, I’d like to remind others of the time honored tradition of changing the post subject, when, er, uh, the subject changes. Because this obviously is not programming help anymore. I believe you are missing what's actually at issue here. Lets just look at this thread: New poster asks help for a homework problem without saying so Different list members express concern/annoyance with this [NO technological (3 different technologies) issues here yet] This -- annoyance+answers -- continues for while until it morphs into GG-annoyance The *context* of the earlier annoyance -- kid asking for homework help without clearly saying so -- is lost in the GG annoyance. Now GG is clearly annoying As are kids who ask for homework help without saying so ¿¿Whats the connection?? I should have mentioned/asked: Are you using Google Groups to post? Your post suffers from one of GG's annoyances – long lines. If you are using it then I wonder about the *content* of your complaint If you are not – and the *form* of your post still has a classic-GG nuisance – then it weakens the anti-GG case. -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Monday, December 9, 2013 5:53:41 PM UTC+5:30, Oscar Benjamin wrote: 5) Learning to program should be painful and we should expect the students to complain about it (someone actually said that!) but the pain makes them better programmers in the end. Yeah this will get some people's back up -- Atrocious! Preposterous! etc Change the word 'pain' to 'taxing' 'hard' 'challenge' etc and there is much truth in it. Here is Joel Spolsky on why Java is a poor language for this reason: http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html -- https://mail.python.org/mailman/listinfo/python-list
Re: multiprocessing: child process share changes to global variable
I received a suggestion off list that my results indicated that the jobs were not being distributed across the pool workers. I used mp.current_process().name to confirm this suggestion. Alan Isaac -- https://mail.python.org/mailman/listinfo/python-list
Re: ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')'
On 09/12/2013 09:32, Daniel Watkins wrote: On Mon, Dec 09, 2013 at 12:41:57AM -0800, Jai wrote: sql = insert into `category` (url, catagory,price) VAlUES ('%s', '%s', '%s')%(link1,x,y) sql = unicodedata.normalize('NFKD', sql).encode('ascii','ignore') cursor.execute(sql) ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')' at line 1) Though you haven't given the full traceback, I suspect that the lines above are what is causing your problem. My best guess is that you're being hit by a form of SQL injection[0], in that the values you are combining in to your query have single quotes which are resulting in an SQL statement that looks like: insert into `category` (url, category, price) VALUES ('...', 'MEN'S SIZE 11.5 NEW IN BOX', '$49.99'); As you can see, the second value you are passing has mismatched quotes. This is a common problem, so the MySQLdb library handles it by allowing you to pass in the values you want to cursor.execute; it then takes care of escaping them correctly: sql = insert into `category` (url, catagory,price) VAlUES ('%s', '%s', '%s') cursor.execute(sql, (link1, x, y)) You shouldn't put quotes around the placeholders: sql = insert into `category` (url, catagory,price) VAlUES (%s, %s, %s) cursor.execute(sql, (link1, x, y)) I'm not 100% sure what the Unicode normalisation is meant to be doing, so you'll have to work out how to integrate that yourself. Cheers, Dan [0] https://en.wikipedia.org/wiki/SQL_injection -- https://mail.python.org/mailman/listinfo/python-list
Re: Meta Fight About Posting (was: python programming help)
In article 058a0d03-4017-4e95-b402-94d8959ec...@googlegroups.com, rusi rustompm...@gmail.com wrote: On Monday, December 9, 2013 9:14:08 PM UTC+5:30, Travis Griggs wrote: As long as we¹re in full scale rant drift, I¹d like to remind others of the time honored tradition of changing the post subject, when, er, uh, the subject changes. Because this obviously is not programming help anymore. snipped I believe you are missing what's actually at issue here. Lets just look at this thread: New poster asks help for a homework problem without saying so While it's good nettiquette, I suppose, to state that your question is about a homework problem, it's rarely necessary. They pretty much announce themselves :-) -- https://mail.python.org/mailman/listinfo/python-list
Re: Meta Fight About Posting (was: python programming help)
In article mailman.3782.1386604348.18130.python-l...@python.org, Travis Griggs travisgri...@gmail.com wrote: The python mailing list is the only one I know of that is cross posted between 3 different technologies. Maybe it¹s an outgrowth of the ³multi paradigm² philosophy of python or something. Usenet is not a bicycle. -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Dec 9, 2013, at 11:57 AM, rusi rustompm...@gmail.com wrote: On Monday, December 9, 2013 5:53:41 PM UTC+5:30, Oscar Benjamin wrote: 5) Learning to program should be painful and we should expect the students to complain about it (someone actually said that!) but the pain makes them better programmers in the end. Yeah this will get some people's back up -- Atrocious! Preposterous! etc Change the word 'pain' to 'taxing' 'hard' 'challenge' etc and there is much truth in it. Here is Joel Spolsky on why Java is a poor language for this reason: http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html -- https://mail.python.org/mailman/listinfo/python-list I'm not sure I agree with either of these points of view. Based on my own personal experience, there is an Ah HA! moment[*] when a student understands what it means to decompose a problem into a series of algorithmic steps - after that, the details of the particular programming language are just that, details. Some students get that quickly and intuitively and some never get there, but that bit of fundamental understanding doesn't require either pain or (necessarily) hard work - it just requires adopting a way of approaching and thinking about problems, a mind-set. -Bill * For me it came during a no-credit, no-cost, lunch-time course one of my college math teachers offered for anyone who was interested. The year was 1963, we used McCracken's FORTRAN book as our text, and tested our programs over open weekends at Argonne National Lab, where they had an IBM 1620 they opened to classes like ours a couple of times a month. -- https://mail.python.org/mailman/listinfo/python-list
noobie needs help with ctypes
I'm using python 2.6 on Linux/CentOs 6.x I'm getting ctypes to work, but getting stuck on the use of .argtypes. Can someone point out what I'm doing. This is my first use of ctypes and it looks like I'm getting different definitions in stackoverflow that may correspond to different version of python. Here is my code. Without the restype/argtypes it works, but I cannot figure out how to define argtypes to match the data. mylibrary = ctypes.CDLL(LIBRARY_PATH) mdsconvert = mylibrary.RugVersionConverter mdsconvert.restype = ctypes.c_int mdsconvert.argtypes = [ charptr, #flat buffer of mds 3.0 data ctypes.c_buffer, #computed flat buffer of mds 2.0 data ctypes.c_buffer #version set to 1.00.4 in c++, never used ] def convertMds2to3(mds30buffer): mds20 = ctypes.create_string_buffer('\000'*3000) t = ctypes.create_string_buffer('\000'*30) success = mdsconvert(mds30buffer, ctypes.byref(mds20), ctypes.byref(t) ) print 'convert %s to %s success=%s version=%s' % (len(mds30buffer), len(mds20.value), success, t.value) return mds20.value --- C++ code looks like this --- extern C int RugVersionConverter( char * sInputRecord, char * MDS2_Rec, char * Version ); where sInputRecord is input and MDS2_Rec and Version are output. -- https://mail.python.org/mailman/listinfo/python-list
problem with graph of python(show)
hi everybody i recently install python vpython(v:2.6.7) in my windows(32bit) it install succesfully but dont show some of graphes that involved their code in the lib.python , i dont know what s problem... please giude me thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: problem with graph of python(show)
On 09/12/2013 19:34, Asemaneh Allame wrote: hi everybody i recently install python vpython(v:2.6.7) in my windows(32bit) it install succesfully but dont show some of graphes that involved their code in the lib.python , i dont know what s problem... please giude me thanks By an amazing coincidence I don't know what your problem is, either. I also suspect no other reader knows what your problem is. So if you'd be kind enough to tell us what you've tried, what you expected to happen, and what actually happened, then it's fairly certain that somebody here will be able to help you. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On 12/9/2013 7:23 AM, Oscar Benjamin wrote: Hi all, I work in a University Engineering faculty teaching, among other things, programming. In our last meeting about improving our teaching syllabus and delivery we've identified the first year programming courses as an area where there is room for improvement and we're considering (mainly on my suggestion) switching to using Python as the first programming language that we use to introduce our students to programming. I'm interested to know if anyone can share experience of a similar situation or can point to any case studies about this. A few years ago, MIT switched from Scheme (which I believe originated at MIT) to Python for its first course. There might faculty blogs discussing the reasons. In any case, the course is one of MIT's free online offerings. There is a draft of a syllabus for your school. Certainly, most of the concept taught in the current C course could be taught with Python instead. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: noobie needs help with ctypes
On 12/9/2013 2:24 PM, Sells, Fred wrote: I'm using python 2.6 on Linux/CentOs 6.x I would use the latest 2.7 (or 3.3) for a new project if at all possible. I'm getting ctypes to work, but getting stuck on the use of .argtypes. Can someone point out what I'm doing. This is my first use of ctypes and it looks like I'm getting different definitions in stackoverflow that may correspond to different version of python. In particular, I am sure that there have been bugfixes for ctypes. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Programming puzzle with boolean circuits
On Mon, Dec 9, 2013 at 6:49 AM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: Hi group, it's somewhat OT here, but I have a puzzle to which I would like a solution -- but I'm unsure how I should tackle the problem with Python. But it's a fun puzzle, so maybe it'll be appreciated here. The question is: How do you design a boolean circuit that contains at most 2 NOT gates, but may contain as many AND or OR gates that inverts three inputs? IOW: Build three inverters by using only two inverters (and an infinite amount of AND/OR). Surprisingly, this is possible (and I even know the solution, but won't give it away just yet). I found this puzzle again and was thinking about: How would I code a brute-force approach to this problem in Python? And to my surprise, it isn't as easy as I thought. So I'm looking for some advice from you guys (never huts to improve ones coding skills). Best regards, Johannes I studied Electrical Engineering in college, so this puzzle grabbed my attention. For a couple of hours I played around thinking about how to attack this problem My first thought was that if you had two inverters (NOT gates), you needed to create an inverter with and and or gates. That goes nowhere. So, I googled around and found this: http://www.thelowlyprogrammer.com/2008/05/not-puzzle-solution.html (spoiler alert). It discusses how you can solve the problem, but it doesn't give python code. As it ends up I implemented that solution in 18 lines of code So, my hint is that it can be solved by creating several simultaneous equations I'll send my code along if someone asks, but I don't want to post it here because I'm sure others will want to figure it out on their own. -- Wo hattest Du das Beben nochmal GENAU vorhergesagt? Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa hidbv3$om2$1...@speranza.aioe.org -- https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: noobie needs help with ctypes
On Mon, Dec 9, 2013 at 3:15 PM, Terry Reedy tjre...@udel.edu wrote: On 12/9/2013 2:24 PM, Sells, Fred wrote: I'm using python 2.6 on Linux/CentOs 6.x I would use the latest 2.7 (or 3.3) for a new project if at all possible. I seem to recall that Centos needs 2.6 as default python for its own purposes, so you need to install another version without messing with 2.6. VirtualEnv might help. I'm getting ctypes to work, but getting stuck on the use of .argtypes. Can someone point out what I'm doing. This is my first use of ctypes and it looks like I'm getting different definitions in stackoverflow that may correspond to different version of python. In particular, I am sure that there have been bugfixes for ctypes. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Possible PEP Submission
Just checking whether 1) a PEP is the proper place for this and 2) what y'all think about it. I would like to propose a change to the the 're' standard library to support iterables. So, something like the following would work: import re text = hello user hello user hello user users = [Bob, Alice, Jeffery] newtext = re.sub(user, users, text) # newtext = hello Bob\nhello Alice\nhello Jeffery There are a few corner cases I'm not sure what would be the best behavior. Nor am I entirely certain this should be modified functionality or just... a new function. What do y'all think? -- ---Logan Collins GPG Public Key 2AAE8775 0xfc1185c82aae8775 http://keyserver.ubuntu.com:11371/pks/lookup?op=getsearch=0xFC1185C82AAE8775 -- https://mail.python.org/mailman/listinfo/python-list
Spoiler alert? (Re: Programming puzzle with boolean circuits)
It has been ages since I've thought about logic gates, but... (Spoiler alert? I'm not sure...) . . . . . . . . . . . . . . . . My thought is that with two NOT logic gates, you can only build a flip-flop memory circuit. That strongly suggests to me that a memory circuit would actually be used to solve the problem somehow. I'm thinking that feedback loops would have to be involved, no matter what the solution is. A need for feedback loops would make it very hard to write code to look for the solution automatically. The dimensionality of the search space will be high. -- https://mail.python.org/mailman/listinfo/python-list
Re: squeeze out some performance
On Mon, 09 Dec 2013 15:54:36 +, Robin Becker ro...@reportlab.com wrote: On 06/12/2013 22:07, Joel Goldstick wrote: end, start = start, end a similar behaviour for simple assignments for less than 4 variables the tuple method is faster. What does speed have to do with it? When you want to swap two variables, the tuple assignment reads better. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Spoiler alert? (Re: Programming puzzle with boolean circuits)
On Mon, Dec 9, 2013 at 3:39 PM, John Ladasky john_lada...@sbcglobal.netwrote: It has been ages since I've thought about logic gates, but... My thought is that with two NOT logic gates, you can only build a flip-flop memory circuit. That strongly suggests to me that a memory circuit would actually be used to solve the problem somehow. Two NOT gates plus as many AND and OR gates as you need. I'm thinking that feedback loops would have to be involved, no matter what the solution is. A need for feedback loops would make it very hard to write code to look for the solution automatically. The dimensionality of the search space will be high. -- https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On 12/9/2013 7:23 AM, Oscar Benjamin wrote: [snip] I'm interested to know if anyone can share experience of a similar situation or can point to any case studies about this. Taking the opposite perspective from Gene: I think Python is great as an intro to computing and programming. Give a student a tool with which he can be productive quickly. and with minimal effort. Understanding the real machine may be of interest to some but is not essential .I'd make that later and optional. Do you teach potential drivers how the engine works before letting them drive? Caution: having listened to many students express their suffering on these lists I recommend: beta test any course before putting it into production. be sure you give the student what he needs to understand and take the next step. be sure your instructors are willing to help the students. it is, after all, the job of the instructor to ensure the student succeeds. -- https://mail.python.org/mailman/listinfo/python-list
Re: Possible PEP Submission
On 2013-12-09 14:36, Logan Collins wrote: Just checking whether 1) a PEP is the proper place for this and 2) what y'all think about it. I would like to propose a change to the the 're' standard library to support iterables. So, something like the following would work: import re text = hello user hello user hello user users = [Bob, Alice, Jeffery] newtext = re.sub(user, users, text) # newtext = hello Bob\nhello Alice\nhello Jeffery There are a few corner cases I'm not sure what would be the best behavior. Nor am I entirely certain this should be modified functionality or just... a new function. What do y'all think? Well, it's not that hard to do in stock python: i = itertools.cycle(users) print re.sub( 'user', lambda m: next(i), text ) which should handle both the fewer matches than items in users case, as well as wrap around in the more matches than items in users case. If you don't want wrap-around, just use iter(users) instead of itertools.cycle(users) This could be wrapped up in some class to give it a clearer name, but I'm not sure it's worth doing a PEP or even including it in the standard library. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: Possible PEP Submission
On 09/12/2013 20:36, Logan Collins wrote: Just checking whether 1) a PEP is the proper place for this and 2) what y'all think about it. I would like to propose a change to the the 're' standard library to support iterables. So, something like the following would work: import re text = hello user hello user hello user users = [Bob, Alice, Jeffery] newtext = re.sub(user, users, text) # newtext = hello Bob\nhello Alice\nhello Jeffery There are a few corner cases I'm not sure what would be the best behavior. Nor am I entirely certain this should be modified functionality or just... a new function. What do y'all think? What's your use-case? How often would someone want to do this? Here's a way of doing it without adding to the re module: import re text = hello user hello user hello user class Replacement: def __init__(self, users): self.users = users self.index = -1 def __call__(self, m): self.index += 1 return self.users[self.index] users = [Bob, Alice, Jeffery] newtext = re.sub(user, Replacement(users), text) # newtext = hello Bob\nhello Alice\nhello Jeffery print(newtext) The search string is a simple literal, so another way is: from itertools import chain text = hello user hello user hello user users = [Bob, Alice, Jeffery] # newtext = hello Bob\nhello Alice\nhello Jeffery newtext = .join(chain(*zip(text.split(user, len(users)), users))) print(newtext) -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
In article mailman.3797.1386622419.18130.python-l...@python.org, bob gailer bgai...@gmail.com wrote: Understanding the real machine may be of interest to some but is not essential. Surprisingly (to myself, anyway), I agree. Languages like C, Fortran, and Java, are fairly close to the machine. They all expose (C more than the others) fundamental machine features such as hardware data types (various sizes of ints and floats) and addresses. Understanding how a computer works gives you added understanding of how the higher level language you're using works. But, Python operates at a higher level of abstraction. In a sense, understanding how a computer works is a hinderance to learning Python. Look at all the beginner questions we get regarding what a = 47 means in Python. People have a mental picture of a 32-bit (or maybe 64-bit) integer value 47 being placed into some pre-allocated memory location, and that interferes with their understanding of what's really happening in Python. Likewise, they have incorrect expectations about what happens if that follow that up with b = a ** 100 -- https://mail.python.org/mailman/listinfo/python-list
Re: Possible PEP Submission
On 12/9/2013 3:36 PM, Logan Collins wrote: Just checking whether 1) a PEP is the proper place for this No, not needed. If, after discussion here (or python-ideas), such a change would only need a tracker issue. and 2) what y'all think about it. I would like to propose a change to the the 're' standard library to support iterables. Not really. You are proposing that re.sub accept an iterable of strings for the replacement string. So, something like the following would work: import re text = hello user hello user hello user Repeating the text is the wrong approach. So is using re when not needed. users = [Bob, Alice, Jeffery] newtext = re.sub(user, users, text) # newtext = hello Bob\nhello Alice\nhello Jeffery '\n'.join('Hello user'.replace('user', name) for name in [Bob, Alice, Jeffery]) 'Hello Bob\nHello Alice\nHello Jeffery' -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
Terry Reedy tjre...@udel.edu writes: A few years ago, MIT switched from Scheme (which I believe originated at MIT) to Python for its first course. There might faculty blogs discussing the reasons. In any case, the course is one of MIT's free online offerings. Berkeley recently made the same transition. They had been mirroring the MIT Scheme-based 6.001 quite closely; I believe the Python-based replacement at Berkeley doesn't concern itself with tracking the new 6.001 at MIT. In any case, much (read: some) ink was spilled and consternation felt about the transition, but all in all my impression was that it went OK. IMHO, if you're going to switch from Scheme to something else for first-time programmers, Python is quite nice, as it reads exceptionally well and is very close to pseudocode in appearance sometimes. Of course, given that I didn't learn on Python, my opinions may be colored by prior experience. -- https://mail.python.org/mailman/listinfo/python-list
Re: python programming help
On 08/12/2013 18:14, rafaella...@gmail.com wrote: sorry but i'm new to python ;p 1. it has to be in a form of a function called people and 2. how this code takes in an age and returns the names? it has to be in the form of a function called people, that made me laugh. Too bad he got an answer, even worse he doesn't know what to do with it. -- - Christopher Welborn cjwelb...@live.com http://welbornprod.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Mon, 09 Dec 2013 12:23:41 -, Oscar Benjamin oscar.j.benja...@gmail.com wrote: Some of the objections to the idea that were voiced in the meeting were that: 1) Some people felt that Python is not an industry standard unlike C/C++/Java and that it is not as good for employability. 2) Students should learn to program in a statically typed language because it leads to good programming discipline. 3) Python is too close to Matlab (which is considered essential for some industries our students often go in to). 4) It is better for students to be introduced to programming with a low-level language so that they gain a better understanding of how computers really work. 5) Learning to program should be painful and we should expect the students to complain about it (someone actually said that!) but the pain makes them better programmers in the end. I have taught Python as a first language to 12-15 year old kids, and for their purposes (learning how to get computers to do stuff) it was just fine. In particular, it reads easily (as long as you steer clear of funny stuff like decorators and metaclasses), so our students found it easier to explain to themselves what examples did without all the unusual (in English) punctuation getting in the way. While your students aren't 12-15 year olds, it sounds rather like what you want to give them is very similar. Unlike Computer Science students, they don't need to know how computers really work (except in the limited sense of floating point arithmetic, which is going to give them headaches however you introduce it). What they need is confidence in manipulating data and algorithms, and Python's a perfectly good choice for that. For contrast, my CS degree of mumble years antiquity threw a lot of different languages at us, usually in pairs, to illustrate different concepts. 6502 assembler showed us the basics of how a computer works, while System/370 assembler showed how horribly complex those basics can get; Pascal and BCPL contrasted rigid typing with practically non-existent typing (something Modula-2 and C didn't do nearly as well); and so on and so forth. None of this is stuff your students need for their work, so I wouldn't waste time side-tracking them with it. -- Rhodri James *-* Wildebeest Herder to the Masses -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
In article op.w7umbykna8ncjz@gnudebeest, Rhodri James rho...@wildebst.demon.co.uk wrote: Pascal and BCPL contrasted rigid typing with practically non-existent typing Wow, you actually used BCPL? I didn't realize the language ever had any real use. I had only ever heard of it in the context of being a C precursor, mentioned once in an introduction of a paper and never heard from again. -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On 09/12/2013 05:00, Terry Reedy wrote: I think it can be. If you prefer me to open the issue, say so. We should look for existing issues, and closed issues that rejected change. Thanks for the offer Terry and yes, please open an issue. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: squeeze out some performance
On 06/12/2013 08:47, Robert Voigtländer wrote: Hi, I try to squeeze out some performance of the code pasted on the link below. http://pastebin.com/gMnqprST The code will be used to continuously analyze sonar sensor data. I set this up to calculate all coordinates in a sonar cone without heavy use of trigonometry (assuming that this way is faster in the end). I optimized as much as I could. Maybe one of you has another bright idea to squeeze out a bit more? Thanks Robert Actually for optimised code it looks very similar to some code posted here http://www.daniweb.com/software-development/python/threads/321181/python-bresenham-circle-arc-algorithm over three years ago. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Mon, 09 Dec 2013 23:42:14 -, Roy Smith r...@panix.com wrote: In article op.w7umbykna8ncjz@gnudebeest, Rhodri James rho...@wildebst.demon.co.uk wrote: Pascal and BCPL contrasted rigid typing with practically non-existent typing Wow, you actually used BCPL? I didn't realize the language ever had any real use. I had only ever heard of it in the context of being a C precursor, mentioned once in an introduction of a paper and never heard from again. It probably wasn't an accident that Martin Richards was the lecturer :-) Seriously, though, it was an excellent teaching language, and a slightly bastardized version of the compiler was readily available on the communal BBC Micros. -- Rhodri James *-* Wildebeest Herder to the Masses -- https://mail.python.org/mailman/listinfo/python-list
Re: Programming puzzle with boolean circuits
On Tue, Dec 10, 2013 at 12:25 AM, Chris Angelico ros...@gmail.com wrote: Unfortunately I haven't been able to prove that the code works, because even with some changes it's taking way too long. But hey, it's a crazy fun piece to work with! Well... it eventually solved the problem. I don't know how many CPU hours it took but it threw a SolutionFound exception eventually. Unfortunately I didn't parenthesize the display. The solution seems to involve using a NOT gate and then splitting its output, so you'll see more than two instances of 'not' in the output. This is definitely not an optimal solution, but hey, you asked for a brute-force solver! ~$1 = $4 or not $1 and $2 or $4 and $1 or $2 and $4 and not $1 and $2 or $4 and $1 or $2 or $2 or not $1 and $2 or $4 and $1 or $2 and $2 and not $1 and $2 or $4 and $1 or $2 or not $2 or $1 or $4 and $2 and $1 and $4 or not $1 and $2 or $4 and $1 or $2 ~$2 = $4 or not $1 and $2 or $4 and $1 or $2 and $4 and not $1 and $2 or $4 and $1 or $2 or $1 or not $1 and $2 or $4 and $1 or $2 and $1 and not $1 and $2 or $4 and $1 or $2 or not $2 or $1 or $4 and $2 and $1 and $4 or not $1 and $2 or $4 and $1 or $2 ~$4 = $2 or not $1 and $2 or $4 and $1 or $2 and $2 and not $1 and $2 or $4 and $1 or $2 or $1 or not $1 and $2 or $4 and $1 or $2 and $1 and not $1 and $2 or $4 and $1 or $2 or not $2 or $1 or $4 and $2 and $1 and $4 or not $1 and $2 or $4 and $1 or $2 ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Fwd: Programming puzzle with boolean circuits
Chris, and all.. Since you posted yours, I post this for your pleasure. I couldn't figure out what you were doing. #!/usr/bin/env python This is a puzzle brought up on the python mailing list. The goal is to take 3 bits and invert them using boolean logic, but restricted to only 2 NOT gates Here is a solution I found via google: http://www.thelowlyprogrammer.com/2008/05/not-puzzle-solution.html def invert_three(a,b,c): give three boolean values, return their inverted values Only 2 NOT operators are allowed Deduce these truths all_ones = a and b and c two_or_three = (a and b) or (a and c) or (b and c) zero_or_one = not two_or_three one_one = zero_or_one and (a or b or c) zero_or_two = not (all_ones or one_one) zero_ones = zero_or_one and zero_or_two two_ones = zero_or_two and two_or_three # the output is true if all the inputs are zero, or if one of the inputs is zero and it is either b or c # or two inputs are zero and they are b and c # ditto for other two inputs x = zero_ones or (one_one and (b or c)) or (two_ones and (b and c)) y = zero_ones or (one_one and (a or c)) or (two_ones and (a and c)) z = zero_ones or (one_one and (b or a)) or (two_ones and (b and a)) return int(x), int(y), int(z) if __name__ == __main__: for a in range(2): for b in range(2): for c in range(2): print Input: , a, b, c, x, y, z = invert_three(a,b,c) print Output: , x, y, z -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Programming puzzle with boolean circuits
On Tue, Dec 10, 2013 at 1:03 PM, Joel Goldstick joel.goldst...@gmail.com wrote: Chris, and all.. Since you posted yours, I post this for your pleasure. I couldn't figure out what you were doing. [chomp Python implementation of a fairly elegant solution] That's a fairly nice piece of code that comes from a deliberate solution. What the OP asked was how to devise a brute-force solver. Grab the four class definitions from my code a few posts ago, and then tweak your code to use them: a = Schrodinger(1) b = Schrodinger(2) c = Schrodinger(4) all_ones = a b c two_or_three = (a b) | (a c) | (b c) zero_or_one = ~two_or_three one_one = zero_or_one (a | b | c) zero_or_two = ~(all_ones | one_one) zero_ones = zero_or_one zero_or_two two_ones = zero_or_two two_or_three # the output is true if all the inputs are zero, | if one of the inputs is zero it is either b | c # | two inputs are zero they are b c # ditto f| other two inputs x = zero_ones | (one_one (b | c)) | (two_ones (b c)) y = zero_ones | (one_one (a | c)) | (two_ones (a c)) z = zero_ones | (one_one (b | a)) | (two_ones (b a)) if x == ~a: print(x) if y == ~b: print(y) if z == ~c: print(z) Output: (I tweaked my __repr__ functions to parenthesize for clarity) (((not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and not ((($1 and $2) and $4) or (not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and (($1 or $2) or $4 or ((not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and (($1 or $2) or $4)) and ($2 or $4))) or ((not ((($1 and $2) and $4) or (not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and (($1 or $2) or $4))) and ((($1 and $2) or ($1 and $4)) or ($2 and $4))) and ($2 and $4))) (((not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and not ((($1 and $2) and $4) or (not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and (($1 or $2) or $4 or ((not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and (($1 or $2) or $4)) and ($1 or $4))) or ((not ((($1 and $2) and $4) or (not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and (($1 or $2) or $4))) and ((($1 and $2) or ($1 and $4)) or ($2 and $4))) and ($1 and $4))) (((not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and not ((($1 and $2) and $4) or (not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and (($1 or $2) or $4 or ((not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and (($1 or $2) or $4)) and ($2 or $1))) or ((not ((($1 and $2) and $4) or (not ((($1 and $2) or ($1 and $4)) or ($2 and $4)) and (($1 or $2) or $4))) and ((($1 and $2) or ($1 and $4)) or ($2 and $4))) and ($2 and $1))) Okay, so maybe the brute-force-discovered version isn't so bad after all. :) The classes allow a and b == c to be evaluated for all possible values of a, b, and c, so the brute-forcing actually accumulates data and only subsequently evaluates it. It's far from the most efficient solution (took hours on an i5 CPU), but it's fun :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
RE: noobie needs help with ctypes
My management requires that we stick with the version that comes with CentOs which is 2.6. I know that it’s possible to have multiple versions co-resident with or without virtualenv, but policy is policy ☹ From: Python-list [mailto:python-list-bounces+frsells=adventistcare@python.org] On Behalf Of Joel Goldstick Sent: Monday, December 09, 2013 3:22 PM To: Terry Reedy Cc: python-list@python.org Subject: Re: noobie needs help with ctypes On Mon, Dec 9, 2013 at 3:15 PM, Terry Reedy tjre...@udel.edumailto:tjre...@udel.edu wrote: On 12/9/2013 2:24 PM, Sells, Fred wrote: I'm using python 2.6 on Linux/CentOs 6.x I would use the latest 2.7 (or 3.3) for a new project if at all possible. I seem to recall that Centos needs 2.6 as default python for its own purposes, so you need to install another version without messing with 2.6. VirtualEnv might help. I'm getting ctypes to work, but getting stuck on the use of .argtypes. Can someone point out what I'm doing. This is my first use of ctypes and it looks like I'm getting different definitions in stackoverflow that may correspond to different version of python. In particular, I am sure that there have been bugfixes for ctypes. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On Mon, 09 Dec 2013 05:59:29 -0500, Ned Batchelder wrote: [...] And the cycle continues: [...] Maybe we could just not? A reasonable request, but just because it's reasonable doesn't mean it is a no-brainer that we shouldn't engage with Mark. While I'm very confident at this point that he is a crank, in the same category as circle-squarers, cold fusion proponents, pi-is-a-rational- number theorists, perpetual motion machine inventors, evolution or AGW Denialists[1], and other such obsessive examples of Dunning-Kruger, I'm not *totally* confident that he is a crank. Maybe he'll prove me wrong and actually learn something. Who knows, maybe *I'll* learn something! Even if Mark is a crank and beyond the reach of logic, reason or facts, and I'm 90% convinced his is, consider that he's not the only one reading this thread. If just one person learns something useful or new from a reply to Mark, I believe that it is worthwhile. I daresay that at some point I'll make the same decision as you, that the pain of answering Mark is not worth the benefit to readers, or perhaps that there aren't any readers who will learn something new. But I'm not there yet. (Perhaps I'm just slow.) Speaking of cranks, anyone unaware of the Crack-pot index should check it out: http://math.ucr.edu/home/baez/crackpot.html It's probably more entertaining for those who have actually spent time engaging with cranks in the sciences (e.g. Relativity Denialists) or mathematics. [1] A lot of people dislike the term Denialist. I justify it this way -- there is a difference between those who merely have doubts about the existence of something (say, evolution, global warming, the Holocaust, Operation Gladio, Shakespeare, etc.) and a Denialist. Those doubts don't even need to be *reasonable* doubts. If the person happens to be unknowledgeable (i.e. ignorant) about the subject in question, their doubts may be unreasonable relative to the state of knowledge. What matters is whether the person doing the doubting is reasonable. Denialists are cranks. Not all people who deny, dispute or question accepted knowledge are cranks. Normally the difference between a crank and a non-crank is relatively obvious. One very strong sign is to ask the question what evidence would change your mind?. If the answer is either no evidence at all will change my mind, or something which is impossible to satisfy (e.g. I won't accept evolution until I see a chicken give birth to a human being), then the person is a crank and hence the term Denialist is likely to be apt. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: noobie needs help with ctypes
On Tue, 10 Dec 2013 02:27:28 +, Sells, Fred wrote: My management requires that we stick with the version that comes with CentOs which is 2.6. I know that it’s possible to have multiple versions co-resident with or without virtualenv, but policy is policy ☹ And a perfectly reasonable policy it is too. Python 2.6 is still supported by Centos and RedHat, so it's not obsolete yet. What's not reasonable though is this gunk in your post: html xmlns:v=urn:schemas-microsoft-com:vml xmlns:o=urn:schemas-microsoft-com:office:office xmlns:w=urn:schemas-microsoft-com:office:word xmlns:m=http://schemas.microsoft.com/office/2004/12/omml; xmlns=http://www.w3.org/TR/REC-html40; head meta http-equiv=Content-Type content=text/html; charset=utf-8 meta name=Generator content=Microsoft Word 14 (filtered medium) style!-- [ delete about three pages of HTML ] This forum is in part a text-only newsgroup and mailing list. Please respect the conventions of the newsgroup by only sending plain text messages rather than so-called Rich Text (HTML) messages, if at all possible. Thank you. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: One liners
On Fri, 06 Dec 2013 19:20:07 -0800, Dan Stromberg wrote: On Fri, Dec 6, 2013 at 6:07 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The beauty of Python is that it is a multi-paradigm language. You can write imperative, procedural, functional, OOP, or pipelining style (and probably more). The bad thing about Python is that if you're reading other people's code you *need* to be familiar with all those styles. That's fine. That's appropriate. But I imagine any of these can be done with the intention of being more clever than clear. BTW, what's pipelining style? Like bash? Yes, correct. You have a data stream and you pass it through various filters to process it. David Beazley has some nice examples of writing pipelining code: http://www.dabeaz.com/generators/index.html -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On Tuesday, December 10, 2013 8:49:46 AM UTC+5:30, Steven D'Aprano wrote: On Mon, 09 Dec 2013 05:59:29 -0500, Ned Batchelder wrote: [...] And the cycle continues: [...] Maybe we could just not? Thanks Ned for your attempts at bringing some order and sense in these parts of the universe A reasonable request, but just because it's reasonable doesn't mean it is a no-brainer that we shouldn't engage with Mark. Some basic statistics Suppose a random variable X takes 2 values x and y with probabilities p and q=1-p. Then expected value of X E[X] = px + qy p = probability of some good result from an interaction q = 1-p = No good x = benefit value y = harm value Even if Mark is a crank and beyond the reach of logic, reason or facts, and I'm 90% convinced his is, consider that he's not the only one reading this thread. So you are pegging 'no-good-probability' at 90% and so p at 10%. Ok lets accept these. And in the benefit value you include the possible benefit to Mark, to whoever engages with him and the random [no relation of random variable X] lurking reader. So far so good And in the harm-value y, are you including the harm done to the random reader from a disorderly, abusive, fruitless and almost completely OT conversation? If just one person learns something useful or new from a reply to Mark, I believe that it is worthwhile. And if 3 people drop out because the levels of bullshit have crossed their thresholds? [BTW: My statistics was never very strong and is now quite rusty. So... Whos that guy who recently added a stats module to python?? Cant remember his name... Maybe I should take some tuitions from him...] -- https://mail.python.org/mailman/listinfo/python-list
Re: python programming help
On 12/09/2013 12:57 AM, Chris Angelico wrote: On Mon, Dec 9, 2013 at 4:07 PM, ru...@yahoo.com wrote: However it does not change the fact that people here have responded in rather extreme way to GG posts including calling GG users twits and claiming GG posts damage their eyesight, as well as repeatedly denying the obvious fact that GG is much easier to use for many than to subscribe to a usenet provider or to a mailing list. One frequently sees words like crap, slimy, rubbish etc to describe GG posts which is pretty intimating to people who just want some help with a python question using a tool they already know how to use and have had no complaints about in other places. Please note though that there is a difference between describing the users as twits and describing the posts as slimy. Suppose you write a letter (the sort that goes on a slab of dead tree) and, instead of placing it in an envelope and putting a stamp on it, you hand it to the Arac News Insertion Device[1] to do the enveloping for you. He does a reasonable job of it, but he uses cobwebs instead of paper for the envelope. Sure, it's still readable... but your readers now have to rub off a whole lot of cobwebs before they can read what you said. That makes your post distasteful, without it being at all your fault - other than choosing to use Arac's service. That's how I see Google Groups posts. Someone's gone looking for help about Python and has found that. It's not their fault that they don't know about alternatives; so I point out the alternatives. Nevertheless, that kind of strong judgmental language is very likely to be taken as reflecting at least in part on the poster, especially when the person is from a different culture or unsure of their English skills. And if you truly just want the poster to be apprised of alternatives, I sure you'll grant me the right to point out the alternative you consistently leave out: the option to continue to use Google Groups. -- https://mail.python.org/mailman/listinfo/python-list
Re: python programming help
On 12/09/2013 01:15 AM, Chris Angelico wrote: On Mon, Dec 9, 2013 at 4:10 PM, ru...@yahoo.com wrote: We all use buggy software every day. *Every* piece of non-trival software is buggy -- you already know that. So you are saying that bugs that annoy *you* are ones that *others* should change their practice to join your boycott to fix. The ones that have interoperability problems are the ones that need to be fixed. [...snip stuff about mud clients...]) Huh? You declare a universal truth that interoperability bugs need to be fixed but other bugs don't? A bug that give wrong financial results is less important than mojibake sometimes displayed on a web page? A bug that cause a connection failure is more important than a bug that silently corrupts saved data? Congratulations, you just won this week's jmf prize (with apologies to jmf.) You sound like some Unix hard-asses of the 1990's who, by god, weren't going pollute their software with any kind of MS Windows compatibility. No supporting a broken OS for them. They would keep the software pure and Unix-only and force Microsoft to fix their broken OS. Well, most of that software and those programmers have been eliminated by Darwinian selection, and today cross-platform (or Windows only) software is the norm. And there were Microsoft people in the same era who, by Bill, weren't going to pollute their software with any kind of standards compatibility. I don't think that is analogous in the same way. Unlike most people here, who seem to be driven by an personal (and emotional judging from the language used) distaste for GG posts, and a similar emotional response against MS by the Unix elitists in the 1990s, Microsoft's alleged embrace, extend, extinguish policy was/is (I'm pretty sure) carefully thought out and based on rational analysis. Let's look at just one product, Internet Explorer: [...snip MSIE version history claiming decreasing market share and increasing standards compliance...] Not a convincing example at all. First its not even clear that what the factors driving such change are; open standards are only one factor. Not should you assume that all open standards are equally important and that MS' (or Google's) response will be the same to all standards across all product lines. Two, although you present MSIE as changing in response to demands to match [other browsers] in behaviour you leave out demands on those other browsers (and standards) to adopt features of MSIE. A unfortunate example might be the W3C consideration (maybe approved by now?) of DRM. It is not a one-way street and standards are not cast in stone. Finally it is an absurd stretch to take pressure applied by large corporate customers to MS to adopt more open standards as comparable to a handful of people in a non-major programming language mailing list refusing to read posts from GG. I am not saying that you shouldn't continue to promote your boycott against Google, just that you shouldn't be surprised or get angry when the response of some people is similar to my response towards some friends who want me to stop eating meat to fight factory farming. Windows-only is hardly the norm. There's at least as much software that's Mac-only or Linux-only as Windows-only. As much Mac-only software as Windows-only? Possibly, but I doubt it although I acknowledge things are moving in that direction. As much Linux-only software as Windows-only? You must be smoking crack. :-) And far far more that's cross-platform or at least multi-platform. The most important thing is interoperability - sometimes that means stuff like Samba (specifically written to talk to a foreign system), but more often it means coding to the pre-written standards. I can write all sorts of TELNET servers and clients, and I can be confident that they'll work nicely with other people's clients and servers, and that they'll understand each other when they say IAC DO NAWS or IAC SB TERMTYPE IS Gypsum IAC SE. If one of them is buggy, it must be fixed, or it must not be used. TELNET? Does any one still use that except perhaps on secure, controlled legacy intranets? We nuked that and other protocols of it's era (FTP etc) for ssh and other (more) secure protocols ages ago. -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On Mon, 09 Dec 2013 20:32:06 -0800, rusi wrote: On Tuesday, December 10, 2013 8:49:46 AM UTC+5:30, Steven D'Aprano wrote: On Mon, 09 Dec 2013 05:59:29 -0500, Ned Batchelder wrote: [...] And the cycle continues: [...] Maybe we could just not? Thanks Ned for your attempts at bringing some order and sense in these parts of the universe A reasonable request, but just because it's reasonable doesn't mean it is a no-brainer that we shouldn't engage with Mark. Some basic statistics Suppose a random variable X takes 2 values x and y with probabilities p and q=1-p. Then expected value of X E[X] = px + qy p = probability of some good result from an interaction Define good result. q = 1-p = No good Define No good. x = benefit value y = harm value Even if Mark is a crank and beyond the reach of logic, reason or facts, and I'm 90% convinced his is, consider that he's not the only one reading this thread. So you are pegging 'no-good-probability' at 90% and so p at 10%. Ok lets accept these. Certainly not. I'm pegging my confidence that Mark is a crank at 90%, which is not the same thing. For example, although Mark is (presumably) a crank, nevertheless I have brought some enjoyment into your life as it has given you the opportunity to regale us all with your opinion on off-topic posts, and show off your advanced knowledge of probability *wink* That counts as a good result. And in the benefit value you include the possible benefit to Mark, to whoever engages with him and the random [no relation of random variable X] lurking reader. So far so good And in the harm-value y, are you including the harm done to the random reader from a disorderly, abusive, fruitless and almost completely OT conversation? You are conflating the magnitude of harm with the probability of harm. But please, do continue in your off-topic rant complaining about off- topic conversations, I'm sure that we're all learning either something or possibly nothing from it. If just one person learns something useful or new from a reply to Mark, I believe that it is worthwhile. And if 3 people drop out because the levels of bullshit have crossed their thresholds? I don't know. If twelve people are moved to drop out of this group because of your post complaining about my post, how would you react? I'd probably feel between 0 and 1/4 times as good. By the way, I'm curious. Why are discussions about object oriented coding off-topic to Python? This is not a rhetorical question. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: python programming help
On 12/08/2013 10:20 PM, rusi wrote: On Monday, December 9, 2013 10:37:38 AM UTC+5:30, ru...@yahoo.com wrote: [...] However it does not change the fact that people here have responded in rather extreme way to GG posts including calling GG users twits and claiming GG posts damage their eyesight, as well as repeatedly denying the obvious fact that GG is much easier to use for many than to subscribe to a usenet provider or to a mailing list. One frequently sees words like crap, slimy, rubbish etc to describe GG posts which is pretty intimating to people who just want some help with a python question using a tool they already know how to use and have had no complaints about in other places. About the last -- no complaints about (that) in other places -- Ive recently seen that on the html/stylesheets/javascript lists (not sure which) there are also annoyed complaints about GG. I am sure that there are other usenet groups that get Google Groups posts and find them irritating for the same reason that some here do. But usenet is nearly all the way in death's door (at least text groups; binaries groups may be still be growing.) The only usenet groups I know of with any vitality left at all are ones like the Python list that are backed by an active maillist. (Curiously, it seems to me the dramatic decline in usenet occurred around 2008-2010, about the same time as the dramatic rise of social networking sites.) As for pure mailing lists, I am not sure how many are gatewayed to GG -- I subscribe to several because they are not available through GG -- so they don't get GG posts. There are however a large number of mailing lists that are hosted solely on GG by various projects. It is participants in these lists that I was thinking of by other places. Such people are likely very surprised by the hostility they meet when they simply change to the python list (or one of the other usenet-gatewayed groups) which looks very much like any another GG group from their perspective. For all the GG hostility on the python list, many python project lists are hosted on GG (Sqlalchemy, Webpy, GvR's own Tulip project, etc) About the rest -- when people get annoyed they say and do things they would not otherwise do. Humans have big cortexes so that they don't need to act out based on their feelings of the moment -- like a dog humping the boy next door or trying to bite off the arm of the postal delivery person. -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On Tuesday, December 10, 2013 10:40:27 AM UTC+5:30, Steven D'Aprano wrote: By the way, I'm curious. Why are discussions about object oriented coding off-topic to Python? This is not a rhetorical question. Well OOP on the python list is certainly on topic. Interminable discussions about why redrawing the inheritance arrows the other way round will save the world is OT (for me!) -- https://mail.python.org/mailman/listinfo/python-list
Re: python programming help
On Tue, Dec 10, 2013 at 4:10 PM, ru...@yahoo.com wrote: Windows-only is hardly the norm. There's at least as much software that's Mac-only or Linux-only as Windows-only. As much Mac-only software as Windows-only? Possibly, but I doubt it although I acknowledge things are moving in that direction. As much Linux-only software as Windows-only? You must be smoking crack. :-) Or just using Linux. Stuff that runs only on Linux is actually a bit of a problem at times - coders making assumptions about the environment that aren't guaranteed, and merely happen to be correct on all current versions of the Linux kernel. And far far more that's cross-platform or at least multi-platform. The most important thing is interoperability - sometimes that means stuff like Samba (specifically written to talk to a foreign system), but more often it means coding to the pre-written standards. I can write all sorts of TELNET servers and clients, and I can be confident that they'll work nicely with other people's clients and servers, and that they'll understand each other when they say IAC DO NAWS or IAC SB TERMTYPE IS Gypsum IAC SE. If one of them is buggy, it must be fixed, or it must not be used. TELNET? Does any one still use that except perhaps on secure, controlled legacy intranets? We nuked that and other protocols of it's era (FTP etc) for ssh and other (more) secure protocols ages ago. TELNET protocol is the fundamental basis of MUDs. Doesn't mean there's a TELNET server at the other end. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Monday, December 9, 2013 5:53:41 PM UTC+5:30, Oscar Benjamin wrote: 5) Learning to program should be painful and we should expect the students to complain about it (someone actually said that!) but the pain makes them better programmers in the end. That's like saying that when teaching woodwork we shouldn't let people use hammers, we should make them use rocks to bang nails in, because it will make them better carpenters in the long run. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Movie (MPAA) ratings and Python?
Is anyone using a module or database that gives Python 3.x access to MPAA ratings (EG G, PG, PG-13, etc.)? I explored a few of the possibilities on Pypi, a couple of web interfaces, and the IMDB flat text file with ratings and reasons for those ratings, but I've not been really impressed yet. The IMDB flat text file probably came the closest, but it appears to have encoding issues; it's apparently nearly windows-1255, but not quite. I may end up using the IMDB flat text file with binary I/O, but before I dig into this any farther, I thought I should ask here: Has someone already explored this and found a solution they were happy with? Thanks! -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
Chris Angelico ros...@gmail.com writes: How does that work, exactly? How do you have a class inherit (ultimately) from itself, and how does that impact the component class list? How does it work exactly? You're asking me about a feature I never made use of, in a system I have no source for, and that I haven't used in over 25 years! If it wasn't mentioned in a parenthetical comment in the 32-year-old documentation I still have on my bookshelf (Lisp Machine Manual, 4th edition, July 1981, blue cover), I wouldn't trust my own memory that such a thing ever even existed. So you're not getting anything exact here! I have no idea exactly how it worked, but imagine something that walked the superclass graph _as_ _if_ it was a tree, collected classes in some order, and that just skips any class it encounters for the second time. That results in _some_ linear ordering of all the classes you can reach from the starting class. Now use that. Now the results aren't going to be very good by modern standards. As the Common Lisp Object System, Dylan, Python, and others, have all discovered, you really want something that is at _least_ a topological sort of the superclass graph -- and there is no topological sort at all unless your superclass graph is acyclic. But even if the results aren't up to modern standards, you can write a hell of a lot of code before the deficiencies have hurt enough people enough times to motivate you to do better. After all modern Python classes didn't start using their current ordering until Python 2.3. -- Alan Bawden -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
In article 5f7e3e2f-2f86-4a2b-bea5-6e70b6fc2...@googlegroups.com, rusi rustompm...@gmail.com wrote: On Tuesday, December 10, 2013 10:40:27 AM UTC+5:30, Steven D'Aprano wrote: By the way, I'm curious. Why are discussions about object oriented coding off-topic to Python? This is not a rhetorical question. Well OOP on the python list is certainly on topic. Interminable discussions about why redrawing the inheritance arrows the other way round will save the world is OT (for me!) What about whether the arrows should have solid heads, open heads, barbed heads, double-barbed heads, or circles (filled or open)? Surely you can't expect people to write decent programs when they can't even draw the right kind of arrowhead? -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On Tue, Dec 10, 2013 at 4:27 PM, Alan Bawden a...@scooby-doo.csail.mit.edu wrote: Chris Angelico ros...@gmail.com writes: On Mon, Dec 9, 2013 at 6:31 PM, Alan Bawden ... How does that work, exactly? How do you have a class inherit (ultimately) from itself, and how does that impact the component class list? How does it work exactly? You're asking me about a feature I never made use of, in a system I have no source for, and that I haven't used in over 25 years! If it wasn't mentioned in a parenthetical comment in the 32-year-old documentation I still have on my bookshelf (Lisp Machine Manual, 4th edition, July 1981, blue cover), I wouldn't trust my own memory that such a thing ever even existed. So you're not getting anything exact here! LOL! I have no idea exactly how it worked, but imagine something that walked the superclass graph _as_ _if_ it was a tree, collected classes in some order, and that just skips any class it encounters for the second time. That results in _some_ linear ordering of all the classes you can reach from the starting class. Now use that. Ow, that sounds a bit... weird. I think I prefer an acyclic graph for inheritance! A few weirdnesses are necessary for bootstrapping - type(object) is type, type(type) is type, and type.__bases__ = (object,) - but normally every type should be created before all instances of it, and every superclass before all its subclasses. But of course, *multiple* inheritance is always weird. I've worked in some detail with four systems (C++, Python, Pike, Java), and they're all quite different in how they handle MI. Java says There is no MI... but you can implement multiple interfaces. C++ says There is MI and there is virtual MI, and if one of them doesn't do your head in, the other will. Python says It's all about method resolution, instance data is separate, so make sure everything cooperates. Pike says If both parents define a method, super() will return an array of methods, but that's okay because arrays are callable. It's a fundamentally tricky problem, largely because every real-world analogy we can muster is going to end up looking more like composition than inheritance (a guided missile is-a bomb and is-a rocket, but it's just as valid to say it is-a rocket and it has-a bomb). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Experiences/guidance on teaching Python as a first programming language
On Tue, Dec 10, 2013 at 4:25 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: On Monday, December 9, 2013 5:53:41 PM UTC+5:30, Oscar Benjamin wrote: 5) Learning to program should be painful and we should expect the students to complain about it (someone actually said that!) but the pain makes them better programmers in the end. That's like saying that when teaching woodwork we shouldn't let people use hammers, we should make them use rocks to bang nails in, because it will make them better carpenters in the long run. But in teaching woodwork you SHOULD let people use basic tools, and not just a CNC lathe. Or in the most extreme sense, putting together IKEA furniture is not carpentry, and neither is picking from an extremely limited toolbox programming - which is why Build a program without writing a line of code systems are junk for anything complicated. (Occasionally, VERY occasionally, it's possible to use the simple drag-and-drop system to get you 90% of the way, and then fill in the rest yourself. Usually, you'll end up fighting the system as soon as you do something the author didn't intend.) Programming shouldn't be painful just for the sake of making it painful. But you should be programming, not just solving a Sudoku puzzle. It should be possible for a programmer to develop a unique program that does a unique thing, and if that's beyond the scope of the system, the system isn't a programming system. (Might still be a useful system, of course, but it's not programming.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
On Tue, 10 Dec 2013 00:31:15 -0500, Roy Smith wrote: In article 5f7e3e2f-2f86-4a2b-bea5-6e70b6fc2...@googlegroups.com, rusi rustompm...@gmail.com wrote: On Tuesday, December 10, 2013 10:40:27 AM UTC+5:30, Steven D'Aprano wrote: By the way, I'm curious. Why are discussions about object oriented coding off-topic to Python? This is not a rhetorical question. Well OOP on the python list is certainly on topic. Interminable discussions about why redrawing the inheritance arrows the other way round will save the world is OT (for me!) What about whether the arrows should have solid heads, open heads, barbed heads, double-barbed heads, or circles (filled or open)? Surely you can't expect people to write decent programs when they can't even draw the right kind of arrowhead? You mock, and so you should, but I just thought I'd mention that there are standards for this sort of thing: http://en.wikipedia.org/wiki/Unified_Modeling_Language According to UML the type of arrow head does make a difference. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: interactive help on the base object
In article 52a6af26$0$2829$c3e8da3$76491...@news.astraweb.com, Steven D'Aprano st...@pearwood.info wrote: What about whether the arrows should have solid heads, open heads, barbed heads, double-barbed heads, or circles (filled or open)? Surely you can't expect people to write decent programs when they can't even draw the right kind of arrowhead? You mock, and so you should, but I just thought I'd mention that there are standards for this sort of thing: http://en.wikipedia.org/wiki/Unified_Modeling_Language According to UML the type of arrow head does make a difference. Surely you realize that such a carefully constructed mock could not have been generated without knowledge of the mockee? UML, like so many things, started out with a few good ideas. Giving some structure to how you sketch out classes on a whiteboard was a good idea. Sequence diagrams, in particular, are a neat way to understand complicated control flows. I've even used UML tools to make sense of some huge pile of C++ code that was tossed my way. Import the code, then start shoving boxes around on the screen until some sort of logical structure emerges. But, once things got to there being N different types of arrowheads, each having some magical significance, they lost me. PS: other things that fall into the Some good basic ideas, but got totally out of hand include Agile, Six Sigma, and Perl. -- https://mail.python.org/mailman/listinfo/python-list
Re: Movie (MPAA) ratings and Python?
Dan Stromberg drsali...@gmail.com writes: Is anyone using a module or database that gives Python 3.x access to MPAA ratings (EG G, PG, PG-13, etc.)? What information would you want access to? Why would a library (rather than, say, a short set of strings) be needed? I explored a few of the possibilities on Pypi, a couple of web interfaces, and the IMDB flat text file with ratings and reasons for those ratings, but I've not been really impressed yet. You seem to be talking about some MPAA document, where is it so we can know what specifically you're referring to? -- \ “A child of five could understand this. Fetch me a child of | `\ five.” —Groucho Marx | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Movie (MPAA) ratings and Python?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/12/2013 08:40, Ben Finney wrote: Dan Stromberg drsali...@gmail.com writes: Is anyone using a module or database that gives Python 3.x access to MPAA ratings (EG G, PG, PG-13, etc.)? If you are already using IMDB you should have a look at http://imdbpy.sourceforge.net/downloads.html as well. It provides a relatively simple Python interface to either a local or hosted IMDB dataset and allows you to grab the MPAA rating directly from the canonical movie name. - -- Paul -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSprk1AAoJEP7GEwhwShZxOpgIAIMYG9QRo0XHe5InJejMh0tX rLAkDL/2oSTQ3/nYNId5EJhDAF4GFu7LYgy4e3HIIWjIPw8UM64FFdFY/3d2t2hQ jiWSNCoj8E+5m25m8Ob3oBcv+/bQRKsXuD+DvmGhoSvwnDaNqpYmiPBRyHgKp3tm FoKJCkmgJoMX6KWCauBuVnoRSZGO0os3fZ0t/LpUHXjeZw5xLtvLm5aNqq9vWVin V0nLZO7DPzN9hBQU6MAkdE6d6C3a/MbIU0s/fgCRJ9bB2SpQc55ewnZxWZLstgAh WLUPQyY06d6iv5NM7N9Adehs4xxRj3jCIw54Wl8Vhk3h1UeJygxzN1C7HfI2URY= =2jod -END PGP SIGNATURE- -- https://mail.python.org/mailman/listinfo/python-list
[issue19933] Round default argument for ndigits
Mark Dickinson added the comment: After patch: round(1.23, 0) = 1 not 1.0 round(4.67, 0) = 5 not 5.0 Please no! Two-argument round should continue to return a float in all cases. The docs should be fixed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19933 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19933] Round default argument for ndigits
Mark Dickinson added the comment: But also there should be a way to make round return an integer I don't understand. There's already a way to make round return an integer: don't pass a second argument. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19933 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19933] Round default argument for ndigits
Changes by Vajrasky Kok sky@speaklikeaking.com: Added file: http://bugs.python.org/file33053/fix_doc_round_ndigits.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19933 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19933] Round default argument for ndigits
Vajrasky Kok added the comment: Okay, here is the patch to fix the doc. -- Added file: http://bugs.python.org/file33052/fix_doc_round_ndigits.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19933 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19933] Round default argument for ndigits
Changes by Vajrasky Kok sky@speaklikeaking.com: Removed file: http://bugs.python.org/file33052/fix_doc_round_ndigits.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19933 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19933] Round default argument for ndigits
Changes by Vajrasky Kok sky@speaklikeaking.com: Removed file: http://bugs.python.org/file33053/fix_doc_round_ndigits.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19933 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19933] Round default argument for ndigits
Changes by Vajrasky Kok sky@speaklikeaking.com: Added file: http://bugs.python.org/file33054/fix_doc_round_ndigits.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19933 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19846] Setting LANG=C breaks Python 3 on Linux
Serhiy Storchaka added the comment: And yet, in Python 2, people could do that, and Python didn't care. *That's* the regression I'm worried about. If it hadn't round-tripped cleanly in Python 2, I wouldn't care here either. $ python2.7 -c print u'\u20ac' € $ LANG=C python2.7 -c print u'\u20ac' Traceback (most recent call last): File string, line 1, in module UnicodeEncodeError: 'ascii' codec can't encode character u'\u20ac' in position 0: ordinal not in range(128) And even worse: $ python2.7 -c print u'\u20ac' /dev/null Traceback (most recent call last): File string, line 1, in module UnicodeEncodeError: 'ascii' codec can't encode character u'\u20ac' in position 0: ordinal not in range(128) What the wart! Other program can produces wrong (or even absolutely senseless) output with C locale. $ LANG=C ls ?? ?? ?? ?? ?? ?? ?? ?? What is better, silently produce corrupted output or raise an exception? If first, then let just set the replace or backslashreplace error handler for sys.stdout by default. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19846 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19846] Setting LANG=C breaks Python 3 on Linux
Serhiy Storchaka added the comment: sworddragon@ubuntu:~$ LANG=C sworddragon@ubuntu:~$ ä bash: $'\303\244': command not found - The terminal doesn't pseudo-crash with an exception because it doesn't matter about encodings. - It allows to change the encoding at runtime. This is not a locale of your terminal. Try `LANG=C xterm`. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19846 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18576] Rename and document test.script_helper as test.support.script_helper
Fotis Koutoulakis added the comment: Hello again. Is everything ok with the patch? Is there something not working as expected? Perhaps an omission or something? Do I need to do something more to get it accepted? Thanks for your time. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18576 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19935] IPv6 urlparse error on python 2.6
New submission from Yu Yang: Actually, there is a bug which has been fixed this issue on python 2.7 and python 3.3. http://bugs.python.org/issue2987. Open this issue aims for back port this fix to python 2.6. -- components: Library (Lib) messages: 205657 nosy: yuyangbj priority: normal severity: normal status: open title: IPv6 urlparse error on python 2.6 type: enhancement versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19935 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19915] int.bit_at(n) - Accessing a single bit in O(1)
Serhiy Storchaka added the comment: For example, `i.bits_at(0, 52)` to get at a double's mantissa requires no thought at all to write or to read later; bit-level gibberish like I agree that special function or method looks more clear. But I suppose that in many cases the performance does matter. And function call has larger overhead in current Python. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19915 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19935] IPv6 urlparse error on python 2.6
Christian Heimes added the comment: Python 2.6 has reached its end of life cycle and doesn't receive fixes anymore. You have to maintain a bugfix yourself or update to a more recent version of Python. -- nosy: +christian.heimes resolution: - out of date stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19935 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19935] IPv6 urlparse error on python 2.6
Yu Yang added the comment: As the OpenStack support python 2.6, python 2.7 and python 3.3, and IPv6 management network is supported by OpenStack, so we need to back port urlparse problem for IPv6 to python 2.6, otherwise there will be limitation on python 2.6 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19935 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18576] Rename and document test.script_helper as test.support.script_helper
Serhiy Storchaka added the comment: Please left test.script_helper as alias to test.support.script_helper. I.e. test/script_helper.py should contains something like: from test.support.script_helper import * And test this with unmodifiable other tests. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18576 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19935] IPv6 urlparse error on python 2.6
Yu Yang added the comment: @Christian Heimes, thanks for your response. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19935 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19846] Setting LANG=C breaks Python 3 on Linux
Marc-Andre Lemburg added the comment: The C locale is part of the ANSI C standard. The POSIX locale is an alias for the C locale and a POSIX standard, so we cannot just replace the ASCII encoding with UTF-8 as we wish, so Antoine's patch won't work. See e.g. http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html The C and POSIX locale settings are the only locale settings that are guaranteed to always exist in C libraries. Python 3 should work with such locale settings. It doesn't have to be able to output non-ASCII code points, but it should run with ASCII data. AFAIK, Python 3 does work with ASCII data in the C locale, so I'm not sure whether this is a bug at all. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19846 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com