[Question]
  [
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
 
 
---
**Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/59997/edit).
Closed 8 years ago.
[Improve this question](/posts/59997/edit) 
Pyth is in ongoing development, meaning that new features are being added all the time.
I want to make Pyth a better langauge, so I'd like to know what features people are looking for.
This is the place the post ideas you have for making Pyth better.
In your answer, please state:
* What you'd like to see changed/added.
* An example usage of the change.
I'll comment if I'm planning to implement the suggestion.
Please check if the idea you want to suggest has already been suggested. Upvote ideas you'd like implemented.
---
Implemented suggestions:
* [Eval string in Pyth](https://codegolf.stackexchange.com/a/60037/20080), as `.v`
* [More Regex operations](https://codegolf.stackexchange.com/a/60001/20080)
* [Apply While](https://codegolf.stackexchange.com/a/60036/20080) as `.W`
* [Nested Loops](https://codegolf.stackexchange.com/a/60025/20080) and [More Lambdas](https://codegolf.stackexchange.com/a/61066/20080) (They use the same mechanism underneath)
* [Flatten nested lists](https://codegolf.stackexchange.com/a/60036/20080) as `.n`
---
This was on topic as per [this meta question](http://meta.codegolf.stackexchange.com/questions/6905/can-i-ask-a-question-about-improving-a-golfing-language) when I posted the question, it is no longer clear.
  
[Answer]
## Nested loops
If you want to nest `for` loops, you currently have to waste a byte for using `F<var><seq>` inside a `V<seq>` or vice versa. I'd love to have the same thing as with lambdas, where the variable used for the loop would change when nesting loops.
[Answer]
# Turt
Pyth equivalent of [turtle graphics](https://en.wikipedia.org/wiki/Turtle_graphics), as per [`import turtle`](https://docs.python.org/2/library/turtle.html).
[Answer]
## Easier Module Importing
So far, every time I have used `$` it has been something like:
```
$from <module> import <function> as <pyth-function-with-same-arity>$
for example:
$from unicodedata import name as neg$
```
There could be a new function that summarized this for example `.$`:
```
.$"unicodedata""name""neg"
.$"unicodedata name neg"
```
Or using the newer syntax like `_M` which may not be easy/possible to do:
```
_$unicodedata name$
```
In addition, one function with each arity could be given a single letter macro name so that these calls could be shorter (except for the `_$` option).
[Answer]
# Sleeping
This caused trouble [here](https://codegolf.stackexchange.com/a/60219/21009), and [@mbomb007 suggested to put it as an improvement to Pyth](https://codegolf.stackexchange.com/questions/60188/time-sensitive-echo/60219?noredirect=1#comment144849_60219). Basically, right now, in order to sleep for the given number of seconds, I need to do something like:
```
Q$__import__('time').sleep(Q)$
```
Which is annoying and long as heck.
[Answer]
# More lambdas
*This is really [FryAmTheEggman's idea](https://codegolf.stackexchange.com/questions/59997/how-can-pyth-be-improved/60036#comment144323_60025), but I'm posting it to get it out there.*
Sometimes I find that using two different one-argument lambdas would shorten the code, while having to use a two-argument lambda for one wouldn't.
It would be nice to have `L`, `M` and friends redefine a different function every time used; for example, this code:
```
L*b2L*b3y5'5
```
could compile to:
```
@memoized
def subsets(b):
 return times(b,2)
@memoized
def read_file(b):
 return times(b,3)
imp_print(subsets(5))
imp_print(read_file(5))
```
The exact choice of functions could be changed, of course.
[Answer]
## Improved multi-dimensional arrays
Using multi-dimensional arrays is rather hard to do currently. For example, the C code `A[B][C][D]` would translate to `@@@ABCD` in Pyth. Something like `@A[BCD)` would be much nicer (albeit not any shorter here). The same also goes for `X`; `A[B][C][D] = E` is currently `X@@ABCDE`, when it could be `XA[BCD)E`.
[Answer]
## Some minor ideas
* Absolute difference, i.e. `abs(val1 - val2)`. Currently it's `.a-<val1><val2>`.
* `min`/`max` for values. Currently it's `hS,<val1><val2>`/`eS,<val1><val2>` or the same thing with more values. (`hS<seq>`/`eS<seq>` for sequences is short enough.)
[Answer]
Not a Pyth feature, but nevertheless...
## Modularize the Pyth code
This only affects Pyth under the hood. Some parts of the Pyth implementation are quite messy. Lots of global variables and other hacky things. 
I really got frustrated a few days ago, when I tried using a few functions of the Pyth implementation (like executing a string of Pyth commands) from another Python script. 
Something like the following would be nice:
```
from pyth import execute_pyth
print(execute_pyth(code='sQ', input='[1, 2, 3]'))
```
Well, I guess this is just a help call for Pyth5. 
[Answer]
# Unique elements
Pyth currently has no short way of getting unique elements of a sequence. You can *test* if it's unique, but you can't get the items that are actually unique. Currently, [the shortest way is](https://codegolf.stackexchange.com/a/60649/21009):
```
{.-Q{Q
```
6 bytes! Compare that to K, where getting the unique elements is a one-byte operation: `=x`.
Maybe `.}` would work here?
]