Nuno Hespanhol | 1 Mar 2009 02:08
Picon

What does the L at the end of a number means?

Hi.
I have started learning phyton today!
I was playing around with some large numbers (fibonacci series)
and noticed that in some large calculations results have an "L" at the 
end of a number.
Does this L stands for Large? Is there any way to disable this feature, 
so that all numbers are shown?

Thanks for your time.
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

wesley chun | 1 Mar 2009 02:22
Picon
Gravatar

Re: What does the L at the end of a number means?

> I have started learning phyton today!
> I was playing around with some large numbers (fibonacci series)
> and noticed that in some large calculations results have an "L" at the end
> of a number.
> Does this L stands for Large? Is there any way to disable this feature, so
> that all numbers are shown?

hi, and welcome to Python!  yes, the "L" can mean "large," but
officially, it means "long". What version of Python are you using?
The reason why i ask is because long integers have been rolled into
the existing integer type and the "L" should no longer be showing up
as it is being phased out since the 2.2 release. They are completely
gone in 3.0.

cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

(Continue reading)

George Wahid | 1 Mar 2009 02:43
Picon

Re: What does the L at the end of a number means?

it means that it's type is "long". writing an expression makes python
return its value, so writing 2**1000 will return a number that ends
with L to show that it's a long integer. but writing "print 2**1000"
will print the number without the L. I don't know if there is a way to
disable this feature, but it's not present in python 3.0.
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Lie Ryan | 1 Mar 2009 03:31
Picon

Re: What does the L at the end of a number means?

Nuno Hespanhol wrote:
> Hi.
> I have started learning phyton today!
> I was playing around with some large numbers (fibonacci series)
> and noticed that in some large calculations results have an "L" at the
> end of a number.
> Does this L stands for Large? Is there any way to disable this feature,
> so that all numbers are shown?
> 
> Thanks for your time.

"L" means it is "long integer". In the python interpreter, when you do
something like this:

>>> a

it will actually call the __repr__ of a and print it.

>>> print a.__repr__()

while

>>> print a

will call __str__ of a and print it

>>> print a.__str__()

Python 2.x's long integer __repr__ adds an extra L to denote long
integer, however the __str__ does not.
(Continue reading)

Daniele | 1 Mar 2009 10:36
Picon

modular program

Hi,
I'd like to write a python program which can be easily extended by other people. Where can I find some "best practices" for writing modular programs? I thought about a txt file containing function calls that my program will parse and execute in order, or is it better just to execute every .py file in a certain "module" folder (I don't like this as modules could need to be executed in different moments)? Can any1 point me to a relatively simple program to look at?
thanks in advance!

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor
W W | 1 Mar 2009 14:05
Picon

Re: modular program

On Sun, Mar 1, 2009 at 3:36 AM, Daniele <d.conca <at> gmail.com> wrote:
> Hi,
> I'd like to write a python program which can be easily extended by other
> people. Where can I find some "best practices" for writing modular programs?
> I thought about a txt file containing function calls that my program will
> parse and execute in order, or is it better just to execute every .py file
> in a certain "module" folder (I don't like this as modules could need to be
> executed in different moments)? Can any1 point me to a relatively simple
> program to look at?

Using classes is a pretty good idea. Then people can either "import
daniele" or "from daniele import niftyClass".

You can pretty much take a look at any of the modules in your python
library directory. In the case of my linux box, that's
/usr/lib/python2.5/

HTH,
Wayne
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Richard Lovely | 1 Mar 2009 16:13
Gravatar

Re: Passing perimeters in dictionary values?

2009/2/28 Alan Gauld <alan.gauld <at> btinternet.com>:
>
> "Richard Lovely" <roadierich <at> googlemail.com> wrote
>
>> > Sorry, I should have pointed out that you will need to redefine
>> > all your functions to accept a parameter.
>>
>> Always makes me smile when (experienced) people redesign the wheel...
>>
>> From the docs (http://www.python.org/doc/2.6/library/functools.html):
>>
>> "The partial() is used for partial function application which
>> “freezes” some portion of a function’s arguments and/or keywords
>> resulting in a new object with a simplified signature."
>
> I'm not sure how you would use partial in this case, I still think you'd
> need to add a parameter to the function definitions. partial would
> remove the need for lambda in some of the other solutions though.
>
> But an interesting module that I've not seen before. Although since it was
> only introduced in 2.5 I'm not surprised, I've been focussing more
> on v3 lately rather than the new stuff in 2.5/2.6 (in fact I don't even
> have 2.6 loaded yet and only have 2.5 on one PC...)
>
> Thanks for highlighting it.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> _______________________________________________
> Tutor maillist  -  Tutor <at> python.org
> http://mail.python.org/mailman/listinfo/tutor
>

Ooops... quoted the wrong message.  That should have been quoting the
message about lambdas...

--

-- 
Richard "Roadie Rich" Lovely, part of the JNP|UK Famile
www.theJNP.com
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Alan Gauld | 1 Mar 2009 18:10

Re: modular program


"Daniele" <d.conca <at> gmail.com> wrote

> I'd like to write a python program which can be easily extended by 
> other
> people. Where can I find some "best practices" for writing modular 
> programs?

Try reading wikipedia.
Try looking under "modular", "coupling" and "cohesion"
You could also try "Frameworks"

> I thought about a txt file containing function calls that my program 
> will
> parse and execute in order, or is it better just to execute every 
> .py file
> in a certain "module" folder

Erm, I don't know what you mean by that bit?! :-)

A text file full of python functions is a module if you name it .py.
You can then import it and use the functins therein.

> I don't like this as modules could need to be executed in different
> moments

You don't normally execute modules, you use the executable
functions within modules. (Although in the strictest sense functions
are themselves a form of module.)

> Can any1 point me to a relatively simple program to look at?

You could look at the topic on modules and functins in my tutor.
Or you could read the case study topic which uses modules
Or if you can find the paper book version (in your local library?)
you can read the Games Framework chapter which describes
how to write a set of modules (using classes) that are explicitly
designed to be extended rather than used as-is.

HTH,

--

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

Wayne Watson | 1 Mar 2009 19:04
Picon
Favicon

Converting "HH:MM:SS" to datetime

Ok, how do I do what's mentioned in Subject?
--
Signature.html Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) "Nature, to be commanded, must be obeyed." -- Sir Francis Bacon
Web Page: <www.speckledwithstars.net/>
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor
Sander Sweers | 1 Mar 2009 19:15
Picon

Re: Converting "HH:MM:SS" to datetime

2009/3/1 Wayne Watson <sierra_mtnview <at> sbcglobal.net>:
> Ok, how do I do what's mentioned in Subject?

Googling for python and time gives as first result.

http://www.doughellmann.com/PyMOTW/datetime/index.html

Which covers all you need to know to solve this.

Greets
Sander
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor


Gmane