Is there any way to check that it's installed a module without import
it directly?
I'm using the nex code but it's possible that it not been necessary to
import a module
-
try:
import module
except ImportError:
pass
else:
print 'make anything'
-
--
http:/
Is there any way of to get the class name to avoid to have that write
it?
---
class Foo:
super(Foo, self)
---
* Using Py 2.6.2
--
http://mail.python.org/mailman/listinfo/python-list
On 7 jun, 11:45, Kless wrote:
> I've to write properties for several keywords with the same code, it
> only changes the name of each property:
>
> -
> @property
> def foo(self):
> return self._foo
>
> @foo.setter
> de
On 7 jun, 11:45, Kless wrote:
> I've to write properties for several keywords with the same code, it
> only changes the name of each property:
>
> -
> @property
> def foo(self):
> return self._foo
>
> @foo.setter
> de
I've to write properties for several keywords with the same code, it
only changes the name of each property:
-
@property
def foo(self):
return self._foo
@foo.setter
def foo(self, txt):
self._foo = self._any_function(txt)
#
@property
On 5 jun, 09:59, "Gabriel Genellina" wrote:
> En Fri, 05 Jun 2009 06:39:31 -0300, Kless
> escribió:
>
> > Is there any librery that works ok with unicode at converting to
> > uppercase or lowercase?
>
> > --
> >>>> foo
Is there any librery that works ok with unicode at converting to
uppercase or lowercase?
--
>>> foo = u'áèïöúñ'
>>> print(foo.upper())
áèïöúñ
--
--
http://mail.python.org/mailman/listinfo/python-list
Why can not to access from a class attribute to a function of that
class?
-
class Foo(object):
attr = __class__.__name__
attr = self.__class__.__name__
-
--
http://mail.python.org/mailman/listinfo/python-list
I usually use a class to access to global variables. So, which would
be the correct way to set them --since the following classes--:
class Foo:
var = 'lala'
class Bar:
def __init__(self):
self.var = 'lele'
Or is it the same?
--
http://mail.p
On 24 mayo, 15:33, Kless wrote:
> On 24 mayo, 12:27, Duncan Booth wrote:
>
> > Kless wrote:
> > > Is there any way to simplify the next code? Because I'm setting a
> > > variable by default of the same way than it's set in the setter.
>
>
On 24 mayo, 12:27, Duncan Booth wrote:
> Kless wrote:
> > Is there any way to simplify the next code? Because I'm setting a
> > variable by default of the same way than it's set in the setter.
>
> > ---
> > class Foo(object):
> >
Is there any way to simplify the next code? Because I'm setting a
variable by default of the same way than it's set in the setter.
---
class Foo(object):
def __init__(self, bar):
self._bar = self._change(bar) # !!! as setter
@property
def bar(self):
return se
If anybody is interesed in new technologies, you'll love this new
language called Falcon [1], which has been open sourced ago little
time.
Falcon is a scripting engine ready to empower mission-critical
multithreaded applications. It provides six integrated programming
paradigms: procedural, object
Does anybody has seen the performance of Python 3?
Respect to speed it's the last language together to Ruby 1.8, but Ruby
1.9 has a lot of better performance. :(
http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=all
--
http://mail.python.org/mailman/listinfo/python-list
To get class variables can be used *for i in dir(self): * but how to
get variables initialized on the constructor?
--
http://mail.python.org/mailman/listinfo/python-list
Thanks Gabriel. You have reason, and I was having a design error.
On 23 feb, 10:02, "Gabriel Genellina" wrote:
> En Mon, 23 Feb 2009 07:40:47 -0200, Kless
> escribió:
>
> > How to access from a class variable to one that is initialized on the
> > constructor?
&
On 23 feb, 10:17, Kless wrote:
> To get class variables can be used *for i in dir(self): * but how to
> get variables initialized on the constructor?
Sorry. It's so simple as insert *self*.
--
http://mail.python.org/mailman/listinfo/python-list
How to access from a class variable to one that is initialized on the
constructor?
--
class Foo():
foo = bar # I want to access *from here* to variables created on
the constructor.
def __init__(self, bar_init):
self.bar = bar_init
--
Note: I've to create a subclas
How is possible that I can print a variable, but when I use *return
var* it returns an empty string
http://paste.pocoo.org/show/97588/
--
http://mail.python.org/mailman/listinfo/python-list
On 3 ene, 19:51, "Diez B. Roggisch" wrote:
> Kless schrieb:
>
>
>
> > On 3 ene, 19:40, Simon Forman wrote:
> >> On Jan 3, 11:20 am, Kless wrote:
>
> >>> Afghanistan
> >>> AF
> >>> Out[19]: u'AF'
> >>
On 3 ene, 19:40, Simon Forman wrote:
> On Jan 3, 11:20 am, Kless wrote:
>
> > Afghanistan
> > AF
> > Out[19]: u'AF'
> > AFG
> > Out[19]: u'AFG'
> > 004
> > Out[19]: u'004'
>
> What?
That's the output got f
On 3 ene, 19:12, "Diez B. Roggisch" wrote:
> Kless schrieb:
>
> > How is possible that I can print a variable, but when I use *return
> > var* it returns an empty string
>
> >http://paste.pocoo.org/show/97588/
>
> I don't see anything that indicate
On 21 dic, 23:53, "Chris Rebert" wrote:
> On Sun, Dec 21, 2008 at 4:21 AM, Kless wrote:
> > Is there any way of use HMAC with RIPEMD-160?
>
> > Since that to create a ripemd-160 hash there is to use:
> > h = hashlib.new('ripemd160')
> > it loo
Is there any way of use HMAC with RIPEMD-160?
Since that to create a ripemd-160 hash there is to use:
h = hashlib.new('ripemd160')
it looks that isn't possible
For HMAC-SHA256 would be:
-
import hashlib
import hmac
hm = hmac.new('key', msg='message', digestmod=hashlib.sha256)
---
When I use the next command in my home system:
$ python setup.py develop
Pyrex compiles the '.pyx' file without any problem. But after of
uploading it to Pypi, and when is installed via 'easy_install' it
doesn't builds any more. (I had to upload the '.c' file compiled on my
system)
You can see
On 1 dic, 18:17, Kless <[EMAIL PROTECTED]> wrote:
> How to chmod a file to: o-rwx ? (to change only the others mode)
>
> os.chmod(fname, )
>
> I was reading this [1], but the truth is that anything as 'S_IRUSR'
> doesn't help enought.
>
> [1]http://www
How to chmod a file to: o-rwx ? (to change only the others mode)
os.chmod(fname, )
I was reading this [1], but the truth is that anything as 'S_IRUSR'
doesn't help enought.
[1] http://www.python.org/doc/2.5.2/lib/os-file-dir.html
--
http://mail.python.org/mailman/listinfo/python-list
an exception is raised.
It only was an example but I need show a better message. You can see
code here [1]:
[1] http://github.com/kless/cryha/tree/master/cryha/hasher.py#L141
--
http://mail.python.org/mailman/listinfo/python-list
Which is the best mode for validation of parameters? I'm using the
next way but it is not well testable.
-
if not self._foo:
try:
raise ValueError('ValueError: foo not found')
except ValueError, err:
print (err.message)
print("Valid value
How to check is a library/module is installed on the system? I use the
next code but it's possivle that there is a best way.
---
try:
import foo
foo_loaded = True
except ImportError:
foo_loaded = False
---
Thanks in advance!
--
http://mail.python.org/m
On 3 ago, 00:31, Tim Roberts <[EMAIL PROTECTED]> wrote:
> Whether it creates problems depends on how you intend to use it. The
> biggest use for Base64, for instance, is in translating binary files to a
> form where they can be send via email using only printable characters. If
> you use a non-pr
On 3 ago, 00:33, Terry Reedy <[EMAIL PROTECTED]> wrote:
> seehttp://en.wikipedia.org/wiki/Base-85
> for something more practical
In this thread [1] --a mirror group of python-dev mailing list-- where
I sent the same post, has been named too that enconding way.
[1]
http://groups.google.com/group
On 3 ago, 00:16, Tim Roberts <[EMAIL PROTECTED]> wrote:
> Kless <[EMAIL PROTECTED]> wrote:
>
> >I think that would be very interesting thay Python would have a module
> >for working on base 96 too. [1]
>
> Well, then, write one.
>
> However, I'm n
I think that would be very interesting thay Python would have a module
for working on base 96 too. [1]
It could be converted to base 96 the digests from hashlib module, and
random bytes used on crypto (to create the salt, the IV, or a key).
As you can see here [2], the printable ASCII characters
I've a constructor with several values that must be used by any
functions:
---
class foo:
def __init__(self, foo1, foo2, foon):
self.__check(foo1=foo1, foo2=foo2, foon=foon)
self.__check2(foo1=foo1, foo2=foo2, foon=foon)
def __check(self, foo1, foo2, foon):
...
Akathorn Greyhat sent me by email the next solution, which althought
isn't generic it works well:
-
You could make your own class for that, maybe something like
#
class MyCoolDictionary(dict):
def __init__(self, *args, **kargs):
dict.__init__(self, *args, **kargs
But in my dictionary both keys and values are unique.
On Jul 14, 7:34 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Sun, 13 Jul 2008 16:21:11 -0700 (PDT), Kless
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
> > I need a dictionary where
I need a dictionary where get the result from a 'key' (on left), but
also from a 'value' (on right), how to get it?
I know that dictionaries aren't bidirectional, but is there any way
without use two dictionaries?
Thanks in advance!
--
http://mail.python.org/mailman/listinfo/python-list
It would be very interesting if the python community could to access
since SQLAlchemy to more features of the PostgreSQL 8.3 RDBMS
powerful, as are any new data types as: enumerated (ENUM) [1], XML
[2], Universally Unique Identifiers (UUID) [3], and monetary [4].
For if anybody is interested on a
I understand very well that a service is a software which is accessed
through a network.
And the description given on Wikipedia [1] is "A 'Web service' (also
Web Service) is defined by the W3C as "a software system designed to
support interoperable Machine to Machine interaction over a network."
On 9 jun, 22:46, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Kless schrieb:
>
> > On 9 jun, 21:40, Lie <[EMAIL PROTECTED]> wrote:
> >> Do you notice that the terms are for the SERVICE not for the SOFTWARE.
> >> The terms for the service
On 9 jun, 21:40, Lie <[EMAIL PROTECTED]> wrote:
> Do you notice that the terms are for the SERVICE not for the SOFTWARE.
> The terms for the service is quite reasonable, as I see it.
> The software itself is governed by the Apache License 2.0, detailed
> here:http://www.apache.org/licenses/LICENSE-
The Python Client Library for Google Data APIs [1] has been licensed
as Apache 2.0 -a free license- but at the same time they are
restricting the rights of the users with these conditions [2], and I
don't like for anything this.
--With a hand I show you one thing but with the another one I make
an
On 18 ago, 00:20, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> Kless <[EMAIL PROTECTED]> writes:
> > So it haven't Twofish, Serpent, neither Whirlpool. Neither many others.
>
> Unless you have an interoperability requirement or some other specific
> issue, you
On 17 ago, 20:34, Laszlo Nagy <[EMAIL PROTECTED]> wrote:
> > For who knows any of criptography I comment that you can use
> > algorithms as secure as Rijndael, Twofish, or Serpent with the CFB
> > cipher mode. And for hash you can use RIPEMD, SHA-2 or WHIRLPOOL.
>
> As I recall, PyCrypto can also u
Since that I'm working to let encrypt/hash data in the data base of my
projects I have been looking for libraries and/or wrappers. So I want
give my feedback about it.
In the first I found PyCrypto [1] but I see any problems:
* I think that isn't been maintained because the last modification of
i
46 matches
Mail list logo