<?xml version="1.0" encoding="utf-8" ?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>Програмиране с Python</title>
<link>http://oldfmi.py-bg.net/forums/</link>
<description>Последни 35 отговора във форумите на курса Програмиране с Python</description>
<language>en</language>
<pubDate>Fri, 27 Sep 2013 19:08:54 +0000</pubDate>

<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1101</link>
<pubDate>Mon, 05 May 2008 13:01:49 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1101@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Забравете за &#60;code&#62;partition()&#60;/code&#62;-на на отрицателни рационални числа.
&#60;/p&#62;</description>
</item>
<item>
<title>iavoriankov on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1100</link>
<pubDate>Sun, 04 May 2008 22:19:39 +0000</pubDate>
<dc:creator>iavoriankov</dc:creator>
<guid isPermaLink="false">1100@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;хм тоя partition си бе</description>
</item>
<item>
<title>tty on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1098</link>
<pubDate>Sun, 04 May 2008 19:59:51 +0000</pubDate>
<dc:creator>tty</dc:creator>
<guid isPermaLink="false">1098@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;</description>
</item>
<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1074</link>
<pubDate>Fri, 02 May 2008 10:06:32 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1074@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Всъщност идеята на &#60;code&#62;partiton()&#60;/code&#62;-а бе</description>
</item>
<item>
<title>roadstar on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1073</link>
<pubDate>Fri, 02 May 2008 00:48:24 +0000</pubDate>
<dc:creator>roadstar</dc:creator>
<guid isPermaLink="false">1073@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Май има гре</description>
</item>
<item>
<title>aquarius on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1072</link>
<pubDate>Thu, 01 May 2008 17:57:57 +0000</pubDate>
<dc:creator>aquarius</dc:creator>
<guid isPermaLink="false">1072@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;&#60;strong&#62;__coerce__&#60;/strong&#62;:&#60;/p&#62;
&#60;p&#62;Забравете всичко казано за &#60;code&#62;__coerce__&#60;/code&#62;. Моя гре</description>
</item>
<item>
<title>Pitboss on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1071</link>
<pubDate>Thu, 01 May 2008 16:44:05 +0000</pubDate>
<dc:creator>Pitboss</dc:creator>
<guid isPermaLink="false">1071@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Добре аз по въпросът с __coerce__, така и не разбрах... То не работи ли само със стар стил класове и въобще за какво ни е то като в __cmp__ можем да си го направим ?
&#60;/p&#62;</description>
</item>
<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1070</link>
<pubDate>Thu, 01 May 2008 15:40:53 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1070@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;SlayerX, според правилата, трябва &#60;code&#62;0 + rational(1, 3)&#60;/code&#62; да бъде равно на &#60;code&#62;rational(-1, 3)&#60;/code&#62;, което не е вярно. Отново според правилата, ако &#60;code&#62;x&#60;/code&#62; е цялата част, а &#60;code&#62;у&#60;/code&#62; е дробната, то &#60;code&#62;x + y = r&#60;/code&#62;, където &#60;code&#62;r&#60;/code&#62; е изходното рационално число, &#60;code&#62;x&#60;/code&#62; е цяло, а &#60;code&#62;y&#60;/code&#62; е по-малко от 1. Тоест, според правилата, &#60;code&#62;rational(-1, 3).partition()&#60;/code&#62; трябва да върне &#60;code&#62;(0, rational(-1, 3))&#60;/code&#62;. Направих едно пояснение в условието.
&#60;/p&#62;</description>
</item>
<item>
<title>SlayerX on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1068</link>
<pubDate>Thu, 01 May 2008 12:31:37 +0000</pubDate>
<dc:creator>SlayerX</dc:creator>
<guid isPermaLink="false">1068@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;r(-1,3).partition() = ?&#60;br /&#62;
Според правилата трябва да е:&#60;br /&#62;
(0, rational(1,3))&#60;br /&#62;
обаче това е r(1,3).partition().
&#60;/p&#62;</description>
</item>
<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1066</link>
<pubDate>Wed, 30 Apr 2008 19:14:11 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1066@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;ENIGMA, какво ще прави &#60;code&#62;lcd(other)&#60;/code&#62; (наместо &#60;code&#62;r.lcd(other)&#60;/code&#62;)?&#60;br /&#62;
&#60;code&#62;r.num()&#60;/code&#62; е метод, &#60;code&#62;r.num&#60;/code&#62; не е.
&#60;/p&#62;</description>
</item>
<item>
<title>ENIGMA on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1065</link>
<pubDate>Wed, 30 Apr 2008 18:09:34 +0000</pubDate>
<dc:creator>ENIGMA</dc:creator>
<guid isPermaLink="false">1065@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Да речем, че r е инстанция на класа rational. Тогава как да извикваме методите:&#60;/p&#62;
&#60;p&#62;r.num()  /както е в теста/   или   r.num  &#60;/p&#62;
&#60;p&#62;lcd(other)  /както е описано в задачата/  или   r.lcd(other)  ?
&#60;/p&#62;</description>
</item>
<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1063</link>
<pubDate>Wed, 30 Apr 2008 14:49:19 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1063@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Как си я дефинирал тази gcd? За момента може да я дефинира</description>
</item>
<item>
<title>ENIGMA on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1062</link>
<pubDate>Wed, 30 Apr 2008 14:45:00 +0000</pubDate>
<dc:creator>ENIGMA</dc:creator>
<guid isPermaLink="false">1062@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;В класа rational съм си дефинирала функция  gcd и искам да я използвам при дефиницията на компилатора, но ми излиза гре</description>
</item>
<item>
<title>Pitboss on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1061</link>
<pubDate>Wed, 30 Apr 2008 14:03:27 +0000</pubDate>
<dc:creator>Pitboss</dc:creator>
<guid isPermaLink="false">1061@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Т`ва __coerce__ на мен ли ми се струва или баца само с класове стар стил ?
&#60;/p&#62;</description>
</item>
<item>
<title>dzver on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1054</link>
<pubDate>Tue, 29 Apr 2008 18:21:00 +0000</pubDate>
<dc:creator>dzver</dc:creator>
<guid isPermaLink="false">1054@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;__coerce__ пи</description>
</item>
<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1053</link>
<pubDate>Tue, 29 Apr 2008 09:57:24 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1053@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Chrono, както вече бе</description>
</item>
<item>
<title>ichernev on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1052</link>
<pubDate>Tue, 29 Apr 2008 07:25:55 +0000</pubDate>
<dc:creator>ichernev</dc:creator>
<guid isPermaLink="false">1052@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Ми</description>
</item>
<item>
<title>Chrono on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1050</link>
<pubDate>Tue, 29 Apr 2008 03:22:27 +0000</pubDate>
<dc:creator>Chrono</dc:creator>
<guid isPermaLink="false">1050@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Може ли малко подсказка как се прави това:&#60;/p&#62;
&#60;p&#62;b = rational(1,3)&#60;/p&#62;
&#60;p&#62;c = 1 + b&#60;/p&#62;
&#60;p&#62;Програмата ми може да прави:&#60;br /&#62;
c = b + 1&#60;br /&#62;
c = b + 1 + b + a + d + 3 + b&#60;/p&#62;
&#60;p&#62;но когато първата част е int, ми дава:&#60;br /&#62;
TypeError: unsupported operand type(s) for +: 'int' and 'instance'&#60;/p&#62;
&#60;p&#62;Работи ми за ~b==3 и 3==~b, което означава, че нямам гре</description>
</item>
<item>
<title>Chrono on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1049</link>
<pubDate>Tue, 29 Apr 2008 01:35:45 +0000</pubDate>
<dc:creator>Chrono</dc:creator>
<guid isPermaLink="false">1049@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;rational(0,-5)&#60;/p&#62;
&#60;p&#62;Какво правим в този случай?&#60;br /&#62;
Аз пи</description>
</item>
<item>
<title>ichernev on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1032</link>
<pubDate>Sat, 26 Apr 2008 23:38:48 +0000</pubDate>
<dc:creator>ichernev</dc:creator>
<guid isPermaLink="false">1032@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;добре за функцията печели</description>
</item>
<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1031</link>
<pubDate>Sat, 26 Apr 2008 22:46:24 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1031@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Ее, човек, за какво са ти тези аргументи на функцията :) Пробвай така:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;def foo(a) x = 5
foo.func_code.co_varnames[:foo.func_code.co_argcount]&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#38;nbsp;&#60;br /&#62;
За &#60;code&#62;__coerce__&#60;/code&#62; &#38;mdash; при мен щом не гърми, значи проблемът е в твоя телевизор. &#60;/p&#62;
&#60;p&#62;П.п. Човече, на теб ако ти кажем някоя нова функция вече... Бива ли да направи</description>
</item>
<item>
<title>ichernev on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1030</link>
<pubDate>Sat, 26 Apr 2008 22:04:28 +0000</pubDate>
<dc:creator>ichernev</dc:creator>
<guid isPermaLink="false">1030@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Примера ти работи, обаче за rational гърми:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;gt;&#38;gt;&#38;gt; rational.rational (2) == 2
Traceback (most recent call last):
  File &#38;quot;&#38;lt;stdin&#38;gt;&#38;quot;, line 1, in &#38;lt;module&#38;gt;
  File &#38;quot;rational.py&#38;quot;, line 61, in __cmp__
    return lhs.num () * rhs.den () - lhs.den () * rhs.num ()
AttributeError: &#38;#39;int&#38;#39; object has no attribute &#38;#39;den&#38;#39;&#60;/code&#62;&#60;/pre&#62;
&#60;pre&#62;&#60;code&#62;def __cmp__ (lhs, rhs):
		return lhs.num () * rhs.den () - lhs.den () * rhs.num ()

def __coerce__ (self, other):
	print &#38;quot;in coerce&#38;quot;
	if isinstance (other, (int, long)):
		return (self, self.__class__(other))
	else:
		return None&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;
виж какво става с varnames - пробвах го и преди:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;def foo (a, b, chernev = False):
    xxx = &#38;#39;pederastiq&#38;#39;
    return xxx

print foo.func_code.co_varnames
(&#38;#39;a&#38;#39;, &#38;#39;b&#38;#39;, &#38;#39;chernev&#38;#39;, &#38;#39;xxx&#38;#39;)&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1029</link>
<pubDate>Sat, 26 Apr 2008 21:10:03 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1029@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;</description>
</item>
<item>
<title>ichernev on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1026</link>
<pubDate>Sat, 26 Apr 2008 15:27:33 +0000</pubDate>
<dc:creator>ichernev</dc:creator>
<guid isPermaLink="false">1026@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Добре в крайна сметка задължително ли е да ползваме това &#60;code&#62;__coerce__&#60;/code&#62;.</description>
</item>
<item>
<title>ichernev on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1025</link>
<pubDate>Sat, 26 Apr 2008 14:10:02 +0000</pubDate>
<dc:creator>ichernev</dc:creator>
<guid isPermaLink="false">1025@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Добре тогава значи аз не правя нещо както трябва:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;def __coerce__ (self, other):
		print &#38;quot;in coerce&#38;quot;
		if isinstance (other, (int, long)):
			return (self, rational (other))
		else:
			return None&#60;/code&#62;&#60;/pre&#62;
&#60;pre&#62;&#60;code&#62;def __eq__ (lhs, rhs):
		return lhs.num () == rhs.num () and lhs.den () == rhs.den ()&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;това не работи нито със __eq__ нито със __cmp__&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;rational (2, 1) == 2&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Примерите и самата лекция за метакласове ще ги качите ли?</description>
</item>
<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1022</link>
<pubDate>Sat, 26 Apr 2008 11:21:52 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1022@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;</description>
</item>
<item>
<title>ichernev on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1020</link>
<pubDate>Fri, 25 Apr 2008 23:49:49 +0000</pubDate>
<dc:creator>ichernev</dc:creator>
<guid isPermaLink="false">1020@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;&#60;code&#62;rational (-5, 3).partition == (-2, rational (1, 3))&#60;/code&#62; # според условието&#60;br /&#62;
&#60;code&#62;rational (-5, 3).partition == (-1, rational (2, 3))&#60;/code&#62; # според common sense&#60;/p&#62;
&#60;p&#62;&#60;em&#62;Знам&#60;/em&#62;, че е ясно дефинирано просто питам дали 2рото няма да е по-удачно.&#60;/p&#62;
&#60;p&#62;Същото важи и за конвертирането до цели типове - вижте следното интересно нещо:&#60;br /&#62;
&#60;code&#62;int (rational (-5, 3)) == -2&#60;/code&#62; # по условие&#60;br /&#62;
&#60;code&#62;float (rational (-5, 3)) == -1.6666&#60;/code&#62; # тука всичко ок&#60;br /&#62;
&#60;code&#62;int (float (rational (-5, 3)) == -1&#60;/code&#62; # опааа&#60;/p&#62;
&#60;p&#62;Няма ли да е по-добре и тук да се закръгля 'към нулата'&#60;/p&#62;
&#60;p&#62;Може ли да дадете малко повече информация за това __coerce__ (или поне линк към такава), защото намирам само бегло описание, което не казва точно при какви условия се вика функцията. Аз я написах да уеднаквява с int и long и не се вика при &#60;code&#62;rational (2, 1) == 2&#60;/code&#62;.&#60;/p&#62;
&#60;p&#62;Става ли да качите и последните лекции?
&#60;/p&#62;</description>
</item>
<item>
<title>wireman on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1018</link>
<pubDate>Fri, 25 Apr 2008 19:34:01 +0000</pubDate>
<dc:creator>wireman</dc:creator>
<guid isPermaLink="false">1018@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;p&#62;Мда, много тъжно за всички вас. :)
&#60;/p&#62;</description>
</item>
<item>
<title>espr1t on "Пета задача"</title>
<link>http://oldfmi.py-bg.net/forums/topic/151#post-1017</link>
<pubDate>Fri, 25 Apr 2008 18:48:15 +0000</pubDate>
<dc:creator>espr1t</dc:creator>
<guid isPermaLink="false">1017@http://oldfmi.py-bg.net/forums/</guid>
<description>&#60;blockquote&#62;&#60;p&#62;Краен срок: 14 април 2008г., 19:00 часа.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Съжалявам. Всички имате по 0 точки, изпуснали сте крайния срок (rofl)
&#60;/p&#62;</description>
</item>

</channel>
</rss>
