sqlalchemy / sqlalchemy/mako

continue / break control statements?

Open
#145 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation feature low priority
Dominant language
Python
Stars
459
Forks
90
PR merge metrics
No merged PRs in 30d

Description

Migrated issue, originally created by Anonymous

Hi,

I was wondering how to use control/break within a loop. I didn't find anything in the docs, so I tried this:

% for i in range(10):
% if i == 3:
% continue
% endif
${i}
% endfor

That didn't work, so I ended up with this:

% for i in range(10):
<%
if i == 3:
continue
%>
${i}
% endfor

I find the first version is more readable. Perhaps it would be nice to have 'continue' and 'break' statements to complement the flow control.

Alternatively, if there's another preferred method for issuing a continue or break, it would be great to have an example in the docs.

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the control-flow documentation and existing loop examples, then compare the two syntax forms shown in the issue. Determine whether direct continue and break statements are intended, or whether the preferred existing method should be documented; done means the chosen behavior or documented example is clear and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.