[RELEASE] Python 2.7.6

2013-11-11 Thread Benjamin Peterson
Python 2.7.6 is now available. This release resolves crashes of the interactive interpreter on OS X 10.9. The final release also fixes several issues identified in the release candidate. Importantly, a security bug in CGIHTTPServer was fixed [1]. Thank you to those who tested the 2.7.6 release

Re: The narcissism of small code differences

2013-11-11 Thread Mark Lawrence
I never thought I'd be saying this but welcome back Rick :) On 11/11/2013 06:50, Rick Johnson wrote: On Saturday, November 9, 2013 6:42:04 AM UTC-6, Steven D'Aprano wrote: Uses an example written in Ruby, but don't let that put you off: Why would it? I write Ruby code all the time. Ruby code

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-11 Thread wxjmfauth
* Some languages are just fundamentally bad. The flexible string representation is a perfect exemple. Again, a short explanation: This FSR splits unicode in chunks. Two immediate consequences: - It's necessary to keep track of each individual internal pieces of text. - It's necessary to

Re: To whoever hacked into my Database

2013-11-11 Thread Νίκος Αλεξόπουλος
Στις 6/11/2013 5:25 μμ, ο/η Νίκος Γκρ33κ έγραψε: Okey let the hacker try again to mess with my database!!! He is done it twice, lets see if he will make it again! I'am waiting! I can't believe your ignorance. You're actually telling a huge group of developers from all over the globe that

fd leak in parent process for logger.

2013-11-11 Thread ravindrapai34
Hi All, I have server process which spawns a process for each request. Where parent process is leaking fd for logger. Please find example code. from threading import Thread from multiprocessing import Process from time import sleep import logging from uuid import uuid4 class

Implementing a multivibrator function with python

2013-11-11 Thread JL
I am trying to implement a multivibrator function with python. This is how it works; - An trigger event happens - Upon receiving the event, a variable goes high for 5secs, then go low. - If the event happens again before the 5secs expire, the high duration will be extended by another 5 secs.

Re: The narcissism of small code differences

2013-11-11 Thread Chris Angelico
On Mon, Nov 11, 2013 at 8:25 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 11/11/2013 06:50, Rick Johnson wrote: In a nutshell the author attempts to plead for the longevity of old code bases simply on the basis of his assertion that old code bases are less buggy and contain

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-11 Thread Chris Angelico
On Mon, Nov 11, 2013 at 8:28 PM, wxjmfa...@gmail.com wrote: * Some languages are just fundamentally bad. The flexible string representation is a perfect exemple. Wow. A new low for you, jmf... comparing PEP 393 to Ook?!? In fact, with such a mechanism, it is even impossible to write an

Re: datetime question

2013-11-11 Thread Νίκος Αλεξόπουλος
Στις 8/11/2013 11:11 μμ, ο/η Νίκος Αλεξόπουλος έγραψε: Is there someway to write the following line even better with the ability to detect daylight saving time by itself so i don't have to alter the line manually when time changes? lastvisit = ( datetime.utcnow() + timedelta(hours=2)

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread lorenzo . gatti
Regarding the select statement, I think the most Pythonic approach is using dictionaries rather than nested ifs. Supposing we want to decode abbreviated day names (mon) to full names (Monday): day_abbr='mon' day_names_mapping={ 'mon':'Monday', 'tue':'Tuesday', 'wed':'Wednesday',

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Chris Angelico
On Mon, Nov 11, 2013 at 9:09 PM, lorenzo.ga...@gmail.com wrote: Regarding the select statement, I think the most Pythonic approach is using dictionaries rather than nested ifs. Supposing we want to decode abbreviated day names (mon) to full names (Monday): That's an obvious mapping,

Re: Implementing a multivibrator function with python

2013-11-11 Thread Dave Angel
On Mon, 11 Nov 2013 01:41:58 -0800 (PST), JL lightai...@gmail.com wrote: - If the event happens again before the 5secs expire, the high duration will be extended by another 5 secs. This works like a retriggerable multivibrator for those who are into electronics. More precisely a retriggerable

Re: Implementing a multivibrator function with python

2013-11-11 Thread Terry Reedy
On 11/11/2013 4:41 AM, JL wrote: I am trying to implement a multivibrator function with python. This is how it works; - An trigger event happens - Upon receiving the event, a variable goes high for 5secs, then go low. - If the event happens again before the 5secs expire, the high duration will

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Steven D'Aprano
On Mon, 11 Nov 2013 21:39:27 +1100, Chris Angelico wrote: My code to handle that starts out with this array: minor weapon:({ 70,+1 weapon: 2,000gp [weapon], 85,+2 weapon: 8,000gp [weapon], 90,Specific weapon [minor specific weapon], 100,Special ability [minor special

Getting globals of the caller, not the defining module

2013-11-11 Thread Steven D'Aprano
Suppose I have a function that needs access to globals: # module A.py def spam(): g = globals() # this gets globals from A introspect(g) As written, spam() only sees its own globals, i.e. those of the module in which spam is defined. But I want spam to see the globals of the caller. #

Re: Getting globals of the caller, not the defining module

2013-11-11 Thread Chris Angelico
On Mon, Nov 11, 2013 at 10:25 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: But since spam is supposed to introspect as much information as possible, I don't really want to do that. What (if anything) are my other options? You're playing with introspection, so I'd look at

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Chris Angelico
On Mon, Nov 11, 2013 at 10:17 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 11 Nov 2013 21:39:27 +1100, Chris Angelico wrote: denormalizes it into a lookup table by creating 70 entries quoting the first string, 15 quoting the second, 5, and 10, respectively. Ewww :-(

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Robert Kern
On 2013-11-11 10:39, Chris Angelico wrote: A 'minor weapon' is based on a roll of a 100-sided dice. If it's 01 to 70, +1 weapon: 2,000gp [weapon]; if it's 71 to 85, +2 weapon: 8,000gp [weapon]; if 86 to 90, Specific weapon [minor specific weapon]; and if 91 to 100, Special ability [minor

Re: Help - Exercise Decision

2013-11-11 Thread Kennedy Salvino
Em domingo, 10 de novembro de 2013 19h56min45s UTC-3, Kennedy Salvino escreveu: I'm trying to make a ranking of 3 numbers and say which the greatest and consider whether there is a tie between them, I am not able to make the conditions of draws. Code in PT-BR:

Re: Help - Exercise Decision

2013-11-11 Thread Kennedy Salvino
My teacher asked .. I will try to do as you said. -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting globals of the caller, not the defining module

2013-11-11 Thread sg552
(Sorry for posting through GG, I'm at work.) On Monday, November 11, 2013 11:25:42 AM UTC, Steven D'Aprano wrote: Suppose I have a function that needs access to globals: # module A.py def spam(): g = globals() # this gets globals from A introspect(g) As written, spam() only

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Chris Angelico
On Mon, Nov 11, 2013 at 10:53 PM, Robert Kern robert.k...@gmail.com wrote: Heh. I've done pretty much exactly the same thing to implement an engine[1] to draw from the random tables on Abulafia[2] which have nearly the same structure. It scales up reasonably well beyond d100s. It's certainly

Re: datetime question

2013-11-11 Thread Joel Goldstick
On Mon, Nov 11, 2013 at 4:57 AM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: Στις 8/11/2013 11:11 μμ, ο/η Νίκος Αλεξόπουλος έγραψε: Is there someway to write the following line even better with the ability to detect daylight saving time by itself so i don't have to alter the line manually

Re: fd leak in parent process for logger.

2013-11-11 Thread Roy Smith
In article e0d265f9-801d-4ab2-8c82-0d9723603...@googlegroups.com, ravindrapa...@gmail.com wrote: Hi All, I have server process which spawns a process for each request. Where parent process is leaking fd for logger. Please find example code. You've got a lot of code here. The

Re: Implementing a multivibrator function with python

2013-11-11 Thread Antoon Pardon
Op 11-11-13 10:41, JL schreef: I am trying to implement a multivibrator function with python. This is how it works; - An trigger event happens - Upon receiving the event, a variable goes high for 5secs, then go low. - If the event happens again before the 5secs expire, the high duration

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Roy Smith
On Saturday, November 9, 2013 10:30:26 AM UTC-6, rusi wrote: print ( {mon:mondays suck, tue:at least it's not monday, wed:humpday }.get(day_of_week,its some other day) ) In article 8618d47d-518c-4f35-a879-57fad7525...@googlegroups.com, Rick Johnson

Re: datetime question

2013-11-11 Thread Roy Smith
In article mailman.2377.1384177268.18130.python-l...@python.org, Joel Goldstick joel.goldst...@gmail.com wrote: Why not display UTC? If it is so important to you to display local time, why do you think that your host's local time is something that is useful for a visitor? In general, it

Re: datetime question

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 1:14 AM, Roy Smith r...@panix.com wrote: We've got a data supplier who (for reasons I cannot fathom), runs their network in local time. Every time we talk to them about problems, it's a mess just trying to figure out what time we're talking about. We say, we saw a

Re: datetime question

2013-11-11 Thread Joel Goldstick
So this is a physics joke. The engineers and physicists at the conference went to dinner. They ordered wine with dinner. The wait person asked: Would you like the small liter, or the large liter? -- Joel Goldstick http://joelgoldstick.com --

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-11 Thread Mark Lawrence
On 11/11/2013 09:28, wxjmfa...@gmail.com wrote: * Some languages are just fundamentally bad. The flexible string representation is a perfect exemple. Again, a short explanation: This FSR splits unicode in chunks. Two immediate consequences: - It's necessary to keep track of each individual

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread rusi
On Monday, November 11, 2013 7:31:07 PM UTC+5:30, Roy Smith wrote: On Saturday, November 9, 2013 10:30:26 AM UTC-6, rusi wrote: print ( {mon:mondays suck, tue:at least it's not monday, wed:humpday }.get(day_of_week,its some other day) ) Rick

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Neil Cerutti
On Saturday, November 9, 2013 8:27:02 AM UTC-5, Joshua Landau wrote: The C switch statement is very limited. The select statement in the dialect of BASIC I regularly use is more flexible. It's more concise on long if chains because it elides the end ifs. But the use of indentation for

Install Tkinter for Windows 7 64-bit

2013-11-11 Thread jonas . thornvall
I have installed Python 3.3, and i want to add a library with some basic functions like canvas and basic geomteric objects, fonts etc. Preferably something similar to the Javascript canvas. I've looked for graphic packages, and from what i can see something called Tkinter may be what i look

Re: Install Tkinter for Windows 7 64-bit

2013-11-11 Thread Tim Golden
On 11/11/2013 16:38, jonas.thornv...@gmail.com wrote: I have installed Python 3.3, and i want to add a library with some basic functions like canvas and basic geomteric objects, fonts etc. Preferably something similar to the Javascript canvas. I've looked for graphic packages, and from what

Re: Install Tkinter for Windows 7 64-bit

2013-11-11 Thread Tim Golden
On 11/11/2013 16:38, jonas.thornv...@gmail.com wrote: === Traceback (most recent call last): File D:\Python33\test2.py, line 16, in module from Tkinter import Tk, Canvas, Frame, BOTH ImportError: No module named 'Tkinter' === In addition, I really don't recommend running your test scripts

Re: Install Tkinter for Windows 7 64-bit

2013-11-11 Thread jonas . thornvall
Here is the example file i have tried. #!/usr/bin/python # -*- coding: utf-8 -*- ZetCode Tkinter tutorial This program draws three rectangles filled with different colors. author: Jan Bodar last modified: January 2011 website: www.zetcode.com from Tkinter import Tk, Canvas, Frame, BOTH

Re: Install Tkinter for Windows 7 64-bit

2013-11-11 Thread Mark Lawrence
On 11/11/2013 16:38, jonas.thornv...@gmail.com wrote: I have installed Python 3.3, and i want to add a library with some basic functions like canvas and basic geomteric objects, fonts etc. Preferably something similar to the Javascript canvas. I've looked for graphic packages, and from what i

Re: Install Tkinter for Windows 7 64-bit

2013-11-11 Thread Chris “Kwpolska” Warrick
On Mon, Nov 11, 2013 at 5:38 PM, jonas.thornv...@gmail.com wrote: But i have no luck runn the Tkinter example file i downloaded in idel, it still says no module called Tkinter. IDLE* === Traceback (most recent call last): File D:\Python33\test2.py, line 16, in module from Tkinter

Re: Install Tkinter for Windows 7 64-bit

2013-11-11 Thread jonas . thornvall
Den måndagen den 11:e november 2013 kl. 17:43:12 UTC+1 skrev Chris “Kwpolska” Warrick: On Mon, Nov 11, 2013 at 5:38 PM, jonas.thornv...@gmail.com wrote: But i have no luck runn the Tkinter example file i downloaded in idel, it still says no module called Tkinter. IDLE* ===

Re: Install Tkinter for Windows 7 64-bit

2013-11-11 Thread MRAB
On 11/11/2013 16:43, jonas.thornv...@gmail.com wrote: Here is the example file i have tried. #!/usr/bin/python # -*- coding: utf-8 -*- ZetCode Tkinter tutorial This program draws three rectangles filled with different colors. author: Jan Bodar last modified: January 2011 website:

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-11 Thread Ethan Furman
On 11/11/2013 01:28 AM, wxjmfa...@gmail.com wrote: * Some languages are just fundamentally bad. The flexible string representation is a perfect exemple. Argh! He escaped! *chase* *scuffle* *stuff* *stuff* *stuff* Whew. Safely back in the troll bin. Okay, back to my day. -- ~Ethan~ --

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-11 Thread 88888 Dihedral
On Sunday, November 10, 2013 4:56:38 PM UTC+8, Jorgen Grahn wrote: On Sun, 2013-11-10, Chris Angelico wrote: On Sun, Nov 10, 2013 at 11:41 AM, Roy Smith r...@panix.com wrote: On 09/11/2013 22:58, Chris Angelico wrote: * Some languages are just fundamentally bad. I do not

Re: datetime question

2013-11-11 Thread Denis McMahon
On Mon, 11 Nov 2013 11:57:36 +0200, Νίκος Αλεξόπουλος wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime format Someone has an idea what to add to this line to automatically adjust itself if DST happens? Yes, but the

Re: datetime question

2013-11-11 Thread Ethan Furman
On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, Νίκος Αλεξόπουλος wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime format Someone has an idea what to add to this line to automatically

dateutil.relativedelta.WE and friends?

2013-11-11 Thread Skip Montanaro
I found a rather inscrutable use of dateutil recurrence rules in StackOverflow which generates a series of dates corresponding to the third Wednesday of the month: import dateutil.rrule as dr import dateutil.relativedelta as drel dt = datetime.datetime(2012, 1, 1, 0, 0) rule =

Re: dateutil.relativedelta.WE and friends?

2013-11-11 Thread Skip Montanaro
damn gmail. Please ignore the drivel below (and this top post)... Skip On Mon, Nov 11, 2013 at 2:33 PM, Skip Montanaro s...@pobox.com wrote: I found a rather inscrutable use of dateutil recurrence rules in StackOverflow which generates a series of dates corresponding to the third Wednesday of

'isimmutable' and 'ImmutableNester'

2013-11-11 Thread Frank-Rene Schäfer
I prepared a PEP and was wondering what your thoughts are about it: PEP:pep number Title: ``isimmutable(Obj)`` and/or ``ImmutableNester`` Version:version string Last-Modified: date string Author: Frank-Rene Schaefer, fsch...@users.sourceforge.net *

Re: datetime question

2013-11-11 Thread Grant Edwards
On 2013-11-11, Ethan Furman et...@stoneleaf.us wrote: On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, ?? ?? wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime format

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Joshua Landau
On 11 November 2013 10:39, Chris Angelico ros...@gmail.com wrote: On Mon, Nov 11, 2013 at 9:09 PM, lorenzo.ga...@gmail.com wrote: Regarding the select statement, I think the most Pythonic approach is using dictionaries rather than nested ifs. Supposing we want to decode abbreviated day names

Re: 'isimmutable' and 'ImmutableNester'

2013-11-11 Thread Ned Batchelder
On Monday, November 11, 2013 3:47:45 PM UTC-5, Frank-Rene Schäfer wrote: I prepared a PEP and was wondering what your thoughts are about it: The best place to discuss proposals for changes to the Python language and library is the Python-Ideas mailing list:

Re: 'isimmutable' and 'ImmutableNester'

2013-11-11 Thread random832
A built-in function 'isimmutable()' shall tell efficiently whether the object of concern is mutable or not. What's the benefit over attempting to hash() the object? copy.deepcopy already has special case for int, string, and tuples (including tuples that do and do not have mutable members) -

UTF-32 decoder optimization in Python 3.4

2013-11-11 Thread Mark Lawrence
From http://docs.python.org/dev/whatsnew/3.4.html#optimizations The UTF-32 decoder is now 3x to 4x faster.. Does anybody have any references to this work? All I can find is the 3.3 what's new which refers to PEP 393 (Flexible String Representation) optimizations as a result of work done by

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 7:50 AM, Joshua Landau jos...@landau.ws wrote: The obvious way to me is a binary search: Which makes an O(log n) search where I have an O(1) lookup. The startup cost of denormalization doesn't scale, so when the server keeps running for two years or more, it's definitely

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Mark Janssen
On Mon, Nov 11, 2013 at 3:32 AM, Chris Angelico ros...@gmail.com wrote: On Mon, Nov 11, 2013 at 10:17 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 11 Nov 2013 21:39:27 +1100, Chris Angelico wrote: denormalizes it into a lookup table by creating 70 entries quoting the

Creating a function for a directory

2013-11-11 Thread Matt
So I want to take the file, desktop/test.txt and write it to desktop/newfolder/test.txt. I tried the below script, and it gave me: IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'. Any suggestions would be great. def firstdev(file): in_file = open(desktop/%s.txt) % file

Re: Creating a function for a directory

2013-11-11 Thread Joel Goldstick
On Mon, Nov 11, 2013 at 5:26 PM, Matt mattgrav...@gmail.com wrote: So I want to take the file, desktop/test.txt and write it to desktop/newfolder/test.txt. I tried the below script, and it gave me: IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'. Any suggestions would be

Re: Creating a function for a directory

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 9:26 AM, Matt mattgrav...@gmail.com wrote: So I want to take the file, desktop/test.txt and write it to desktop/newfolder/test.txt. I tried the below script, and it gave me: IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'. Any suggestions would be

Re: Creating a function for a directory

2013-11-11 Thread bob gailer
On 11/11/2013 5:26 PM, Matt wrote: So I want to take the file, desktop/test.txt and write it to desktop/newfolder/test.txt. I tried the below script, and it gave me: IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'. Any suggestions would be great. def firstdev(file):

Re: Creating a function for a directory

2013-11-11 Thread Joel Goldstick
Sorry for incorect answer. Those guys nailed it On Nov 11, 2013 5:43 PM, bob gailer bgai...@gmail.com wrote: On 11/11/2013 5:26 PM, Matt wrote: So I want to take the file, desktop/test.txt and write it to desktop/newfolder/test.txt. I tried the below script, and it gave me: IOError: [Errno

Re: Creating a function for a directory

2013-11-11 Thread Mark Lawrence
On 11/11/2013 22:26, Matt wrote: So I want to take the file, desktop/test.txt and write it to desktop/newfolder/test.txt. I tried the below script, and it gave me: IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'. Any suggestions would be great. def firstdev(file):

Re: To whoever hacked into my Database

2013-11-11 Thread rurpy
On 11/08/2013 11:08 AM, Chris Angelico wrote: On Sat, Nov 9, 2013 at 4:11 AM, ru...@yahoo.com wrote: On 11/08/2013 03:05 AM, Νίκος Αλεξόπουλος wrote: I never ignore advices. I read all answers as carefully as i can. But nevertheless sometimes i feel things should have been better

Re: datetime question

2013-11-11 Thread rurpy
On Friday, November 8, 2013 3:06:33 PM UTC-7, Joel Goldstick wrote: rurpy? can you help? No, sorry. For your future reference, if there is a question I can help with (have the technical knowledge, haven't seen a good answer yet, have time, etc) I will post my attempt at an answer. So lack

Re: Creating a function for a directory

2013-11-11 Thread Rick Johnson
On Monday, November 11, 2013 4:26:46 PM UTC-6, Matt wrote: So I want to take the file, desktop/test.txt and write it to desktop/newfolder/test.txt. I tried the below script, and it gave me: IOError: [Errno 2] No such file or directory: 'desktop/%s.txt'. Any suggestions would be great. def

Re: Creating a function for a directory

2013-11-11 Thread Matt
Thank you guys so much. Brain fart moment. I appreciate it -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a function for a directory

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 9:51 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: On Monday, November 11, 2013 4:26:46 PM UTC-6, Matt wrote: So I want to take the file, desktop/test.txt and write it to desktop/newfolder/test.txt. I tried the below script, and it gave me: IOError: [Errno 2] No

Re: datetime question

2013-11-11 Thread Joel Goldstick
On Mon, Nov 11, 2013 at 5:49 PM, ru...@yahoo.com wrote: On Friday, November 8, 2013 3:06:33 PM UTC-7, Joel Goldstick wrote: rurpy? can you help? No, sorry. For your future reference, if there is a question I can help with (have the technical knowledge, haven't seen a good answer yet, have

Re: datetime question

2013-11-11 Thread mm0fmf
On 11/11/2013 19:39, Ethan Furman wrote: On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, Νίκος Αλεξόπουλος wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime format Someone has an idea what

Re: datetime question

2013-11-11 Thread Mark Lawrence
On 11/11/2013 23:21, mm0fmf wrote: On 11/11/2013 19:39, Ethan Furman wrote: On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, Νίκος Αλεξόπουλος wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime

Re: To whoever hacked into my Database

2013-11-11 Thread Joel Goldstick
On Mon, Nov 11, 2013 at 5:47 PM, ru...@yahoo.com wrote: On 11/08/2013 11:08 AM, Chris Angelico wrote: On Sat, Nov 9, 2013 at 4:11 AM, ru...@yahoo.com wrote: On 11/08/2013 03:05 AM, Νίκος Αλεξόπουλος wrote: I never ignore advices. I read all answers as carefully as i can. But nevertheless

Re: PyWart: Python modules are not so modular after all!

2013-11-11 Thread Rick Johnson
On Monday, November 11, 2013 1:34:54 AM UTC-6, Steven D'Aprano wrote: import sys sys.modules[mymodule] = any_object_you_like() Thanks for this great advice! I'm not particularly fond of injecting names and objects in this manner due to the surprise factor, especially when the names are going

Re: To whoever hacked into my Database

2013-11-11 Thread Mark Lawrence
On 11/11/2013 23:49, Joel Goldstick wrote: On Mon, Nov 11, 2013 at 5:47 PM, ru...@yahoo.com wrote: Lets get this right folks once and for all. Let's carry on welcoming Nikos with open arms as he's such a wonderful benefactor to the community, but ban people such as Matt who had the

Re: 'isimmutable' and 'ImmutableNester'

2013-11-11 Thread Steven D'Aprano
On Mon, 11 Nov 2013 12:55:56 -0800, Ned Batchelder wrote: On Monday, November 11, 2013 3:47:45 PM UTC-5, Frank-Rene Schäfer wrote: I prepared a PEP and was wondering what your thoughts are about it: The best place to discuss proposals for changes to the Python language and library is the

Re: 'isimmutable' and 'ImmutableNester'

2013-11-11 Thread Mark Lawrence
On 12/11/2013 00:17, Steven D'Aprano wrote: On Mon, 11 Nov 2013 12:55:56 -0800, Ned Batchelder wrote: On Monday, November 11, 2013 3:47:45 PM UTC-5, Frank-Rene Schäfer wrote: I prepared a PEP and was wondering what your thoughts are about it: The best place to discuss proposals for changes

Re: Creating a function for a directory

2013-11-11 Thread Steven D'Aprano
On Mon, 11 Nov 2013 14:51:45 -0800, Rick Johnson wrote: 2. Never, ever, *EVER* write data to disc before confirming the paths your passing are pointing to the location you intended to write the data. Use os.path.exists(path) to test your paths BEFORE trying to write data. This is subject to

Re: To whoever hacked into my Database

2013-11-11 Thread Ned Batchelder
On Monday, November 11, 2013 5:47:28 PM UTC-5, ru...@yahoo.com wrote: On 11/08/2013 11:08 AM, Chris Angelico wrote: On Sat, Nov 9, 2013 at 4:11 AM, ru...@yahoo.com wrote: On 11/08/2013 03:05 AM, Νίκος Αλεξόπουλος wrote: I never ignore advices. I read all answers as carefully as i can.

Stop feeding the Ferrous Cranus troll

2013-11-11 Thread Chuck Quast
http://www.politicsforum.org/images/flame_warriors/flame_62.php why are any of you replying? -- https://mail.python.org/mailman/listinfo/python-list

Where to handle try-except - close to the statement, or in outer loop?

2013-11-11 Thread Victor Hooi
Hi, I have a general question regarding try-except handling in Python. Previously, I was putting the try-handle blocks quite close to where the errors occured: A somewhat contrived example: if __name__ == __main__: my_pet = Dog('spot', 5, 'brown') my_pet.feed()

Re: 'isimmutable' and 'ImmutableNester'

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 11:17 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 11 Nov 2013 12:55:56 -0800, Ned Batchelder wrote: On Monday, November 11, 2013 3:47:45 PM UTC-5, Frank-Rene Schäfer wrote: I prepared a PEP and was wondering what your thoughts are about it:

Re: Creating a function for a directory

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 9:44 AM, Joel Goldstick joel.goldst...@gmail.com wrote: Sorry for incorect answer. Those guys nailed it Your answer wasn't incorrect, because it didn't give any false information. Bob and I saw the problem itself and gave advice, but you gave useful general advice on how

Re: Programa no modo gráfico

2013-11-11 Thread Elias de Oliveira
Also, we have a huge community in Brazil. If you want to write in Portuguese, you could use the official python-brasil list: https://groups.google.com/forum/#!forum/python-brasil []`s 2013/11/8 Izar Tarandach izar.tarand...@gmail.com You can find many resources for GUI programming in Python

Re: 'isimmutable' and 'ImmutableNester'

2013-11-11 Thread Steven D'Aprano
Hi Frank-Rene, and welcome. Comments below. On Mon, 11 Nov 2013 21:47:45 +0100, Frank-Rene Schäfer wrote: I prepared a PEP and was wondering what your thoughts are about it: PEP:pep number Title: ``isimmutable(Obj)`` and/or ``ImmutableNester`` [...] *

Re: توقيت وموعد اذاعة مباراة الزمالك ووادى دجلة فى نهائى كأس مصر اليوم السبت 9/11/2013 والقنوات الناقلة

2013-11-11 Thread alex23
On 12/11/2013 6:32 AM, Tony the Tiger wrote: May your woman betray you, your son be gay, and your daughter screw pigs for a living. Now go eat some pork and choke on it, like a good little terrorist. This is completely unacceptable and has no place on this list. --

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Joshua Landau
On 11 November 2013 22:21, Chris Angelico ros...@gmail.com wrote: On Tue, Nov 12, 2013 at 7:50 AM, Joshua Landau jos...@landau.ws wrote: The obvious way to me is a binary search: Which makes an O(log n) search where I have an O(1) lookup. The startup cost of denormalization doesn't scale, so

Re: Where to handle try-except - close to the statement, or in outer loop?

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 12:34 PM, Victor Hooi victorh...@gmail.com wrote: Would I wrap all of the calls in a try-except block? try: my_pet.feed() my_pet.shower() except IOError as e: # Do something to handle exception? It really depends more on how you go

Re: Getting globals of the caller, not the defining module

2013-11-11 Thread Terry Reedy
On 11/11/2013 7:02 AM, sg...@hotmail.co.uk wrote: (Sorry for posting through GG, I'm at work.) On Monday, November 11, 2013 11:25:42 AM UTC, Steven D'Aprano wrote: Suppose I have a function that needs access to globals: # module A.py def spam(): g = globals() # this gets globals from A

Re: datetime question

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 12:59 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: Of course, I'm spoiled... My /watch/ has a dial for UTC, along with one for 24-hour indication (one hand, range 1 to 24) Heh. Mine doesn't, so I bought myself a second watch and set it to UTC. So my left

Re: When I send email as HTML, why do erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ???

2013-11-11 Thread Richard Balbat
On Saturday, November 9, 2013 2:29:00 AM UTC-5, dieter wrote: rich writes: Dieter, you were right!!! I broke up the string by inserting CRLF before I reached 72 chars / line. Problem solved! I have the following script that reads in an HTML file containing a table then sends it out

Re: Where to handle try-except - close to the statement, or in outer loop?

2013-11-11 Thread Steven D'Aprano
On Mon, 11 Nov 2013 17:34:21 -0800, Victor Hooi wrote: Hi, I have a general question regarding try-except handling in Python. Previously, I was putting the try-handle blocks quite close to where the errors occured: A somewhat contrived example: if __name__ == __main__:

PyMyth: Global variables are evil... WRONG!

2013-11-11 Thread Rick Johnson
PyMyth: Global variables are evil... WRONG! Python's Global Hysteria: How many times have your heard or read the phrase: Global variables are evil? Well if you've been a

Re: UTF-32 decoder optimization in Python 3.4

2013-11-11 Thread Terry Reedy
On 11/11/2013 4:41 PM, Mark Lawrence wrote: From http://docs.python.org/dev/whatsnew/3.4.html#optimizations The UTF-32 decoder is now 3x to 4x faster.. Does anybody have any references to this work? All I can find is the 3.3 what's new which refers to PEP 393 (Flexible String Representation)

Re: PyMyth: Global variables are evil... WRONG!

2013-11-11 Thread Tim Daneliuk
On 11/11/2013 08:06 PM, Rick Johnson wrote: Globals are justified when they are used to communicate information between scopes that otherwise were meant to be mutually exclusive. I think this is certainly the use case most people would suggest. But I think you may have missed the real reason

Re: Where to handle try-except - close to the statement, or in outer loop?

2013-11-11 Thread Terry Reedy
On 11/11/2013 8:34 PM, Victor Hooi wrote: I have a general question regarding try-except handling in Python. In Python, try-except can unapologetically be used as as alternate conditional-execution control-flow construct. if condition: do something else: do something else can often be

Reading c struct via python

2013-11-11 Thread Lakshmipathi.G
Hi - We have C code which writes following struct into berkeley db (my_db.db). struct my_info { unsigned long int i, e; int o; char *f; char *s; }; How to read this via Python? Google search gave this code --- $ cat pybsd2.py from bsddb import db fruitDB = db.DB()

Re: PyMyth: Global variables are evil... WRONG!

2013-11-11 Thread Rick Johnson
On Monday, November 11, 2013 8:47:09 PM UTC-6, Tim Daneliuk wrote: I think this is certainly the use case most people would suggest. But I think you may have missed the real reason most modern designers object to inter-module globals: The presence of such entities almost always means the code

Re: datetime question

2013-11-11 Thread Grant Edwards
On 2013-11-11, Mark Lawrence breamore...@yahoo.co.uk wrote: On 11/11/2013 23:21, mm0fmf wrote: On 11/11/2013 19:39, Ethan Furman wrote: On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, ?? ?? wrote: lastvisit = ( datetime.utcnow()

Re: PyMyth: Global variables are evil... WRONG!

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 3:46 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: But python modules can't be interfaces because interfaces should protect internal data, prevent external forces from meddling with internal state (EXCEPT via the rules of a predefined contract), hide dirty

Re: To whoever hacked into my Database

2013-11-11 Thread Gregory Ewing
Ned Batchelder wrote: I don't know how best to make things better overall. I know that overlooking Nikos' faults won't do it. If everyone who reached the point where they don't think they can help any more would simply say so in a calm manner and then walk away, that would make things better

Re: Creating a function for a directory

2013-11-11 Thread Rick Johnson
On Monday, November 11, 2013 5:11:52 PM UTC-6, Chris Angelico wrote: On Tue, Nov 12, 2013 at 9:51 AM, Rick Johnson 1. i believe win32 file paths require a qualifying volume letter. They do not; omitting the drive letter makes the path relative to the current drive (and since it doesn't

Re: Buffering of sys.stdout and sys.stderr in python3 (and documentation)

2013-11-11 Thread swatkins
It's surprising and broken that stderr should be buffered in python3. python3 calls setvbuf(3) on stderr at startup to achieve this chuckle-headed behavior. It makes stderr line buffered if on a terminal, and fully buffered if redirected to a log file. A fully buffered stderr is a very bad

Re: Buffering of sys.stdout and sys.stderr in python3 (and documentation)

2013-11-11 Thread swatkins
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0) which unfortunately doesn't work! I guess will resort to python3 -u, although I don't want stdout to be unbuffered. -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   >