Python Forum
Generator function in camel case
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generator function in camel case
#3
(Jul-16-2018, 08:34 PM)micseydel Wrote: If you have a consistent and documented code style, you can do whatever you want. If you want to reference PEP 8, which is what we default to on this forum, then you probably want to use snake_case for generators (which are basically functions). I'd consider it this way - if it's a type (class) that you can pass to isinstance, then use CamelCase, otherwise use snake_case (I give this advice for Python code, even though Python types like int and str are not CamelCase).

(Jul-16-2018, 08:28 PM)porton Wrote: Otherwise, I would need to rename every time I switch between a generator function and an iterator class.
I don't understand what you mean by this.

I mean if I rewrite a generator function as an iterator class or vice versa, I need to change its casing.
Reply


Messages In This Thread
Generator function in camel case - by porton - Jul-16-2018, 08:28 PM
RE: Generator function in camel case - by micseydel - Jul-16-2018, 08:34 PM
RE: Generator function in camel case - by porton - Jul-16-2018, 08:37 PM
RE: Generator function in camel case - by micseydel - Jul-16-2018, 09:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Switch case or match case? Frankduc 9 4,838 Jan-20-2022, 01:56 PM
Last Post: Frankduc
  Tuple generator, and function/class syntax quazirfan 3 4,082 Aug-10-2021, 09:32 AM
Last Post: buran
  list call problem in generator function using iteration and recursive calls postta 1 2,013 Oct-24-2020, 09:33 PM
Last Post: bowlofred
  basic random number generator in replace function krug123 2 2,112 Jul-31-2020, 01:02 PM
Last Post: deanhystad
  Generator function for even numbers mp3909 4 6,142 Mar-21-2020, 07:40 PM
Last Post: buran
  how to make my function be a generator Skaperen 2 2,086 Jan-27-2020, 01:07 AM
Last Post: Skaperen
  generator function that yield from a list buran 9 4,389 Jun-04-2019, 10:26 PM
Last Post: snippsat
  receive from a generator, send to a generator Skaperen 9 5,693 Feb-05-2018, 06:26 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020