Re: Cheat sheet for the new string formatting?

2015-06-09 Thread Mark Lawrence
On 09/06/2015 13:15, Skip Montanaro wrote: One thing which seems obvious now is that since format() delegates to the individual types for formatting, much of the documentation of this stuff must now be delegated to the individual types. However, I can't find anything about the formatting syntax

Re: Cheat sheet for the new string formatting?

2015-06-09 Thread Skip Montanaro
On Tue, Jun 9, 2015 at 7:29 AM, wrote: > Where have you looked? Have you read > https://docs.python.org/3/library/string.html#formatspec ? Yes, but I missed the None section. I looked closely at 'g', but didn't see anything like "this is the default". I will admit I was a bit frustrated to see t

Re: Cheat sheet for the new string formatting?

2015-06-09 Thread random832
On Tue, Jun 9, 2015, at 08:15, Skip Montanaro wrote: > Skip> Why don't floats support "{:.Ns}"? (I know I can use "{!s}".) > > random832> Why would they? The old style didn't support %.Ns either. > > Well, the old style does, though it appears the N is ignored: > > >>> "%5s" % -0.00666762259822

Re: Cheat sheet for the new string formatting?

2015-06-09 Thread Skip Montanaro
Skip> Why don't floats support "{:.Ns}"? (I know I can use "{!s}".) random832> Why would they? The old style didn't support %.Ns either. Well, the old style does, though it appears the N is ignored: >>> "%5s" % -0.00666762259822 '-0.00666762259822' It doesn't raise an exception though. (This i

Re: Cheat sheet for the new string formatting?

2015-06-08 Thread Mark Lawrence
On 08/06/2015 21:05, Steven K Knight wrote: June 8 2015 3:11 PM, "Skip Montanaro" mailto:%22Skip%20Montanaro%22%20>> wrote: I have so far ignored the new string formatting (you know, the stuff with all the braces, dots and brackets that make Python strings look like Perl code ). I

Re: Cheat sheet for the new string formatting?

2015-06-08 Thread random832
On Mon, Jun 8, 2015, at 16:32, Skip Montanaro wrote: > This is counterintuitive: > > >>> "{:.3}".format(-0.00666762259822) > '-0.00667' > >>> "{:.3f}".format(-0.00666762259822) > '-0.007' > >>> "%.3f" % -0.00666762259822 > '-0.007' > >>> "{:.3s}".format(-0.00666762259822) > ValueError Unknown form

Re: Cheat sheet for the new string formatting?

2015-06-08 Thread Serhiy Storchaka
On 08.06.15 23:32, Skip Montanaro wrote: This is counterintuitive: >>> "{:.3}".format(-0.00666762259822) '-0.00667' >>> "{:.3f}".format(-0.00666762259822) '-0.007' >>> "%.3f" % -0.00666762259822 '-0.007' >>> "{:.3s}".format(-0.00666762259822) ValueError Unknown format code 's' for object of

Re: Cheat sheet for the new string formatting?

2015-06-08 Thread Yann Kaiser
It just means significant digits in the general format, which alternates between 10-exponent notation and plain decimal notation. https://docs.python.org/3.4/library/string.html#format-specification-mini-language >>> '{:.3}'.format(0.356785) '3.57e-05' >>> '{:.3}'.format(0.0035678

Re: Cheat sheet for the new string formatting?

2015-06-08 Thread Skip Montanaro
This is counterintuitive: >>> "{:.3}".format(-0.00666762259822) '-0.00667' >>> "{:.3f}".format(-0.00666762259822) '-0.007' >>> "%.3f" % -0.00666762259822 '-0.007' >>> "{:.3s}".format(-0.00666762259822) ValueError Unknown format code 's' for object of type 'float' Why does the first form display f

Re: Cheat sheet for the new string formatting?

2015-06-08 Thread Steven K Knight
June 8 2015 3:11 PM, "Skip Montanaro" wrote: I have so far ignored the new string formatting (you know, the stuff with all the braces, dots and brackets that make Python strings look like Perl code ). I am still only using Python 2.7, but have recently started forcing myself to use the

Re: Cheat sheet for the new string formatting?

2015-06-08 Thread Skip Montanaro
On Mon, Jun 8, 2015 at 3:05 PM, Steven K Knight wrote: > I think http://pyformat.info/ is what you're looking for. Perfect, thanks! S -- https://mail.python.org/mailman/listinfo/python-list

Re: Cheat sheet

2008-01-01 Thread Riccardo T.
Riccardo T. ha scritto: > I wrote a little cheat sheet for this wonderful language, but because of > my still little experience with it, I would like to have a feedback > Could you have a look at it and tell me what do you think about, please? > > http://greyfox.imente.org/index.php?id=73 > > --

Re: Cheat sheet

2007-12-31 Thread Gabriel Genellina
En Sat, 29 Dec 2007 06:58:27 -0200, ZeD <[EMAIL PROTECTED]> escribi�: > Michele Simionato wrote: > >> Nowadays file is no more an alias for open. > > curious... maybe it's me, but I can't find a "What's New in Python" where > this is said... See Misc/NEWS: - Patch #1479181: split open() and file(

Re: Cheat sheet

2007-12-29 Thread Riccardo T.
ZeD ha scritto: > Michele Simionato wrote: > >> Python 2.4.4 (#2, Oct 4 2007, 22:02:31) > file is open >> True >> >> Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) > file is open >> False >> >> Nowadays file is no more an alias for open. > > curious... maybe it's me, but I can't find a

Re: Cheat sheet

2007-12-29 Thread Riccardo T.
Scott David Daniels ha scritto: > Riccardo T. wrote: >> Maybe I'll add __builtin__ and os in place of the type hierarchy, but >> I'm not sure about that. However, not in the next release. What do you >> think about? > > How about: > top line w/ __builtin__, os, os.path (and no contents -- inspire

Re: Cheat sheet

2007-12-29 Thread ZeD
Michele Simionato wrote: > Python 2.4.4 (#2, Oct 4 2007, 22:02:31) file is open > True > > Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) file is open > False > > Nowadays file is no more an alias for open. curious... maybe it's me, but I can't find a "What's New in Python" where t

Re: Cheat sheet

2007-12-29 Thread Riccardo T.
Alaric ha scritto: > Nicely done! I would suggest you put your website address on it and a revision > number so that as it gains use on te web, people can find the "latest" > version. That's a good idea, thank you :) -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list

Re: Cheat sheet

2007-12-28 Thread Alaric
Riccardo T. wrote: > > > I wrote a little cheat sheet for this wonderful language, but because of > my still little experience with it, I would like to have a feedback > Could you have a look at it and tell me what do you think about, please? > > http://greyfox.imente.org/index.php?id=73 > > -- > G

Re: Cheat sheet

2007-12-28 Thread Scott David Daniels
Riccardo T. wrote: > Scott David Daniels ha scritto: >> Riccardo T. wrote: >>> Scott David Daniels ha scritto: [in the .png] > ... > Callable types >... >User-definet methods I personally prefer "User-defined methods" >>> That's a typo, thank you. >> Hope I didn't

Re: Cheat sheet

2007-12-28 Thread Riccardo T.
Scott David Daniels ha scritto: > Riccardo T. wrote: >> Scott David Daniels ha scritto: >>> [in the .png] ... Callable types ... User-definet methods >>> I personally prefer "User-defined methods" >> >> That's a typo, thank you. > > Hope I didn't offend (I was simply tryi

Re: Cheat sheet

2007-12-28 Thread Scott David Daniels
Riccardo T. wrote: > Scott David Daniels ha scritto: >> [in the .png] >>> ... >>> Callable types >>>... >>>User-definet methods >> I personally prefer "User-defined methods" > > That's a typo, thank you. Hope I didn't offend (I was simply trying to be cute). Some from a bit further along.

Re: Cheat sheet

2007-12-28 Thread Riccardo T.
c james ha scritto: > On the svg version, as viewed on firefox, the sections "Simple > statements", "Definations" and "Comments"; there appears to be a problem > with text wrapping. I see, it has already been signaled by mail. I'm not sure about how to fix that, I'll have to ask someone who knows

Re: Cheat sheet

2007-12-28 Thread c james
Riccardo T. wrote: > I wrote a little cheat sheet for this wonderful language, but because of > my still little experience with it, I would like to have a feedback > Could you have a look at it and tell me what do you think about, please? > > http://greyfox.imente.org/index.php?id=73 > > -- > Gre

Re: Cheat sheet

2007-12-28 Thread Michele Simionato
On Dec 28, 12:40 pm, "Riccardo T." <[EMAIL PROTECTED]> wrote: > > "file" objects are generally supposed to be built with the > > open function, not instantiated as shown. > > Since open() is just an alias for file(), changing the name should be > enough, right? It depends on the Python version: P

Re: Cheat sheet

2007-12-28 Thread Riccardo T.
Scott David Daniels ha scritto: > [in the .png] >> ... >> Callable types >>... >>User-definet methods > > I personally prefer "User-defined methods" That's a typo, thank you. >>... >>Class instances > I'd try: > Class instances with a __call__ method. Yes, it's more clear

Re: Cheat sheet

2007-12-27 Thread James Matthews
Looks good thanks! On Dec 27, 2007 11:06 PM, Scott David Daniels <[EMAIL PROTECTED]> wrote: > Riccardo T. wrote: > > I wrote a little cheat sheet for this wonderful language, but because of > > my still little experience with it, I would like to have a feedback > > Could you have a look at it and

Re: Cheat sheet

2007-12-27 Thread Scott David Daniels
Riccardo T. wrote: > I wrote a little cheat sheet for this wonderful language, but because of > my still little experience with it, I would like to have a feedback > Could you have a look at it and tell me what do you think about, please? > > http://greyfox.imente.org/index.php?id=73 > > -- > Gre

Re: Cheat sheet

2007-12-27 Thread Riccardo T.
Carl Banks ha scritto: > On Dec 27, 12:38 pm, "Riccardo T." <[EMAIL PROTECTED]> wrote: >> I wrote a little cheat sheet for this wonderful language, but because of >> my still little experience with it, I would like to have a feedback >> Could you have a look at it and tell me what do you think abou

Re: Cheat sheet

2007-12-27 Thread Carl Banks
On Dec 27, 12:38 pm, "Riccardo T." <[EMAIL PROTECTED]> wrote: > I wrote a little cheat sheet for this wonderful language, but because of > my still little experience with it, I would like to have a feedback > Could you have a look at it and tell me what do you think about, please? > > http://greyfo

Re: Cheat sheet

2007-12-27 Thread Riccardo T.
Markus Gritsch ha scritto: > On Dec 27, 11:38 am, "Riccardo T." <[EMAIL PROTECTED]> wrote: >> I wrote a little cheat sheet for this wonderful language, but because of >> my still little experience with it, I would like to have a feedback >> Could you have a look at it and tell me what do you think

Re: Cheat sheet

2007-12-27 Thread Markus Gritsch
On Dec 27, 11:38 am, "Riccardo T." <[EMAIL PROTECTED]> wrote: > I wrote a little cheat sheet for this wonderful language, but because of > my still little experience with it, I would like to have a feedback > Could you have a look at it and tell me what do you think about, please? > > http://greyfo

Re: Cheat sheet

2007-12-27 Thread kyosohma
On Dec 27, 1:44 pm, "Riccardo T." <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] ha scritto: > > > Looks cool, but you might find these interesting too: > > >http://www.limsi.fr/Individu/pointal/python/pqrc/ > >http://mail.python.org/pipermail/python-list/2006-June/386662.html > > > Mike > > Thanks

Re: Cheat sheet

2007-12-27 Thread Riccardo T.
[EMAIL PROTECTED] ha scritto: > Looks cool, but you might find these interesting too: > > http://www.limsi.fr/Individu/pointal/python/pqrc/ > http://mail.python.org/pipermail/python-list/2006-June/386662.html > > Mike Thanks :) I'll read them to improve my python knowledge, but I prefere to have

Re: Cheat sheet

2007-12-27 Thread kyosohma
On Dec 27, 11:38 am, "Riccardo T." <[EMAIL PROTECTED]> wrote: > I wrote a little cheat sheet for this wonderful language, but because of > my still little experience with it, I would like to have a feedback > Could you have a look at it and tell me what do you think about, please? > > http://greyfo