Skip to content

Commit 0d2b559

Browse files
author
Zhang Cheng
committed
changes some error in Back-end Programming Guide
1 parent d1bde76 commit 0d2b559

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

BackendProgrammingGuide.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,17 @@ for i in range(len(list)):
5454

5555
When you initialize the list, use `*` rather than a `for` loop:
5656

57+
This is not used that often
58+
5759
For example use:
5860
```python
59-
emptyMatrix = [[]] * LenMatrix
61+
empty_list = [0] * Len_list
6062
```
6163
Instead of:
6264
```python
6365
emptyMatrix = []
6466
for _ in LenMatrix:
65-
emptyMatrix.append([])
67+
emptyMatrix.append(0)
6668
```
6769

6870
#### 4. Use `try`, `except` rather than `if` when you are dealing with Python dictionaries.
@@ -161,7 +163,7 @@ sortedList = sortby(ListofTuples, n)
161163
* Inside `/tmp/Lexos/`, there are workspace files (`.lexos` file) and the `session folder` (the folder with a random string as its name since each session is stored in its own folder)
162164
* A Workspace file is generated whenever a user clicks `Download Workspace` (presently at the top of the GUI).
163165
* Inside the `session folder`, there are at most 3 files:
164-
* `filemanager.p`: the file that contains the [FileManager](#filemanager) as
166+
* `filemanager.py`: the file that contains the [FileManager](#filemanager) as
165167
pickeled information of the files in the current session, including files that have cut into segments.
166168
In this way we can save and load (with `utility.loadFileManager` and `utility.saveFileManager`)
167169
* `filecontents/`: the folder containing all the user's uploaded files
@@ -235,9 +237,9 @@ lexos.py -> managers/utility.py (used to save and load the filemanager and push
235237
2. get result(optional, usually we don't need to get the result in a 'GET' request)
236238
3. render_template
237239
* 'POST' request (sometimes we need to use `if` `else` to handle 'POST', because we need to render different templates, for example see `topword()`)
238-
1. get result
240+
1. get the calculation result
239241
2. turn result into display form (generally handles something like generating a preview of the result) or save the result in a file (for download) (optional)
240-
3. savefilemanager (optional)
242+
3. savefilemanager (only when the file manager is changed)
241243
4. cache session
242244
5. render_template or send_file
243245

@@ -389,7 +391,7 @@ session_manager.py -> helpers/* (these files can be accessed throughout the whol
389391
* Note: THIS DOES NOT EXISTS IN THE PROJECT YET
390392

391393
* programming workflow example
392-
* for example you need to cache the option for `lalala` (because we just named our new feature `lalala`, and everyone loved this name :)
394+
* for example you need to cache the option for `lalala`, because we just decide to name our new feature `lalala`, and everyone loved this name :)
393395

394396
`helpers/constant.py`:
395397

0 commit comments

Comments
 (0)