Re: SQLite or files?

2009-10-05 Thread AggieDan04
On Sep 17, 9:10 am, J Kenneth King wrote: > ici writes: > > I likeshelvefor saving small amounts of data, user preferences, > > recent files etc. > >http://docs.python.org/library/shelve.html > > I like it too, but I hear the great powers that be are going to > deprecate it. If you want the conv

Re: arrays in python

2009-09-23 Thread AggieDan04
On Sep 23, 3:02 pm, Simon Forman wrote: > On Wed, Sep 23, 2009 at 1:14 PM, Rudolf wrote: > > Can someone tell me how to allocate single and multidimensional arrays > > in python. I looked online and it says to do the following x = > > ['1','2','3','4'] > > > However, I want a much larger array li

Re: Am I doing this wrong? Why does this seem so clumsy (time, datetime vs. DateTime)

2009-09-20 Thread AggieDan04
On Sep 19, 9:22 pm, Schif Schaf wrote: > The other day I needed to convert a date like "August 2009" into a > "seconds-since-epoch" value (this would be for the first day of that > month, at the first second of that day). > > In Python, I came up with this: > > > #!/usr/bin/env python > > imp

Re: Why indentation is use to denote block of code?

2009-09-13 Thread AggieDan04
On Sep 13, 6:27 pm, Steven D'Aprano wrote: > On Sun, 13 Sep 2009 15:15:40 -0700, Chris Rebert wrote: > > In fact it's pretty much impossible to automatically indent Python code > > that has had its indentation removed; it's impossible to know for sure > > where the dedents should occur. > > Just l

Re: print() a list

2009-09-05 Thread AggieDan04
On Sep 5, 1:51 am, Dero wrote: > On Sep 5, 2:35 pm, "Mark Tolonen" wrote: > > > "DarkBlue" wrote in message > > >news:b9c0c4ac-5f8f-4133-b928-9e55ab4b2...@x5g2000prf.googlegroups.com... > > > >I am trying to get used to the new print() syntax prior to installing > > > python 3.1: ... > > Without

Re: What python can NOT do?

2009-08-29 Thread AggieDan04
On Aug 28, 7:05 pm, Tim Chase wrote: > qwe rty wrote: > > i know that an interpreted language like python can't be used to make > > an operating system or system drivers. > > As long as you are willing to write the OS hooks in C, you can > write the userspace device drivers in Python: Writing you

Re: Is behavior of += intentional for int?

2009-08-29 Thread AggieDan04
On Aug 29, 8:08 am, Paul McGuire wrote: > On Aug 29, 7:45 am, zaur wrote: > > > Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) > > [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin > > Type "copyright", "credits" or "license()" for more information.>>> a=1 > > >>> x=[a] > > >>> id(a)==id(

Re: Read C++ enum in python

2009-08-18 Thread AggieDan04
On Aug 18, 6:03 pm, Ludo wrote: > Hello, > > I work in a very large project where we have C++ packages and pieces of > python code. > > I've been googleing for days but what I find seems really too > complicated for what I want to do. > > My business is, in python, to read enum definitions provide

Re: Bug in format specification in Python 3?

2009-08-11 Thread AggieDan04
On Aug 11, 3:28 pm, Robert Dailey wrote: > Hello, > > According to the Python 3.1 documentation, I can have a format > specification like so: > > print( 'This is a hex number: {:#08x}'.format( 4 ) ) > > This will print: > > This is a hex number: 0x04 > > I notice that the '0x' portion is count

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread AggieDan04
On Jun 9, 4:33 pm, Esmail wrote: > Hi, > > random.random() will generate a random value in the range [0, 1). > > Is there an easy way to generate random values in the range [0, 1]? > I.e., including 1? You could do random.uniform(0, 1.0002). Due to floating- point rounding, there are

Re: 4 hundred quadrillonth?

2009-05-21 Thread AggieDan04
On May 21, 5:36 pm, Chris Rebert wrote: > On Thu, May 21, 2009 at 2:53 PM, Carl Banks wrote: > > On May 21, 2:05 pm, seanm...@gmail.com wrote: > >> The explaination in my introductory Python book is not very > >> satisfying, and I am hoping someone can explain the following to me: > > >> >>> 4 /

Re: 4 hundred quadrillonth?

2009-05-21 Thread AggieDan04
On May 21, 5:45 pm, norseman wrote: > seanm...@gmail.com wrote: > > The explaination in my introductory Python book is not very > > satisfying, and I am hoping someone can explain the following to me: > > 4 / 5.0 > > 0.80004 > > > 4 / 5.0 is 0.8. No more, no less. So what's up wit

Re: Into itertools

2009-04-26 Thread AggieDan04
On Apr 26, 11:32 am, bearophileh...@lycos.com wrote: > Some idioms are so common that I think they deserve to be written in C > into the itertools module. > > 1) leniter(iterator) ... > 2) xpairwise(iterable) ... > 3) xpairs(seq) ... > 4) xsubsets(seq) ... Good suggestions. Another useful functio

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread AggieDan04
On Apr 20, 2:03 am, bdb112 wrote: > Is there any obvious reason why > [False,True] and [True,True] > gives [True, True] > > Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit > (Intel)] X and Y == (Y if X else X) X or Y == (X if X else Y) [False, True] is true, so the and operat

Re: How to convert \n and \t symbols to new lines and tabs?

2009-04-13 Thread AggieDan04
On Apr 13, 6:30 pm, DSblizzard wrote: > How to convert string with \n and \t symbols to natural string - with > new lines and tabs? 'String with tab\\t and newline\\n'.decode('string-escape') -- http://mail.python.org/mailman/listinfo/python-list

Re: Floor value in math operators

2009-04-08 Thread AggieDan04
On Apr 8, 12:08 pm, David Smith wrote: > Avi wrote: > > Hi, > > > This will be a very simple question to ask all the awesome programmers > > here: > > > How can I get answer in in decimals for such a math operator: > > > 3/2 > > > I get 1. I want to get 1.5 > > > Thanks in advance, > > Avi > > I'm

Re: newbie: precision question

2009-03-20 Thread AggieDan04
On Mar 20, 10:12 pm, Lada Kugis wrote: > I'm a newbie learning python, so forgive for, what may seem to some, > like a stupid question. > > I understand the basic integer and fp type, but what I'm having a > little trouble are the long type An "int" is limited to 32 or 64 bits. A "long" can be a