[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/pyg/ - Python general

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 27
Thread images: 5

File: 960.jpg (44KB, 960x540px) Image search: [Google]
960.jpg
44KB, 960x540px
/pyg/ Python general

Let's have one of these.

Help and discussions about the Python language, libraries, etc.

>Language tutorial
https://docs.python.org/3/tutorial/

>Web development frameworks
http://flask.pocoo.org/
https://www.djangoproject.com/

>SQL
http://www.sqlalchemy.org/

>Plotting
http://matplotlib.org/

>Machine Learning / Scientific calculations
http://www.numpy.org/
http://pandas.pydata.org/
https://www.tensorflow.org/
http://scikit-learn.org/

>Astronomy
http://www.astropy.org/

>Python Package Index (PyPi)
https://pypi.python.org/pypi

>Pycon 2016 talks
https://www.youtube.com/channel/UCwTD5zJbsQGJN75MwbykYNw

>EuroPython 2016 talks
https://www.youtube.com/playlist?list=PL8uoeex94UhE3FDvjacSlHFffoNEoPzzm

What are you working on, /g/?
>>
Can someone explain what yield does?
>>
>>59465388
It's like return
>>
>>59465388
It returns a generator rather than a list.
>>
File: altucu.jpg (47KB, 465x512px) Image search: [Google]
altucu.jpg
47KB, 465x512px
>>
>>59465388
yield turns a function into a generator. What this means is that now, whenever you iterate over the generator, it will return a value, which is 'yielded' from the generator.

This gives some nice properties, like you do not need to return all values at once (saves memory) or allows to abstract data retrieval (e.g. you write a generator which returns rows from SQL Table).

e.g. a generator which returns odd numbers:

def yield_odd():
current_number = 1

while True:
current_number += 2
yield current_number


# this will go on forever
for i in yield_odd():
print(i)
>>
>>59465228
Is it a good idea to write android apps with kivy?
>>
>>59465604
I never tried it, but if you can, try writing it as a web app, rather than native. Easier portability and maintenance.
>>
>>59465498
>>59465483
>>59465463
Thanks, seems useful. I'll try it out.
>>
>>59465707
currently going from python -> clojure for hobby programming, but still using python for work.

flask json api / deep learning / NLP / scripting general

Overall 9/10 language, only thing that needs fixing is the concurrency model. Maybe python 3 fixed that but I haven't tried it so idk.
>>
>>59465707
Don't believe his lies. Generating rows from SQL databases makes no performance increase.
>>
>>59465765
Is there an NLP framework like spaCy that doesn't require so much training data? I'm unfamiliar with how NLP works but the spaCy similarity() function to analyze the sentiment of two strings works really well and handles, I assume, tokenization etc. behind the scenes which other frameworks don't seem to do. I don't mind losing accuracy at the expense of freeing up disk space.
>>
>>59465814
1) Fetching data in batches of e.g. 1000 rows per batch is better than fetching everything in one go
2) Abstracting the code to connect to db, query it and retrieve the results, makes the code easier to read
>>
Can i hack NSA with this?
>>
>>59465882
That has nothing to do with generators. The SQL connector will push as many rows into the socket as fast as he can. You pulling them out one by one with a generator or iterator or enumerator makes no difference.

It would only make a difference if you were accessing the database itself, not through a connector.

A better example of generators is statistics, mathematical sequences (taylor, fibonacci) and shit.
>>
>>59466062
It will push as many as were generated by the SQL Statement. What I'm talking about is using LIMIT / OFFSET / TOP (whatever you're on) to retrieve a subset of rows and then in each subsequent iteration, change the offset in the SQL query to retrieve next batch.
>>
favorite out of the ordinary use for it?
>>
I'm using Python to compare laser scanning data. It's not going to be fun once I have to process very dense point clouds...

I should probably learn C
>>
What's your view on list comprehensions?
>>
File: 1489259653011.jpg (52KB, 700x466px) Image search: [Google]
1489259653011.jpg
52KB, 700x466px
>mfw a gentooman tells me to learn an embedded systems language instead
>>
>>59468219
Seems easy enough to me.
>>
nth for flask
>>
I want to start learning python, what book should i buy?
>>
File: mousebook.png (173KB, 463x435px) Image search: [Google]
mousebook.png
173KB, 463x435px
>>59468388
If you want to all out, the mouse book is pretty comprehensive.
>>
>>59468445
Thanks, i'll look at some reviews and probaly buy it
>>
>>59468388
Don't need to buy anything. You can start with the official documentation, which is pretty good

https://docs.python.org/3/tutorial/index.html

or

http://www.diveintopython3.net/
>>
>>59468486
I'll check it out. Thank you
Thread posts: 27
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.