est regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
from it.
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
or your own app.
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
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
or me.
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
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
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
to
do explicit casting to boolean than the hack in OP.
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
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
its purely
syntactic, and is compiled to exactly same bytecode.
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
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
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
ature
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
.. 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
cting it to,
and was overall very easy to learn.
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
--
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
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
--
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
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
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
"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
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
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
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/
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
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
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
> 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
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
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
info-objects
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
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
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))
&
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
gly syntax.
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
of obscure "=>"
pseudo-syntax to cover it up.
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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,
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/
/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
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
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
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
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
e = imp.load_module(full_name, *module_desc)
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
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
>
/to/somewhere.
>
open(os.path.join(os.path.dirname(__file__), 'foo'))
--
With best regards,
Daniel Kluev
--
http://mail.python.org/mailman/listinfo/python-list
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
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
>
> 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
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
56 matches
Mail list logo