Re: Sorting dictionary by datetime value

2014-02-08 Thread Frank Millman
Chris Angelico ros...@gmail.com wrote in message news:captjjmqdusdfc1elbu6lf5-up__lae-63ii0uuvaggnem9u...@mail.gmail.com... On Sat, Feb 8, 2014 at 6:06 PM, Igor Korot ikoro...@gmail.com wrote: sorted(a.items(), key=a.get) [('1', datetime.datetime(2012, 12, 28, 12, 15, 30, 100)), ('3',

Re: Sorting dictionary by datetime value

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 6:53 PM, Igor Korot ikoro...@gmail.com wrote: Chris, On Fri, Feb 7, 2014 at 11:09 PM, Chris Angelico ros...@gmail.com wrote: On Sat, Feb 8, 2014 at 6:06 PM, Igor Korot ikoro...@gmail.com wrote: sorted(a.items(), key=a.get) [('1', datetime.datetime(2012, 12, 28, 12, 15,

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 9:41:53 AM UTC+2, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in them. Searching the web has given me a few ideas. Each has its pro's

Re: Sorting dictionary by datetime value

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 7:03 PM, Frank Millman fr...@chagford.com wrote: I am using python3. I don't know if that makes a difference, but I cannot get it to work. d = {1: 'abc', 2: 'xyz', 3: 'pqr'} sorted(d.items(), key=d.get) Traceback (most recent call last): File stdin, line 1, in

Re: Sorting dictionary by datetime value

2014-02-08 Thread Frank Millman
Frank Millman fr...@chagford.com wrote in message news:ld4ocf$9rg$1...@ger.gmane.org... Chris Angelico ros...@gmail.com wrote in message news:captjjmqdusdfc1elbu6lf5-up__lae-63ii0uuvaggnem9u...@mail.gmail.com... On Sat, Feb 8, 2014 at 6:06 PM, Igor Korot ikoro...@gmail.com wrote:

Re: Possible bug with stability of mimetypes.guess_* function output

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 9:51:48 AM UTC+2, Peter Otten wrote: At least the mimetypes already defined in the module could easily produce the same guessed extension consistently. imho one workaround for OP could be to supply own map file in init() thus ensure unambiguous mapping across

Fwd: Sorting dictionary by datetime value

2014-02-08 Thread Igor Korot
-- Forwarded message -- From: Igor Korot ikoro...@gmail.com Date: Sat, Feb 8, 2014 at 12:25 AM Subject: Re: Sorting dictionary by datetime value To: Chris Angelico ros...@gmail.com Chris, On Fri, Feb 7, 2014 at 11:58 PM, Chris Angelico ros...@gmail.com wrote: On Sat, Feb 8,

Re: Sorting dictionary by datetime value

2014-02-08 Thread Peter Otten
Frank Millman wrote: Chris Angelico ros...@gmail.com wrote in message news:captjjmqdusdfc1elbu6lf5-up__lae-63ii0uuvaggnem9u...@mail.gmail.com... On Sat, Feb 8, 2014 at 6:06 PM, Igor Korot ikoro...@gmail.com wrote: sorted(a.items(), key=a.get) [('1', datetime.datetime(2012, 12, 28, 12, 15,

Re: Sorting dictionary by datetime value

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 7:25 PM, Igor Korot ikoro...@gmail.com wrote: Try this: sorted_items = sorted(my_dict.keys(), key=my_dict.get) for key in sorted_items: print my_dict[key], key This code fail. sorted_item is a list of tuples. And so iterating the list in the for loop I will get

Re: Sorting dictionary by datetime value

2014-02-08 Thread Igor Korot
Thank you. That worked. And no, I didn't notice that change. :( On Sat, Feb 8, 2014 at 12:29 AM, Chris Angelico ros...@gmail.com wrote: On Sat, Feb 8, 2014 at 7:25 PM, Igor Korot ikoro...@gmail.com wrote: Try this: sorted_items = sorted(my_dict.keys(), key=my_dict.get) for key in

Re: Possible bug with stability of mimetypes.guess_* function output

2014-02-08 Thread Peter Otten
Asaf Las wrote: On Saturday, February 8, 2014 9:51:48 AM UTC+2, Peter Otten wrote: At least the mimetypes already defined in the module could easily produce the same guessed extension consistently. imho one workaround for OP could be to supply own map file in init() thus ensure

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Rustom Mody
On Saturday, February 8, 2014 1:11:53 PM UTC+5:30, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in them. Searching the web has given me a few ideas. Each has its pro's

datetime formatting output

2014-02-08 Thread Igor Korot
Hi, ALL, I am reading data from the DB (mySQL) where the datetime field is stored as: 2012-12-12 23:59:59.099 When I retrieve this date I am successfully see under debugger the dateteime object with (2012, 12, 12, 23, 59, 59, 099) However as you can see from my previous post this date shows up

Re: datetime formatting output

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 7:40 PM, Igor Korot ikoro...@gmail.com wrote: I am reading data from the DB (mySQL) where the datetime field is stored as: 2012-12-12 23:59:59.099 When I retrieve this date I am successfully see under debugger the dateteime object with (2012, 12, 12, 23, 59, 59, 099)

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Peter Otten
cstrutto...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in them. Searching the web has given me a few ideas. Each has its pro's and cons. The best I have come up with is:

Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Sam
I am writing my first python script to access MySQL database. With reference to http://mysql-python.sourceforge.net/MySQLdb.html#connection-objects Why is it advisable to use _mysql and not MySQLdb module directly? -- https://mail.python.org/mailman/listinfo/python-list

What is the recommended python module for SQL database access?

2014-02-08 Thread Sam
Is MySQLdb the recommended python module for SQL database access? Are there other modules? What I want in a module is to be able to write readable and maintainable code. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 7:52 PM, Sam lightai...@gmail.com wrote: I am writing my first python script to access MySQL database. With reference to http://mysql-python.sourceforge.net/MySQLdb.html#connection-objects Why is it advisable to use _mysql and not MySQLdb module directly? Other way

Re: What is the recommended python module for SQL database access?

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 7:55 PM, Sam lightai...@gmail.com wrote: Is MySQLdb the recommended python module for SQL database access? Are there other modules? What I want in a module is to be able to write readable and maintainable code. As long as you use some module that speaks the Python

Fwd: datetime formatting output

2014-02-08 Thread Igor Korot
-- Forwarded message -- From: Igor Korot ikoro...@gmail.com Date: Sat, Feb 8, 2014 at 1:06 AM Subject: Re: datetime formatting output To: Chris Angelico ros...@gmail.com Chris, On Sat, Feb 8, 2014 at 12:45 AM, Chris Angelico ros...@gmail.com wrote: On Sat, Feb 8, 2014 at 7:40

Re: datetime formatting output

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 8:06 PM, Igor Korot ikoro...@gmail.com wrote: P.S.: Maybe its a problem with the datetime module which formats the datetime incorrectly? No, I'm pretty sure datetime.datetime really is meant to be working with microseconds. I'm not very familiar with MySQLdb, haven't used

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread cstrutton11
On Saturday, February 8, 2014 3:35:34 AM UTC-5, Rustom Mody wrote: On Saturday, February 8, 2014 1:11:53 PM UTC+5:30, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in

Re: datetime formatting output

2014-02-08 Thread Igor Korot
Thank you Chris. On Sat, Feb 8, 2014 at 1:10 AM, Chris Angelico ros...@gmail.com wrote: On Sat, Feb 8, 2014 at 8:06 PM, Igor Korot ikoro...@gmail.com wrote: P.S.: Maybe its a problem with the datetime module which formats the datetime incorrectly? No, I'm pretty sure datetime.datetime

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread cstrutton11
On Saturday, February 8, 2014 3:13:54 AM UTC-5, Asaf Las wrote: note, due to strings are immutable - for every line in sum operation above you produce new object and throw out older one. you can write one string spanned at multiple lines in very clear form. I get what your saying

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread cstrutton11
On Saturday, February 8, 2014 3:13:54 AM UTC-5, Asaf Las wrote: note, due to strings are immutable - for every line in sum operation above you produce new object and throw out older one. you can write one string spanned at multiple lines in very clear form. /Asaf I think I going

Re: Using virtualenv to bypass sudoer issues

2014-02-08 Thread Glenn Hutchings
On 06/02/14 17:32, Jean-Michel Pichavant wrote: Assuming I have a debian workstation for which I don't have any sudo rights, in order to be able to install / remove python packages, should I be using virtualenv ? Is it a suited solution ? It depends on whether you need to share the

Re: Possible bug with stability of mimetypes.guess_* function output

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 10:39:06 AM UTC+2, Peter Otten wrote: Asaf Las wrote: On Saturday, February 8, 2014 9:51:48 AM UTC+2, Peter Otten wrote: At least the mimetypes already defined in the module could easily produce the same guessed extension consistently. imho one workaround for

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Steven D'Aprano
On Sat, 08 Feb 2014 01:56:46 -0800, cstrutton11 wrote: On Saturday, February 8, 2014 3:13:54 AM UTC-5, Asaf Las wrote: note, due to strings are immutable - for every line in sum operation above you produce new object and throw out older one. you can write one string spanned at multiple lines

Re: how to reduce bugs due to incorrect indentation

2014-02-08 Thread Jurko Gospodnetić
Hi, On 7.2.2014. 2:20, msus...@gmail.com wrote: Based on the responses I arrived to the conclusion that there is no better solution than trying to be careful and have good testing suites. It would be possible to disable the Tab key completely ...[snipped]... Maybe a coloring of the

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 10:52:36 AM UTC+2, Sam wrote: I am writing my first python script to access MySQL database. With reference to http://mysql-python.sourceforge.net/MySQLdb.html#connection-objects Why is it advisable to use _mysql and not MySQLdb module directly? I used this one

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 10:09 PM, Asaf Las roeg...@gmail.com wrote: I used this one from Oracle and it was OK for simple test case and supports from 2.6 till 3.3: http://dev.mysql.com/doc/connector-python/en/index.html https://pypi.python.org/pypi/mysql-connector-python/1.1.5 yet there is

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 11:56:46 AM UTC+2, cstru...@gmail.com wrote: On Saturday, February 8, 2014 3:13:54 AM UTC-5, Asaf Las wrote: note, due to strings are immutable - for every line in sum operation above you produce new object and throw out older one. you can

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 1:25:15 PM UTC+2, Chris Angelico wrote: On Sat, Feb 8, 2014 at 10:09 PM, Asaf Las r...@gmail.com wrote: I used this one from Oracle and it was OK for simple test case and supports from 2.6 till 3.3: http://dev.mysql.com/doc/connector-python/en/index.html

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 10:32 PM, Asaf Las roeg...@gmail.com wrote: Hi Chris The doc says https://pypi.python.org/pypi/mysql-connector-python/1.1.5 MySQL driver written in Python which does not depend on MySQL C client libraries and implements the DB API v2.0 specification (PEP-249). Ah. And

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 1:42:30 PM UTC+2, Chris Angelico wrote: On Sat, Feb 8, 2014 at 10:32 PM, Asaf Las r...@gmail.com wrote: Hi Chris The doc says https://pypi.python.org/pypi/mysql-connector-python/1.1.5 MySQL driver written in Python which does not depend on MySQL C client

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Roy Smith
In article 3157d511-48d1-4e4d-be4c-2c461fc17...@googlegroups.com, Rustom Mody rustompm...@gmail.com wrote: On Saturday, February 8, 2014 1:11:53 PM UTC+5:30, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Rustom Mody
On Saturday, February 8, 2014 4:58:03 PM UTC+5:30, Asaf Las wrote: Check this approach if it suits you: str_t= 'script type=text/javascript' \ 'src=/{0}/jquery/jqueryui.js/script' \ 'script type=text/javascript'\ 'src=/{1}/jquery/jquery.js/script'.format('bella', 'donna')

Re: Finding size of Variable

2014-02-08 Thread Mark Lawrence
On 08/02/2014 02:48, Steven D'Aprano wrote: On Thu, 06 Feb 2014 05:51:54 -0800, wxjmfauth wrote: Sorry, I'm only pointing you may lose memory when working with short strings as it was explained. I really, very really, do not see what is absurd or obsure in: sys.getsizeof('abc' + 'EURO') 46

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Mark Lawrence
On 08/02/2014 10:11, cstrutto...@gmail.com wrote: On Saturday, February 8, 2014 3:13:54 AM UTC-5, Asaf Las wrote: note, due to strings are immutable - for every line in sum operation above you produce new object and throw out older one. you can write one string spanned at multiple lines in

What does means in python?

2014-02-08 Thread Sam
For string, one uses to represent string. Below is a code fragment that uses instead. cursor.execute(SELECT name, phone_number FROM coworkers WHERE name=%s AND clue %s LIMIT 5, (name, clue_threshold))

Re: What does means in python?

2014-02-08 Thread Roy Smith
In article 72a7dd52-7619-4520-991e-20db7ce55...@googlegroups.com, Sam lightai...@gmail.com wrote: For string, one uses to represent string. Below is a code fragment that uses instead. cursor.execute(SELECT name, phone_number FROM coworkers WHERE

Re: Sorting dictionary by datetime value

2014-02-08 Thread Tim Chase
On 2014-02-08 19:29, Chris Angelico wrote: On Sat, Feb 8, 2014 at 7:25 PM, Igor Korot ikoro...@gmail.com wrote: Try this: sorted_items = sorted(my_dict.keys(), key=my_dict.get) This code fail. Actually, it's a list of keys - notice that I changed my_dict.items() into

.pyc file import errors

2014-02-08 Thread dejmail
hi everyone I have a Flask app (in virtualenv, installed with --no-site-packages) running on Apache 2.4 with mod_wsgi, python2.7. When I leave it up to Apache to activate the Virtualenv, and I perform the URL request, I start getting alot of errors in the logs. It seems to want to create .pyc

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Dave Angel
cstrutto...@gmail.com Wrote in message: I didn't realize I could use formatting with triple quoted strings. I will look into that. You probably realize this, but formatting does not work on literals of any kind. It works on str objects, which can be created by any kind of literal,

Re: Using virtualenv to bypass sudoer issues

2014-02-08 Thread Jussi Piitulainen
Glenn Hutchings writes: On 06/02/14 17:32, Jean-Michel Pichavant wrote: Assuming I have a debian workstation for which I don't have any sudo rights, in order to be able to install / remove python packages, should I be using virtualenv ? Is it a suited solution ? It depends on

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Eric S. Johansson
On 2/8/2014 3:35 AM, Rustom Mody wrote: On Saturday, February 8, 2014 1:11:53 PM UTC+5:30, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in them. Searching the web has

urllib2: correct way how to add a header to the *initial* request?

2014-02-08 Thread Matěj Cepl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, this is probably a dumb question but I just cannot find a way how to create AuthHandler which would add Authorization header to the FIRST request. The only thing I see in urllib2.py are various http_error handler which add Authorization header

urllib2: correct way how to add a header to the *initial* request?

2014-02-08 Thread Matěj Cepl
Hi, this is probably a dumb question but I just cannot find a way how to create AuthHandler which would add Authorization header to the FIRST request. The only thing I see in urllib2.py are various http_error handler which add Authorization header to the ADDITIONAL request which handles the

Python3, __slots__ and serialization

2014-02-08 Thread Eric Jacoboni
Hi, Say i want create a class with a __slots__ tuple in order to prevent creation of new attributes from outside the class. Say i want to serialize instances of this class... With pickle, all is ok : i can dump an object to a file, then reload it. With PyYAML, i can dump an object to a file,

Re: Python3, __slots__ and serialization

2014-02-08 Thread Ned Batchelder
On 2/8/14 1:06 PM, Eric Jacoboni wrote: Hi, Say i want create a class with a __slots__ tuple in order to prevent creation of new attributes from outside the class. Say i want to serialize instances of this class... With pickle, all is ok : i can dump an object to a file, then reload it. With

Re: Python3, __slots__ and serialization

2014-02-08 Thread Ned Batchelder
On 2/8/14 1:29 PM, Ned Batchelder wrote: On 2/8/14 1:06 PM, Eric Jacoboni wrote: Hi, Say i want create a class with a __slots__ tuple in order to prevent creation of new attributes from outside the class. Say i want to serialize instances of this class... With pickle, all is ok : i can dump

ur'foo' syntax under Python 3

2014-02-08 Thread Lele Gaifax
Hi all, I'm using Python 3.3, and I was surprised to realize that it does not support the old Python 2 syntax urliteral-raw-unicode-strings. Is there any trick to write such literals in a Python2+3 compatible source? Is there a rationale behind the invalid syntax or is it just a glitch? thanks

Re: ur'foo' syntax under Python 3

2014-02-08 Thread Mark Lawrence
On 08/02/2014 19:38, Lele Gaifax wrote: Hi all, I'm using Python 3.3, and I was surprised to realize that it does not support the old Python 2 syntax urliteral-raw-unicode-strings. Is there any trick to write such literals in a Python2+3 compatible source? Is there a rationale behind the

Re: ur'foo' syntax under Python 3

2014-02-08 Thread Peter Otten
Lele Gaifax wrote: I'm using Python 3.3, and I was surprised to realize that it does not support the old Python 2 syntax urliteral-raw-unicode-strings. Is there any trick to write such literals in a Python2+3 compatible source? Is there a rationale behind the invalid syntax or is it just

Re: What does means in python?

2014-02-08 Thread Walter Hurry
Roy Smith wrote: In article 72a7dd52-7619-4520-991e-20db7ce55...@googlegroups.com, Sam lightai...@gmail.com wrote: For string, one uses to represent string. Below is a code fragment that uses instead. cursor.execute(SELECT name, phone_number FROM coworkers

Re: What does means in python?

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 6:55 AM, Walter Hurry walterhu...@gmail.com wrote: When I asked (here) about this a while ago, some kind soul suggested textwrap.dedent. Any advice as to the pros and cons of the respective approaches (esp. for SQL)? For SQL? Ignore the extra spaces, it's a free-form

Re: Finding size of Variable

2014-02-08 Thread David Hutto
On Sat, Feb 8, 2014 at 8:17 AM, Mark Lawrence breamore...@yahoo.co.ukwrote: On 08/02/2014 02:48, Steven D'Aprano wrote: On Thu, 06 Feb 2014 05:51:54 -0800, wxjmfauth wrote: Sorry, I'm only pointing you may lose memory when working with short strings as it was explained. I really, very

Re: ur'foo' syntax under Python 3

2014-02-08 Thread Lele Gaifax
Thank you Peter and Mark for the links. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. --

Using asyncio for serial port

2014-02-08 Thread james . time4tea
Hiya I'm looking at using asyncio for creating an socket - serial protocol bridge, but looking at the current implementation of asyncio it looks to be quite socket specific. I can't see any way to get it to support a simple serial device. Any advice on where to proceed would be very much

What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Sam
I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bias. To play my own devil's advocate, I have a question. What are the kinds of software that are not advisable to be developed using Python? --

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Denis McMahon
On Sat, 08 Feb 2014 15:54:30 -0800, Sam wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bias. To play my own devil's advocate, I have a question. What are the kinds of software that are

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 10:54 AM, Sam lightai...@gmail.com wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bias. To play my own devil's advocate, I have a question. What are the kinds of

Re: Python 2.7.6 help with modules

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 11:28 AM, Scott W Dunning swdunn...@cox.net wrote: So, this is more like what you’re talking about? first = number / 10 second = number % 10 last = first %10 rest = second / 10 I feel stupid saying this and it’s probably because of the variables I’m using but I’m

Re: Finding size of Variable

2014-02-08 Thread Rustom Mody
On Sunday, February 9, 2014 4:15:50 AM UTC+5:30, David Hutto wrote: One could argue that if you're parsing a particular file, a very large one, that those 9 bytes can go into the optimization of parsing aforementioned file. Of, course we have faster processors, so why care? Because it goes

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
On Feb 8, 2014, at 5:56 PM, Chris Angelico ros...@gmail.com wrote: Carry on with that method - work out the number of minutes, and then the hours_etc which has the rest. Then do the same to split off hours, and then days. See how you go! I did it similar to that but I went backwards. I

Re: Python 2.7.6 help with modules

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 12:21 PM, Scott W Dunning swdunn...@cox.net wrote: I figured it out! Thanks Chris! Taking it one step at a time with the five digit number really helped me to see how to break it all up! Are you a teacher? I appreciate the help and the patients! I like that you

Re: Python 2.7.6 help with modules

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 12:46 PM, Scott W Dunning swdunn...@cox.net wrote: On Feb 8, 2014, at 5:56 PM, Chris Angelico ros...@gmail.com wrote: Carry on with that method - work out the number of minutes, and then the hours_etc which has the rest. Then do the same to split off hours, and then

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
I figured it out! Thanks Chris! Taking it one step at a time with the five digit number really helped me to see how to break it all up! Are you a teacher? I appreciate the help and the patients! I like that you don’t just give me the answer that you break it down and help me so that I can

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
On Feb 7, 2014, at 11:29 PM, Chris Angelico ros...@gmail.com wrote Close! But if you print out foo and bar, you'll see that you're naming them backwards in the second one. The last digit is the remainder (modulo), the rest is the quotient. So, this is more like what you’re talking about?

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
On Feb 8, 2014, at 6:46 PM, Chris Angelico ros...@gmail.com wrote: No, I'm not a teacher by profession, but I was homeschooled, and since I'm the second of seven children [1], I got used to teaching things to my siblings. Also, every week I run a Dungeons and Dragons campaign online, which

Re: Python 2.7.6 help with modules

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 1:07 PM, Scott W Dunning swdunn...@cox.net wrote: On Feb 8, 2014, at 6:46 PM, Chris Angelico ros...@gmail.com wrote: I had no idea that, in a group of half a dozen nerds, nobody would recognize this broken text: In brightest day, in blackest night / No evil ..

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Roy Smith
In article a584b0e9-1995-4189-bfac-d0c5ffc08...@googlegroups.com, Sam lightai...@gmail.com wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bias. To play my own devil's advocate, I have a

Re: Finding size of Variable

2014-02-08 Thread David Hutto
On Sat, Feb 8, 2014 at 8:25 PM, Rustom Mody rustompm...@gmail.com wrote: On Sunday, February 9, 2014 4:15:50 AM UTC+5:30, David Hutto wrote: One could argue that if you're parsing a particular file, a very large one, that those 9 bytes can go into the optimization of parsing aforementioned

Re: Finding size of Variable

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 1:56 PM, David Hutto dwightdhu...@gmail.com wrote: Yes... There are cases when python is an inappropriate language to use... So??? I didn't say she couldn't optimize in another language, and was just prototyping in Python. I just said she was optimizing her python

Re: Finding size of Variable

2014-02-08 Thread David Hutto
On Sat, Feb 8, 2014 at 9:59 PM, Chris Angelico ros...@gmail.com wrote: On Sun, Feb 9, 2014 at 1:56 PM, David Hutto dwightdhu...@gmail.com wrote: Yes... There are cases when python is an inappropriate language to use... So??? I didn't say she couldn't optimize in another language,

Re: Finding size of Variable

2014-02-08 Thread Ned Batchelder
On 2/8/14 9:56 PM, David Hutto wrote: On Sat, Feb 8, 2014 at 8:25 PM, Rustom Mody rustompm...@gmail.com mailto:rustompm...@gmail.com wrote: On Sunday, February 9, 2014 4:15:50 AM UTC+5:30, David Hutto wrote: One could argue that if you're parsing a particular file, a very large

Re: Finding size of Variable

2014-02-08 Thread David Hutto
Maybe I'll just roll my fat, bald, troll arse out from under the bridge, and comment back, off list, next time. -- https://mail.python.org/mailman/listinfo/python-list

Re: Finding size of Variable

2014-02-08 Thread Ned Batchelder
On 2/8/14 10:09 PM, David Hutto wrote: Maybe I'll just roll my fat, bald, troll arse out from under the bridge, and comment back, off list, next time. I'm not sure what happened in this thread. It might be that you think Rustom Mody was referring to you when he said, BTW: In my book this

Re: Finding size of Variable

2014-02-08 Thread Rustom Mody
On Sunday, February 9, 2014 8:46:50 AM UTC+5:30, Ned Batchelder wrote: On 2/8/14 10:09 PM, David Hutto wrote: Maybe I'll just roll my fat, bald, troll arse out from under the bridge, and comment back, off list, next time. I'm not sure what happened in this thread. It might be that you

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Steven D'Aprano
On Sat, 08 Feb 2014 21:53:00 -0500, Roy Smith wrote: In article a584b0e9-1995-4189-bfac-d0c5ffc08...@googlegroups.com, Sam lightai...@gmail.com wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Michael Torrie
On 02/08/2014 05:11 PM, Chris Angelico wrote: On Sun, Feb 9, 2014 at 10:54 AM, Sam lightai...@gmail.com wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bias. To play my own devil's

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Asaf Las
On Sunday, February 9, 2014 5:43:47 AM UTC+2, Steven D'Aprano wrote: Nevertheless, although security by obscurity is ineffective[1], Python supports it. You can ship only the .pyc files. For added obscurity, you could put the .pyc files in a .zip file and ship that. For even more obscurity,

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 3:08 PM, Michael Torrie torr...@gmail.com wrote: On 02/08/2014 05:11 PM, Chris Angelico wrote: On Sun, Feb 9, 2014 at 10:54 AM, Sam lightai...@gmail.com wrote: I got to know about Python a few months ago and today, I want to develop only using Python because of its code

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Skybuck Flying
I got to know about Python a few months ago and today, I want to develop only using Python because of its code readability. This is not a healthy bias. To play my own devil's advocate, I have a question. What are the kinds of software that are not advisable to be developed using Python?

Re: Sorting dictionary by datetime value

2014-02-08 Thread Larry Hudson
On 02/07/2014 11:06 PM, Igor Korot wrote: Hi, ALL, I'm trying to do a very easy task: sort python dictionary by value where value is a datetime object. When trying to do that in Python shell everthing works as expected. C:\Documents and Settings\Igor.FORDANWORKpython Python 2.7.5 (default, May

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 4:17 PM, Skybuck Flying windows7i...@dreampc2006.com wrote: Anything that needs to be super reliable. My experience so far with Python versus Delphi has shown that Python requires way more time to debug than Delphi. The reason for this is the interpreter versus the

Vedr: What does means in python?

2014-02-08 Thread Gisle Vanem
  Gisle V. Computers are useless. They can only give answers --Pablo Picasso Chris Angelico ros...@gmail.com wrote: For SQL? Ignore the extra spaces, it's a free-form language. The only reason to consider dedent() would be if you're worried about how your log files will look. The actual

Re: Python 2.7.6 help with modules

2014-02-08 Thread Scott W Dunning
On Feb 8, 2014, at 6:46 PM, Chris Angelico ros...@gmail.com wrote: That's certainly effective. It's going to give you the right result. I would be inclined to start from the small end and strip off the seconds first, then the minutes, etc, because then you're working with smaller divisors

Re: Python 2.7.6 help with modules

2014-02-08 Thread Chris Angelico
On Sun, Feb 9, 2014 at 5:00 PM, Scott W Dunning swdunn...@cox.net wrote: On Feb 8, 2014, at 6:46 PM, Chris Angelico ros...@gmail.com wrote: That's certainly effective. It's going to give you the right result. I would be inclined to start from the small end and strip off the seconds first,

Re: python and matlab

2014-02-08 Thread pavlovevidence
On Thursday, February 6, 2014 5:30:54 AM UTC-8, Sam Adams wrote: is it able to utilize functions written in Python in Matlab? If it's on Windows, and if it's pure-Python 2.x code, the easiest solution would be to use Iron Python or Jython. Matlab can call Java and .NET code natively. --

Re: Sorting dictionary by datetime value

2014-02-08 Thread Frank Millman
Peter Otten __pete...@web.de wrote in message news:ld4pon$ni9$1...@ger.gmane.org... Frank Millman wrote: Here you can watch the key calculation at work: d = {'1': 'abc', '2': 'xyz', '3': 'pqr'} def sortkey(value): ... key = d.get(value) ... print value:, value, sort-key:, key

Re: Python 2.7.6 help with modules

2014-02-08 Thread Larry Hudson
On 02/08/2014 05:21 PM, Scott W Dunning wrote: I figured it out! Thanks Chris! Taking it one step at a time with the five digit number really helped me to see how to break it all up! Are you a teacher? I appreciate the help and the patients! I like that you don’t just give me the answer

Dictionaries

2014-02-08 Thread worthingtonclinton
why in a for loop can i access values for a dict that i did not address in the for loop. example: a = {blah:blah} b = {blah:blah} for x in a: print a[x] #here's what i don't understand print b[x] # it would print the value for dict b even though it wasn't

Re: Dictionaries

2014-02-08 Thread Gary Herron
On 02/08/2014 11:07 PM, worthingtonclin...@gmail.com wrote: why in a for loop can i access values for a dict that i did not address in the for loop. example: a = {blah:blah} b = {blah:blah} for x in a: print a[x] #here's what i don't understand print b[x]

Re: Dictionaries

2014-02-08 Thread Frank Millman
worthingtonclin...@gmail.com wrote in message news:891d3696-4e4e-44cc-a491-6b8fef47f...@googlegroups.com... why in a for loop can i access values for a dict that i did not address in the for loop. example: a = {blah:blah} b = {blah:blah} for x in a: print a[x] #here's what i

Re: Dictionaries

2014-02-08 Thread worthingtonclinton
greatly appreciated guys. thanks! -- https://mail.python.org/mailman/listinfo/python-list

[issue19772] str serialization of Message object may mutate the payload and CTE.

2014-02-08 Thread Vajrasky Kok
Vajrasky Kok added the comment: Actually, I am thinking of this approach (cloning the message just after entering the flatten method): diff -r b541ecd32115 Lib/email/generator.py --- a/Lib/email/generator.pyFri Feb 07 16:11:17 2014 -0800 +++ b/Lib/email/generator.pySat Feb 08 15:55:01

[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2014-02-08 Thread Vajrasky Kok
Vajrasky Kok added the comment: Here is the updated patch for gc module based on Zachary's review. -- Added file: http://bugs.python.org/file33988/clinic_gc_v4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20185

[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2014-02-08 Thread Vajrasky Kok
Changes by Vajrasky Kok sky@speaklikeaking.com: Removed file: http://bugs.python.org/file33954/clinic_longobject_v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20185 ___

[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2014-02-08 Thread Vajrasky Kok
Vajrasky Kok added the comment: Here is the updated patch for long object based on Zachary's review. -- Added file: http://bugs.python.org/file33989/clinic_longobject_v3.patch ___ Python tracker rep...@bugs.python.org

  1   2   3   >