Movatterモバイル変換


[0]ホーム

URL:


Sorry, we no longer support your browser
Please upgrade toMicrosoft Edge,Google Chrome, orFirefox. Learn more about ourbrowser support.
Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities includingStack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Loading…
Code Review

Tag Info

usershotnewsynonyms

Hot answers tagged

13votes
Accepted

News API in Python

RequestInstead of:...
Kate's user avatar
  • 8,778
10votes

News API in Python

NamingNewsConcerning is styled in the way PEP 8 would tell us to style a class name. As function it should be in snake case: ...
Chris's user avatar
  • 6,126
7votes

Substitute patterns with values from lists

I would prefer to takeIterable[tuple[str, Iterable[str]]] rather thandict[str, list[str]] for two reasons:...
Peilonrayz's user avatar
  • 44.6k
5votes

News API in Python

single responsibilityThe SRPsays that a function should do one thing well.The expression that replaces "concerning" and other stop wordsshould be in a helper function.For one thing, ...
J_H's user avatar
  • 43.3k
5votes

News API in Python

String Replacements and MatchingYou should use a case-insensitive regular expression using there.I flag to do your matching. For example:...
Booboo's user avatar
  • 4,101
5votes

News API in Python - Take II

Type hintsI like the usage of type hints for your functions. However, the return hintlooks wrong for:def clean_query(text: str) -> str:The function always ...
toolic's user avatar
  • 16.4k
4votes

News API in Python - Take II

SessionThis may not a big deal since you are usingrequests at only one place, but using a session has some benefits. You can set all your headers at session level ...
Kate's user avatar
  • 8,778
4votes
Accepted

News API in Python - Take II

Reinventing the wheelThe following loop simply reinventsnext....
Chris's user avatar
  • 6,126
4votes

News API in Python

Just a high-level comment: A large part of the code consists of rule-based parsing of text (all the string-replace calls). This is extremely brittle (there are lots of cases that you won't cover) and ...
mudskipper's user avatar
3votes

Find the nearest school to you

CLI user_input = input("Enter number and name of street/road ")Theinput() function has its place.But consider ...
J_H's user avatar
  • 43.3k
3votes

Find the nearest school to you

LayoutMove the function to the top after theimport lines.Having it in the middle of the code interrupts the naturalflow of the code (from a human readability ...
toolic's user avatar
  • 16.4k
3votes

Transform dataset coordinates from Lambert Conformal Conic projection to WGS84

size of significandhas high memory demandI'm only seeing 1.5 MiB for each of the pair of grids;sys.getsizeof(lon_grid) reports 1_473_416 bytes.You don't have ...
J_H's user avatar
  • 43.3k
3votes

Transform dataset coordinates from Lambert Conformal Conic projection to WGS84

Here are some general coding style suggestions.NamingThe PEP 8 style guide recommendsusing all capital letters for constants. For example:dx, dy = 0.1, 0.1...
toolic's user avatar
  • 16.4k
3votes
Accepted

Create Frame Widget with Pygame

skipped events...
J_H's user avatar
  • 43.3k
3votes

Create Frame Widget with Pygame

I have just read the code and made no attempt to run it, so this is a high level overview but some things are visually obvious.DRY (do not repeat yourself)In function ...
Kate's user avatar
  • 8,778
3votes

Hackerearth: Counting numbers in an array that are divisible by any 2 numbers

Always assume that coding challenge websites will give you worst case scenarios to test your code. They won't test your code with small arrays of small numbers. They'll give you large arrays with huge ...
Chris's user avatar
  • 6,126
3votes

Guess a Number Game

Observations:PEP 8 suggests using snake case for function names. A name likeGuessNum is appropriate for a class, but a function should be something like ...
Chris's user avatar
  • 6,126
3votes

Substitute patterns with values from lists

I'm not comfortable with that mutating pop, even if it is on a copy. Also, why not make the substitution state reusable? In the following style, subsequent calls on the same object will resume ...
Reinderien's user avatar
2votes

Beginner python program to get data from string

My review will focus on the parsing logic.months_of_year anddays_of_week should be deleted. ...
Reinderien's user avatar
2votes

Beginner python program to get data from string

strftime()...
J_H's user avatar
  • 43.3k
1vote

Parse path string

Movement conflates at least three different things: tokenising/scanning (part of lexing), evaluating, and application of the path to start coordinates. In other ...
Reinderien's user avatar
1vote

Parse path string

PortabilityI realize this question was posted many years ago when Python version 2.xwas prevalent, but now that it is deprecated, consider porting to 3.x.To do so, it is necessary to add ...
toolic's user avatar
  • 16.4k
1vote

Hackerearth: Counting numbers in an array that are divisible by any 2 numbers

PortabilityI realize this question was posted many years ago when Python version 2.xwas prevalent, but now that it is deprecated, consider porting to 3.x.To do so, it is necessary to add ...
toolic's user avatar
  • 16.4k

Only top scored, non community-wiki answers of a minimum length are eligible

15,592

questions tagged

Related Tags

 × 15592
 × 5187
 × 2368
 × 2007
 × 1235
 × 1210
 × 1047
 × 755
 × 728
 × 599
 × 552
 × 490
 × 429
 × 398
 × 357
 × 324
 × 304
 × 302
 × 295
 × 253
 × 248
 × 245
 × 238
 × 234
 × 225

[8]ページ先頭

©2009-2025 Movatter.jp