Re: Run Python script from JS

2011-06-17 Thread Daniel Kluev
est regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Rant on web browsers

2011-06-21 Thread Daniel Kluev
from it. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Bluetooth

2011-06-26 Thread Daniel Kluev
or your own app. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Python basic program problem

2011-06-27 Thread Daniel Kluev
world') hello world In future, please include full tracebacks and python version info. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE/text-editor

2011-04-16 Thread Daniel Kluev
or me. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent code to the bool() built-in function

2011-04-17 Thread Daniel Kluev
essence, it just calls PyObject_IsTrue), it also provides needed comparison ops, repr and other magic methods for the type. You can check Objects/boolobject.c in python repository if its implementation is interesting for you. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent code to the bool() built-in function

2011-04-17 Thread Daniel Kluev
JUMPTO(oparg); else break; continue; So technically these implementations are equivalent besides the fact that bool() is type rather than function. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Equivalent code to the bool() built-in function

2011-04-17 Thread Daniel Kluev
to do explicit casting to boolean than the hack in OP. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Can you advice a Python library to query a lan subnet with SNMP and collect MAC addresses of nodes?

2011-04-18 Thread Daniel Kluev
Isn't it better to use subprocess.Popen and read stdout/stderr directly? Should be much more convenient than temporary files. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a difference between one line and many lines

2011-04-21 Thread Daniel Kluev
its purely syntactic, and is compiled to exactly same bytecode. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Argument count mismatch

2011-04-22 Thread Daniel Kluev
n global, and usually cause no harm, since framework guarantees that these instances are bound to context of this particular http request. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: When is PEP necessary?

2011-04-23 Thread Daniel Kluev
pure-python modules, anything tied to C-API better be documented, or it becomes a nightmare to keep non-CPython version having identical interface. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Function __defaults__

2011-04-24 Thread Daniel Kluev
ature -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Function __defaults__

2011-04-24 Thread Daniel Kluev
.. return a ... >>> test() 123 >>> test.func_defaults (123,) >>> test.func_defaults = (456,) >>> test() 456 -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] VCS tools

2011-04-28 Thread Daniel Kluev
cting it to, and was overall very easy to learn. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: use of index (beginner's question)

2011-04-28 Thread Daniel Kluev
t s2 list2 >>> print locals()[s2] ['62327', '49123', '79115'] >>> print locals()[s2][0] 62327 But generally if you need to do that, you would be better with re-design of your data/architecture. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Comparing VCS tools (was ""Development tools and practices for Pythonistas")

2011-04-29 Thread Daniel Kluev
We were looking for some simple integrated SCM, issue tracker and wiki in our university for software design and software testing courses, and fossil seems to be perfect match, thanks for sharing. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Daniel Kluev
utable, when you do `var = 1` you create new object of type int, and re-assign `var` name to point to new object. `foo.var`, on other hand, is a way to access `foo`'s own namespace, so its exactly same name as globals()['var'] of `foo`. -- With best regards, Daniel Kluev --

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Daniel Kluev
attribute__(attr) def __repr__(self): return self.__get().__repr__() def __str__(self): return self.__get().__str__() >>> a = 1 >>> b = SymbolicReference(globals(), 'a') >>> b 1 >>> a = 10 >>> b 10 -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: How best to convert a string "list" to a python list

2011-05-14 Thread Daniel Kluev
On Sat, May 14, 2011 at 7:41 PM, Nobody wrote: > to use a regular expression to match everything up to the next delimiter, > and do this in a loop to extract the individual items. re.findall() should let you match all items at once, without loop. -- With best regards, Daniel Kluev --

Re: Python 3.2 Vectors.py module

2011-05-15 Thread Daniel Kluev
etter if you pack it in separate package and upload to PyPI. You can find good tutorial on packaging here: http://diveintopython3.org/packaging.html - NumPy/SciPy has pretty fair support for vectors. Would be good if you pointed out the differences to begin with. -- With best regards, Daniel Kl

Re: threads with gtk gui problem

2011-05-15 Thread Daniel Kluev
You can also use multiprocessing module instead of threads. Use pipe and gobject.idle_add(somefunc) to process data from other thread. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-15 Thread Daniel Kluev
parts you want to hide in C/C++/Cython and distribute them as .so/.dll -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a set into list

2011-05-15 Thread Daniel Kluev
"s=set(l2); l3 = [i for i in l1 if i in s]" 10 loops, best of 3: 28.1 msec per loop So even with conversion back into list set&set is still marginally faster. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Overuse of try/except/else?

2011-05-21 Thread Daniel Kluev
On Tue, May 10, 2011 at 11:40 AM, Kyle T. Jones wrote: > > It has been hard for me to determine what would constitute overuse. > Good example of abuse is catching KeyboardInterrupt or SystemExit inside some library code. PycURL does it, and its truly annoying. -- With best regard

Re: Abandoning Python

2011-05-21 Thread Daniel Kluev
expecting some language to acquire "even larger user base" is hopeless. Also, most of these complaints could be solved by using correct python dialect for particular task - RPython, Cython and so on. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Abandoning Python

2011-05-21 Thread Daniel Kluev
On Sun, May 22, 2011 at 12:25 PM, Daniel Kluev wrote: > According to all language popularity indexes [1-10], C# and Forgot to include references, although everyone probably already knows them, [1] https://www.ohloh.net/languages?query=&sort=projects [2] http://www.tiobe.com/index.php/

Re: Why did Quora choose Python for its development?

2011-05-22 Thread Daniel Kluev
actly is so 'advanced' about them which cannot be done in python. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Abandoning Python

2011-05-22 Thread Daniel Kluev
On Mon, May 23, 2011 at 4:33 AM, John Lee wrote: > Pylint?  Does it provide some kind of guessed-at-type that has been integrated > with IDEs? WingIDE Pro has both Pylint integration and advanced type-guessing. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/li

Re: Why did Quora choose Python for its development?

2011-05-22 Thread Daniel Kluev
On Sun, May 22, 2011 at 11:47 PM, Octavian Rasnita wrote: > From: "Daniel Kluev" > I am talking about that flexibility which was criticized in the previous > messages telling that this flexibility allows any programmer to use his own > way. > Perl doesn't force an

Re: Why did Quora choose Python for its development?

2011-05-23 Thread Daniel Kluev
> for anyone to just say "go to read the documentation and see how great it > is". But "go to read the docs" argument works both ways - I have zero knowledge of DBIx::Class, so obviously I cannot say what features it lacks compared to SQLA. However this is what I wanted to highlight - you cannot simply state that "Perl offers more advanced modules and libraries which are not available for Python" if you don't have reasonable experience with according Python modules. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Why did Quora choose Python for its development?

2011-05-23 Thread Daniel Kluev
27;array' somewhere in stdlib. As for "can't do": >>> a = [1,2] >>> dict([a]) {1: 2} >>> a = (1,2) >>> dict([a]) {1: 2} -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Why did Quora choose Python for its development?

2011-05-23 Thread Daniel Kluev
On Mon, May 23, 2011 at 8:41 PM, Octavian Rasnita wrote: > From: "Daniel Kluev" > As I said, that ORM is not able to do those SQL constructs without using > literal SQL code, but only Python variables and data structures... > An ORM is usually prefered exactly becaus

Re: Python 2.6 and timezones

2011-05-23 Thread Daniel Kluev
info-objects -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Why did Quora choose Python for its development?

2011-05-23 Thread Daniel Kluev
On Mon, May 23, 2011 at 10:17 PM, Octavian Rasnita wrote: > From: "Daniel Kluev" > Aha, so with other words that ORM doesn't have that feature. > DBIX::Class also use the DateTime module, but it can use it directly, > without needing to write more code for t

Re: Python 2.6 and timezones

2011-05-23 Thread Daniel Kluev
emote_tz.utcoffset(now) datetime.timedelta(-1, 68400) You can add or substract these timedelta objects directly from datetime objects or use astimezone(): >>> now = datetime.now(local_tz) >>> now datetime.datetime(2011, 5, 23, 22, 41, 48, 398685, tzinfo=pytz.FixedOffset(600)) &

Re: Why did Quora choose Python for its development?

2011-05-23 Thread Daniel Kluev
of proper 1, 3, as it does in python: >>> dict([[1,2], [3,4]]).keys() [1, 3] This is yet another example that you are just trolling here, making silly and unbacked claims, and ignoring any valid arguments you receive. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Why did Quora choose Python for its development?

2011-05-24 Thread Daniel Kluev
gly syntax. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Why did Quora choose Python for its development?

2011-05-26 Thread Daniel Kluev
of obscure "=>" pseudo-syntax to cover it up. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: GIL in alternative implementations

2011-05-27 Thread Daniel Kluev
hing is reasonable to do in real code, but cpython and other implementations with GIL at least give you some safety margin. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters

2011-05-30 Thread Daniel Kluev
On Mon, May 30, 2011 at 6:12 PM, Laurent Claessens wrote: > Could you give an example of an object that has no name ? I've missed > something ... >>> object() -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters (take two)

2011-05-30 Thread Daniel Kluev
x27; references to the list, which is referenced by obj1, and calls append method of this list, which modifies itself in place global obj1 obj1 = [] # 'a' still references to original list, which is [1] now, it have no relation to obj1 at all somefunc(obj1) -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters (take two)

2011-05-30 Thread Daniel Kluev
hon. On a sidenote, I wonder what is the reason to keep word 'variable' in python documentation at all. I believe word 'name' represents concept better, and those, who come from other languages, would be less likely to associate wrong definitions with it. -- With best regards,

Re: scope of function parameters (take two)

2011-05-30 Thread Daniel Kluev
n use map(lambda x: , list_of_x), and you will have your isolated scopes. Although due to lambdas supporting only expressions, following this style leads to awkward and complicated code (and/or instead if, map instead for, and so on). -- With best regards, Daniel Kluev -- http://mail.python.org/

Re: scope of function parameters (take two)

2011-05-30 Thread Daniel Kluev
/getitem can modify object too if class overrides them). Obviously it would not save you from functions which use global/globals() or some other ways to change state outside their scope. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters (take two)

2011-05-31 Thread Daniel Kluev
ords=None, defaults=None) So this decorator achieves needed result and preserves function signatures. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlalchemy and Unicode strings: errormessage

2011-05-31 Thread Daniel Kluev
xt)) Use UnicodeText instead of Text. > A_record = A_class('BUM', 'Bäumer') If this is python2.x, use u'Bäumer' instead. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters (take two)

2011-05-31 Thread Daniel Kluev
s exec to create new function, with signature of function you pass to your decorator, so it does not matter what names you used for args in decorator itself. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: String substitution VS proper mysql escaping

2010-08-17 Thread Daniel Kluev
7; and 'list' objects > Besides, using user-provided data and just concatenating it to filename like that is definitely bad idea. You should use os.path.join() at least. Regarding that kind of SQL injection, typically driver will stop it to happen when you provide 2 queries at once delimited

Re: Need to import stuff

2010-08-17 Thread Daniel Kluev
e = imp.load_module(full_name, *module_desc) -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: expression in an if statement

2010-08-18 Thread Daniel Kluev
o 56) >> 55 POP_TOP >> 56 LOAD_CONST 0 (None) 59 RETURN_VALUE > I might be wrong on some points here, but this is what I expect the > expression > (set(a).union(b) == set(a)) has to do, in any conforming implementation of >

Re: path to data files

2010-08-19 Thread Daniel Kluev
/to/somewhere. > open(os.path.join(os.path.dirname(__file__), 'foo')) -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterative vs. Recursive coding

2010-08-19 Thread Daniel Kluev
n len(filter(bool, map(lambda i: checkMatch(haystack[i:], needle), range(len(haystack) Where checkMatch would be called recursively to match needle over particular part of haystack. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Discarding STDERR generated during subprocess.popen

2010-08-23 Thread Daniel Kluev
cate()[0] > > This returns stdout, and stderr ends up printing to the console. How > can I disregard anything sent to stderr such that it doesn't appear on > the console? > Just add `stderr=subprocess.PIPE` keyword in the Popen call. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list

Re: Would you recommend python as a first programming language?

2010-11-01 Thread Daniel Kluev
> > I was thinking of recommending this to a friend but what do you all think? > Python is great language to learn programming. I've heard MIT switched from Scheme to Python as introductory language for their students. -- With best regards, Daniel Kluev -- http://mail.pyth

Re: What people are using to access this mailing list

2010-11-03 Thread Daniel Kluev
I use gmail with according filters and labels, so each mailing list has its own label and is removed from inbox. -- With best regards, Daniel Kluev -- http://mail.python.org/mailman/listinfo/python-list