Re: Python

"Peter J. Holzer" <[email protected]> Sun, 21 Dec 2025 13:22:23 +0100
Newsgroups gmane.comp.python.general
Message-ID <j5pzpehv4eu32myye5ccziofun6lkntfuktrvi6yfggtrandwr@lwxalib7e5ww>
On 2025-12-18 04:25:35 -0500, c186282 wrote:
> On 12/18/25 01:54, rbowman wrote:
> > On Wed, 17 Dec 2025 23:02:24 -0500, c186282 wrote:
> > 
> > >     Oh, I usually write "i=i+2". It's a bit more clear and becomes the
> > >     same code anyway. += is more a 'C' thing.
> > 
> > And Python, C#, JavaScript, C++, ...
> 
>   Well, I know it *works* ... I just choose not
>   to do it in Python. Everyone has their 'style'.

Yes, but that's *your* style, not Python style.

There is the concept of "pythonic" Code (just like there is a concept of
idiomatic code in (almost) any language), but if you ask 100 randomly
chosen Python programmers whether the use of += is pythonic, I doubt
that more than a handful would say no.

        hjp


-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | [email protected]         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmlH5ncACgkQ8g5IURL+
KF1s/A/+JzrFtApkM6efwCg56P48ggqzuBVzNox1LHqczd80diVRWZIms6yuWET5
rpbEBJ17PIyYjW8Nj2Itm0yDinQtyfMpuyl6DLNHPNd4+Rkcf62TPCOX8/ZWLzX3
jmjxVN6Jx9Y8TBOGbmYTEc+t+MDYODa480da1i3AOg2+1PDko2KzcZj9j0kihQdY
5dw1A228JoQp708HKYCGAos/ceghmkQzyxE1hnHDYYiHqArGcslzKcd7+V/BAVTA
16tm44pnXvF/S1DOeisziUadIDuwnwgzeP7s7SpFjYU/cJrABSN3x72ny+JyB3oP
YJW2WELnovJvLae9wRJ8spitZ1sTMr4sGPA/2L8kHdGqIc/YDm7fsBvPBriKN0v1
Vh+oS+gZQX2OEg/7inG25cYD2YtJzVmDKV/1UWFTrFOql82Lml0x/zSC2UNkr9M/
oF4HoArwrHO/Wsa+j2rJ3gSPdcB1iW0Ky+XtCYwue7Kmh1sw4oYEsCQBRwoJeCya
U4k9zeBcIppq2yOD8DYIkaijby/adCFuyXDlV43GSRTb/mPRKbI99Xf/ZUpRGZNb
MItuWIpETO53JbJBq7oQoPQ7LvkUBweJglIIGKQbxf+jJ9YytUKW/WjIMHeMvAvv
fwlON2rYVt4jDsSH8v6ZygFbsAANt97AHVHufE4MNdKG9tJhMiY=
=NleC
-----END PGP SIGNATURE-----