Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitffb5fa3

Browse files
committed
Add a section on naming methods
1 parent71a235b commitffb5fa3

File tree

1 file changed

+14
-26
lines changed

1 file changed

+14
-26
lines changed

‎README.md‎

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -373,38 +373,26 @@ def email_client(clients: Iterator[Client]) -> None:
373373

374374
**Bad:**
375375

376-
```php
377-
class Email
378-
{
379-
//...
380-
381-
public function handle()
382-
{
383-
mail($this->to, $this->subject, $this->body);
384-
}
385-
}
376+
```python
377+
classEmail:
378+
defhandle(self) ->None:
379+
# Do something...
386380

387-
$message =newEmail(...);
388-
// What is this? A handle for the message? Are we writingtoa file now?
389-
$message->handle();
381+
message= Email()
382+
# What is this supposedtodo again?
383+
message.handle()
390384
```
391385

392386
**Good:**
393387

394-
```php
395-
class Email
396-
{
397-
//...
398-
399-
public function send()
400-
{
401-
mail($this->to, $this->subject, $this->body);
402-
}
403-
}
388+
```python
389+
classEmail:
390+
defsend(self) ->None:
391+
"""Send this message.
392+
"""
404393

405-
$message = new Email(...);
406-
// Clear and obvious
407-
$message->send();
394+
message= Email()
395+
message.send()
408396
```
409397

410398
**[⬆ back to top](#table-of-contents)**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp