Re: [Tutor] Logging exceptions, but getting stderr output instead
On Wed, 25 May 2016, Alex Hall wrote: You're not missing anything; I wasn't clear. I wasn't sure if raise or sys.exit(1) were the preferred ways, or if there was some other way I didn't know about. If you're aborting because of the exception after unsuccessfully trying to handle it, you can always just use "raise" with no operands, which will re-raise the underlying exception. That's what I usually do: try: 1/0 except ZeroDivisionError: print "oops." raise prints: oops. Traceback (most recent call last): File "[...]\test.py", line 2, in 1/0 ZeroDivisionError: integer division or modulo by zero ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Baffling problem with a list of objects sharing a property
> They are. You've stiumbled on one of those Python peculiarities of > implementation that can be useful and annoying in equal measure. > >> class Test(object): >> def __init__(self, name, paths=[]): >> self.name = name >> self.paths = paths > > When you give a function/method a default value that same object is used > for *every* invocation of the method where the default applies. By the way, this is one of the things that tools like pylint (https://www.pylint.org/) will warn about. http://pylint-messages.wikidot.com/messages:w0102 Just to note that there are external "lint" tools that can help catch this class of problems automatically. Best of wishes! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Newcomer with organizational questions
Hi, I am a newcomer who asked a first question here at Tutor. Soon I received a very good answer from a tutor and put an effort to understand it. After that I wrote a reply with a thank you and a follow-up question, only to discover that I don’t see a way to send it. I need to say I did not write to maillist forums before, only to forums with Post button right there:). I reread *tutor-**bounces* auto-response, then did some googling and realized that I may need to subscribe. So I did on Sunday May 22, and the webpage said: “*Your subscription request has been received, and will soon be acted upon. Depending on the configuration of this mailing list, your subscription request may have to be first confirmed by you via email, or approved by the list moderator. If confirmation is required, you will soon get a confirmation email which contains further instructions.*” Main question: Should I wait more or I am missing something I need to do at my end? My purpose is to post a reply in a particular subject I initiated. Please note that I did not receive anything from a tutor in my email other than *tutor-bounces* auto-response. I use Gmail. Other organizational questions: - - May I attach a file to a message? Some Python libraries are quite big (50 pages in my case), however it may be not difficult for an expert to answer a question if he/she has a full library. At the same time, it seems inconsiderate and impractical to paste 50 pages into a message. - - Can I paste not in plain text – using fonts etc? - - May I ask a follow-up question in the same thread, or should I start a new one? - - Is this ok to post a message that contains thank you only, or these messages have to be deleted by moderators (like on stackoverflow.com?) I believe first I was able to see a tutor’s response on external website: https://code.activestate.com/lists/python-tutor/107992/ - and much later on mail.python.org. Is this persistent behaviour? Possibly, all this is answered in a document somewhere? Thank you for your time. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Newcomer with organizational questions
Max Jegers writes: > I am a newcomer who asked a first question here at Tutor. Soon I > received a very good answer from a tutor and put an effort to > understand it. Welcome, and I'm glad you had a positive experience finding help here! > After that I wrote a reply with a thank you and a follow-up question, > only to discover that I don’t see a way to send it. This is an email forum; you compose a reply by using the “Reply To List” command in your email client. If you don't have such a command in your email client: * Complain explicitly to whoever makes your email client. Reply To List is a standard feature which works correctly in any decent email client for decades. * Consider using a better email client. (You don't have to change email addresses, just use a better program to operate your email.) * As a last resort, you can manually fiddle with “Reply To All” by removing individual email addresses, leaving only the list address to remain. > I need to say I did not write to maillist forums before, only to > forums with Post button right there:). Email forums allow you to use the program you're already familiar with for email, so IMO that makes them much preferable! Here is https://www.mail-list.com/reply_in_a_mailing_list/> a simple introduction to how reply works in an email forum. -- \ “It is … incumbent upon us to recognize that it is | `\inappropriate for religion to play any role in issues of state | _o__)[of] a modern democracy.” —Lawrence M. Krauss, 2012-05-28 | Ben Finney ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Newcomer with organizational questions
On 26/05/16 23:34, Max Jegers wrote: > that I wrote a reply with a thank you and a follow-up question, only to > discover that I don’t see a way to send it. A mailing list works by email, so you reply as you would to any email. If you use Reply it goes to the person who sent the email. If you use Reply All it goes to everyone who received the original email, including the sender. In the case of a list it also includes the list(and everyone on it.) So the simplest solution is to always use Reply All (or if you have the option, Reply List) and it will go to the list. > I reread *tutor-**bounces* auto-response, then did some googling and > realized that I may need to subscribe. So I did on Sunday May 22, and the > webpage said: “*Your subscription request has been received, and will soon > be acted upon. Depending on the configuration of this mailing list, your > subscription request may have to be first confirmed by you via email, or > approved by the list moderator. If confirmation is required, you will soon > get a confirmation email which contains further instructions.*” > > Main question: Should I wait more or I am missing something I need to do at > my end? Nope, you are now subscribed. However the default behaviour is to put new subscribers on a moderation mode whereby all your early posts get caught in a queue and have to be manually approved by a moderator. There are 3 of us but usually its me :-) So I approved your post, it appeared on the list and I am now replying to it. > My purpose is to post a reply in a particular subject I initiated. Find the mail and reply to it using Reply All. A couple of important extra requirements - Set your email to be plain text not HTML because HTML tends to mess the formatting which is critical for Python code. (You might be able to configure your mail tool to always use plain text for python.org posts.) - Always include the code that's causing the problem - Always include the full text of any errors you get - Tell us your OS and Python version > Please note that I did not receive anything from a tutor in my email other > than *tutor-bounces* auto-response. I use Gmail. That's just the server automated response. Hopefully you receive this :-) > - - May I attach a file to a message? Some Python libraries are > quite big (50 pages in my case), however it may be not difficult for an > expert to answer a question if he/she has a full library. At the same time, > it seems inconsiderate and impractical to paste 50 pages into a message. 50 pages (how big is a page?)... probably too much. Try to condense it by removing irrelevant bits. My rule of thumb is up to 100 lines can goi in the message, bigger than that [put it on a public pastebin and send a link. Attachments are a bad idea because they often (but not always) get stripped out for security reasons by the server. > - - Can I paste not in plain text – using fonts etc? No, see above. HTML loses spaces etc and destroys formatting You can use plain text mark ups such as _underline_ or *bold* > - - May I ask a follow-up question in the same thread, or should I > start a new one? If its a new topic start a new thread. If its a follow up on the same topic keep it in the same thread > - - Is this ok to post a message that contains thank you only, or > these messages have to be deleted by moderators (like on stackoverflow.com?) It's not necessary every time but I certainly don't delete them and if the response took a lot of work, maybe by multiple contributors its good to let us know when you finally solve the problem. > I believe first I was able to see a tutor’s response on external website: > https://code.activestate.com/lists/python-tutor/107992/ - and much later > on mail.python.org. Is this persistent behaviour? The list archives are available in several places including python.org and activestate.com. You can also receive (and reply to) list messages using usenet(NNTP) via gmane. (Thats actually how I read the list.) They also provide an archive of old posts. Feel free to ask any more questions about the list or about Python or programming in general. -- Alan G Python tutor list moderator Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor