<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Disqus - Latest Comments for kmike</title><link>http://disqus.com/by/kmike/</link><description></description><atom:link href="http://disqus.com/kmike/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 03 Jul 2020 09:08:33 -0000</lastBuildDate><item><title>Re: Writing Scrapy Spiders in 2020</title><link>https://stummjr.org/post/scrapy-in-2020/#comment-4977991378</link><description>&lt;p&gt;Awesome article Valdir!&lt;/p&gt;&lt;p&gt;It seems it was reposted with minor changes at &lt;a href="https://towardsdatascience.com/efficient-web-scraping-with-scrapy-571694d52a6" rel="nofollow noopener" target="_blank" title="https://towardsdatascience.com/efficient-web-scraping-with-scrapy-571694d52a6"&gt;https://towardsdatascience....&lt;/a&gt; - are you in contact with Aaron?&lt;/p&gt;&lt;p&gt;---&lt;/p&gt;&lt;p&gt;A small correction: in the last example parse_full_blog_post should receive "date" argument, not "post_date".&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Fri, 03 Jul 2020 09:08:33 -0000</pubDate></item><item><title>Re: Web Scraping with Scrapy and MongoDB - Real Python</title><link>https://realpython.com/web-scraping-with-scrapy-and-mongodb/#comment-2349864605</link><description>&lt;p&gt;Hey,&lt;/p&gt;&lt;p&gt;MongoDBPipeline has a small bug - it is not closing connection properly. Check &lt;a href="http://doc.scrapy.org/en/latest/topics/item-pipeline.html#write-items-to-mongodb" rel="nofollow noopener" target="_blank" title="http://doc.scrapy.org/en/latest/topics/item-pipeline.html#write-items-to-mongodb"&gt;http://doc.scrapy.org/en/la...&lt;/a&gt;. Not that it matters in this example, but in some cases (like &lt;a href="https://github.com/scrapinghub/scrapyrt)" rel="nofollow noopener" target="_blank" title="https://github.com/scrapinghub/scrapyrt)"&gt;https://github.com/scraping...&lt;/a&gt; it could.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Mon, 09 Nov 2015 06:05:12 -0000</pubDate></item><item><title>Re: Rules of Thumb for Methods and Functions
    </title><link>http://emptysqua.re/blog/rules-of-thumb-methods-and-functions/#comment-1444130412</link><description>&lt;p&gt;The intention to minimize state changes is great.&lt;/p&gt;&lt;p&gt;What about classmethods? If a public function is called by other functions from the same module (or may be called in future) then writing it as a @classmethod instead of just a function has advantages - this enables overriding it in subclasses; for module-level functions the alternative is either copy-pasting or monkey-patching.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Thu, 19 Jun 2014 12:42:18 -0000</pubDate></item><item><title>Re: Cross-Python metaclasses </title><link>http://www.zopatista.com/python/2014/03/14/cross-python-metaclasses/#comment-1285628596</link><description>&lt;p&gt;Have you seen six.add_metaclass decorator? It does basically the same as yours, but also handles a few edge cases (slots, weakrefs).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Sat, 15 Mar 2014 07:06:42 -0000</pubDate></item><item><title>Re: Custom event for detecting fetch errors in Backbone.js</title><link>http://monicalent.com/blog/2013/07/29/using-a-custom-event-to-detect-fetch-errors-in-backbone-js/#comment-1122170330</link><description>&lt;p&gt;I think the docs are wrong for "error" event - it is fired when collection's fetch fails. Look for 'wrapError' calls in backbone's source code.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Wed, 13 Nov 2013 20:00:16 -0000</pubDate></item><item><title>Re: kmike.ru</title><link>http://kmike.ru/python-data-structures/#comment-864372714</link><description>&lt;p&gt;Thanks! I'll add them to list.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Mon, 15 Apr 2013 10:17:39 -0000</pubDate></item><item><title>Re: Declaring dependencies in Python</title><link>http://blog.ziade.org/2013/04/13/declaring-dependencies-in-python/#comment-857946500</link><description>&lt;p&gt;In my experience install_requires was always problematic because&lt;/p&gt;&lt;p&gt;a) 'pip install -U package' upgrades all packages listed in install_requires, and&lt;/p&gt;&lt;p&gt;b) packages in install_requires could sometimes overwrite locally installed packages (when setuptools doesn't know about them - I don't remember the details, but it may the case with plain distutils packages installed via &lt;a href="http://setup.py" rel="nofollow noopener" target="_blank" title="setup.py"&gt;setup.py&lt;/a&gt;).&lt;/p&gt;&lt;p&gt;Example 1: when incompatible dateutil 2.0 was released, I broke things more than once because of packages that list dateutil in install_requirements (update package =&amp;gt; distutils gets updated =&amp;gt; computer explodes). Pinning dateutil version in install_requires couldn't help because dateutil 2.1 became compatible again and it is not possible to predict such changes.&lt;/p&gt;&lt;p&gt;Example 2: some packages list 'django' in install_requires, and they are hard to use with django development version because installing such packages overwrites local django copy.&lt;/p&gt;&lt;p&gt;I'm not sure all these problems still persist, but they bite me in past many times - I tend to avoid "install_requires" now; installing from pip requirements is not that hard.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Tue, 09 Apr 2013 16:45:05 -0000</pubDate></item><item><title>Re: PyCon RU 2013</title><link>http://chtd.ru/blog/pycon-ru-2013/#comment-813969793</link><description>&lt;p&gt;Мастер-класс был крутой!&lt;/p&gt;&lt;p&gt;только про open-source не Jacob Caplan-Moss выступал, а Russell Keith-Magee :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Wed, 27 Feb 2013 04:58:20 -0000</pubDate></item><item><title>Re: The Sorry State of Trie Implementations in Python</title><link>http://kevinformatics.com/blog/2013/sorry-state-of-trie-implementations-in-python/#comment-784257793</link><description>&lt;p&gt;It turns out that for your task pointer-based Patricia Trie suites best - because it provides fast unordered inserts and because it saves some memory if keys are long and have long unique parts. For word data or for telephones Patricia Trie may be not ideal because there is not almost no unique parts and support for this feature requires more memory. Random inserts and updates have their own cost - for example, marisa-trie or DAWG can sometimes store the same data using 20x-100x less memory than Patricia-Trie (e.g. when data is highly duplicated).&lt;/p&gt;&lt;p&gt;Most of these trie packages are not implementations of a single basic "Trie" data structure; they implement different data structures with their own trade-offs and unique features; I'd not call this a "sorry state".&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Thu, 31 Jan 2013 04:46:27 -0000</pubDate></item><item><title>Re: kmike.ru</title><link>http://kmike.ru/python-data-structures/#comment-780669869</link><description>&lt;p&gt;What I was missing is that NetworkX uses numpy for heavy calculations. Added to a list.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Mon, 28 Jan 2013 09:04:50 -0000</pubDate></item><item><title>Re: kmike.ru</title><link>http://kmike.ru/python-data-structures/#comment-780640294</link><description>&lt;p&gt;Unfortunately I'm not aware of pure-Python rope implementations.&lt;/p&gt;&lt;p&gt;Blist may be seen as an implementation of Ropes (I didn't mention this in the article).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Mon, 28 Jan 2013 08:34:50 -0000</pubDate></item><item><title>Re: 
                With Strings Attached
                
            </title><link>http://kmike.ru/python-with-strings-attached/#comment-754171399</link><description>&lt;p&gt;Hmm. Python 3.x is definitely easier to work with, but I'd say that if you're explicit about encodings and don't use __str__ and __repr__ heavily you should be fine with unicode under Python 2.x most of time. This article may give an impression that unicode under Python 2.x is a nightmare, but it isn't. Avoid writing non-ascii __str__ and __repr__ under Python 2.x, convert data to unicode as soon as possible, be explicit about encodings, and the issues described in the article should disappear.&lt;/p&gt;&lt;p&gt;..but if you want non-ascii __repr__ and __str__ then yes, the "right" answer is to change to Python 3.x :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Thu, 03 Jan 2013 02:36:13 -0000</pubDate></item><item><title>Re: kmike.ru</title><link>http://kmike.ru/python-data-structures/#comment-640437106</link><description>&lt;p&gt;Sure, that's what I meant writing "a lot of work" :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Wed, 05 Sep 2012 09:32:26 -0000</pubDate></item><item><title>Re: kmike.ru</title><link>http://kmike.ru/python-data-structures/#comment-640349618</link><description>&lt;p&gt;Many of these structures doesn't support "add" and "remove"; inserting to the beginning, inserting to the middle, appending, inserting in sorted order vs inserting in an unsorted order may all have different performance characteristics (and algorithmic complexity) for different data structures.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Wed, 05 Sep 2012 07:48:19 -0000</pubDate></item><item><title>Re: kmike.ru</title><link>http://kmike.ru/python-data-structures/#comment-638446509</link><description>&lt;p&gt;That's a lot of work :) I don't think there can be a single example application for all data structures, they are all very different. That said, datrie, marisa-trie, hat-trie and DAWG share the same benchmark suite (with a minor tweaks), have similar purpose and and all have a similar interface; benchmark results for these packages are in READMEs in corresponding repositories. And don't trust benchmarks, they are a lie, it is almost always better to measure yoursef (%timeit magic from ipython makes this very easy).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Mon, 03 Sep 2012 07:16:27 -0000</pubDate></item><item><title>Re: kmike.ru</title><link>http://kmike.ru/python-data-structures/#comment-637798977</link><description>&lt;p&gt;As far as I can tell, NetworkX is a pure-Python package. This is not a drawback and may be beneficial in many ways (e.g. such packages are easier to maintain and faster under pypy) but this list excludes pure-Python implementations intentionally.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Sun, 02 Sep 2012 05:34:28 -0000</pubDate></item><item><title>Re: kmike.ru</title><link>http://kmike.ru/python-data-structures/#comment-637131161</link><description>&lt;p&gt;Thanks for the pointer! &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Sat, 01 Sep 2012 13:22:04 -0000</pubDate></item><item><title>Re: Extending User Model in Django</title><link>http://blog.tivix.com/2012/01/06/extending-user-model-in-django/#comment-402681746</link><description>&lt;p&gt;OneToOneField relations are already available on User model: just use my_user.userprofile in your case (or rename the model to Profile and use my_user.profile). You don't need the AUTH_PROFILE_MODULE and get_profile() in most cases.&lt;br&gt;Another trick is to use AutoOneToOneField (see &lt;a href="https://bitbucket.org/wrar/django-annoying/src/7d7237a708ab/annoying/fields.py" rel="nofollow noopener" target="_blank" title="https://bitbucket.org/wrar/django-annoying/src/7d7237a708ab/annoying/fields.py"&gt;https://bitbucket.org/wrar/...&lt;/a&gt; ): this way profile will be auto created on first access and signals are not needed.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Fri, 06 Jan 2012 14:07:38 -0000</pubDate></item><item><title>Re: http://blip.tv/djangocon/advanced-django-form-usage-5573287</title><link>http://blip.tv/djangocon/advanced-django-form-usage-5573287#comment-316936606</link><description>&lt;p&gt;Just a small note: 'request.POST or None' trick will work for most views even if all form fields are empty becuse of the CSRF protection.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Wed, 21 Sep 2011 17:35:33 -0000</pubDate></item><item><title>Re: kmike.ru</title><link>http://kmike.ru/about-this-blog-ru/#comment-225833960</link><description>&lt;p&gt;спасибо! &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Tue, 14 Jun 2011 14:27:15 -0000</pubDate></item><item><title>Re: Django Application Conventions</title><link>https://streamhacker.com/2011/01/03/django-application-conventions/#comment-123648573</link><description>&lt;p&gt;The conventions for &lt;a href="http://views.py" rel="nofollow noopener" target="_blank" title="views.py"&gt;views.py&lt;/a&gt; should probably change with upcoming django 1.3: authors of django apps shouldn't use `template_name` keyword argument, they should use TemplateResponse instead (&lt;a href="http://docs.djangoproject.com/en/dev/ref/template-response/#using-templateresponse-and-simpletemplateresponse)" rel="nofollow noopener" target="_blank" title="http://docs.djangoproject.com/en/dev/ref/template-response/#using-templateresponse-and-simpletemplateresponse)"&gt;http://docs.djangoproject.c...&lt;/a&gt; or write class-based views (&lt;a href="http://docs.djangoproject.com/en/dev/topics/class-based-views/)" rel="nofollow noopener" target="_blank" title="http://docs.djangoproject.com/en/dev/topics/class-based-views/)"&gt;http://docs.djangoproject.c...&lt;/a&gt;. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Mon, 03 Jan 2011 18:33:48 -0000</pubDate></item><item><title>Re: django-anonymizer released</title><link>https://lukeplant.me.uk/blog/posts/django-anonymizer-released/#comment-572870856</link><description>&lt;p&gt;Hi Luke,&lt;br&gt;&lt;br&gt;There is also a slightly more powerful and popular &lt;a href="https://github.com/alliterativeanimal/python-faker" rel="nofollow noopener" target="_blank" title="https://github.com/alliterativeanimal/python-faker"&gt;https://github.com/alliterativeanimal/python-faker&lt;/a&gt; library for generating fake data. It supports e.g. birthday generation with Gauss distribution. Faker package by Dylan Clendenin should probably rip-off some of python-faker generators.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Fri, 24 Dec 2010 13:15:35 -0000</pubDate></item><item><title>Re: Fuzzy testing with assertNumQueries</title><link>https://lukeplant.me.uk/blog/posts/fuzzy-testing-with-assertnumqueries/#comment-572870859</link><description>&lt;p&gt;The landed assertNumQueries can't be used as a decorator unfortunately.&lt;br&gt;&lt;br&gt;FuzzyInt is a very clever trick!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Tue, 30 Nov 2010 14:40:36 -0000</pubDate></item><item><title>Re: Django patterns part 3: efficient generic relations</title><link>http://blog.roseman.org.uk/2010/02/15/django-patterns-part-3-efficient-generic-relations/#comment-45791969</link><description>&lt;p&gt;I've implemented something like this as a reusable model manager.&lt;/p&gt;&lt;p&gt;&lt;a href="http://bitbucket.org/kmike/django-generic-images/src/tip/generic_utils/managers.py" rel="nofollow noopener" target="_blank" title="http://bitbucket.org/kmike/django-generic-images/src/tip/generic_utils/managers.py"&gt;http://bitbucket.org/kmike/...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;But the names of methods are not the best :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Sat, 20 Feb 2010 09:10:00 -0000</pubDate></item><item><title>Re: SIGUSR2 
 &amp;gt; The Case of the Unusable Reusable</title><link>http://sigusr2.net/2009/Jul/22/case-of-the-unusable-reusable.html#comment-13193972</link><description>&lt;p&gt;Original django-faves app (hosted on google code) didn't have 1-sql-query capability. And I've done a similar thing: take it, implement what I need and put it on a bitbucket :) &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikhail Korobov</dc:creator><pubDate>Thu, 23 Jul 2009 02:26:00 -0000</pubDate></item></channel></rss>