« first day (2063 days earlier)      last day (2895 days later) » 

11:00 PM
I have a situation where I need to see if two variables refer to the same Object.
(I am also hazy on the nomenclature so bear with me. =_=; )
 
Sometimes I have a method that will have an optional parameter, but None is a valid value that might be passed in, so I can't make None the default value. In that case, I'll instantiate an object like "arg_omitted = object()", and then declare the arg as "def fn(arg1, arg2=arg_omitted):"
Then use "if arg2 is arg_omitted" to determine if a value was passed in or not.
 
@PaulMcGuire that's a nice touch:)
 
Thanks
 
@Augusta well var1 is var2 should do it
Since both are names, and is tells you if they are pointing to the same object. Right?
 
Yeah. It ought to.
 
11:03 PM
I concur
 
thanks
 
I just got mired with a bunch of "Use is this way!" "That isn't Pythonic!!" stuff a while ago and it left me a little confused. So! I made it Chat's problem~
 
is there a recipe to smoothen series data? For instance, if I have some time series data, and some of the values just don't exist in that data (I'm downloading some dataset), then is there a recipe/canonical_way of filling in those missing values with the linear interpolation of what's on either side?
 
Technically, what I'm after is the item in a pair that is different from a specific reference.
So other_obj = pair[pair[0] is obj]
 
I know that I can probe on either side to find the next valid value and then us np.linspace from there, but is there a canonical way of doing this?
 
11:07 PM
Which I mention here with the expectation that someone will tell me if that is a dumb way of going about a thing (in a situation where obj is known to be in pair).
 
@Augusta - Ohh, that is a bit of cleverness - what about other_obj = pair[1] if pair[0] is obj else pair[0]
 
I'd considered that but I was trying to minimize the number of times pair was evaluated.
Also, vanity.
 
It will only evaluate as necessary
 
...that's right.
Hm.
That leaves vanity. =_=;
 
How about other_obj = pair[pair[0] is obj]?
 
11:09 PM
This might be a case where verbosity supports future maintainability
 
@inspectorG4dget That was my original solution~
 
@inspectorG4dget - that looks familiar..
 
tee hee. That's what I get for skimming the conversation after coming in late
 
:y
other_obj = next(i for i in pair if i is not obj)
 
@inspectorG4dget I think interpolation is the canonical a way
 
11:11 PM
(ha ha no)
 
@inspectorG4dget - your data interpolation question is a pretty classic one in time series analysis, how to handle missing data
 
or a masked array?
 
that's what I'm doing. I was wondering if there's a canonical python way to do it
 
canonical python doesn't do numpy:)
 
Probably with a generator to emit the full time-series set.
 
11:13 PM
fair enough
 
Have the generator keep internal iterator over the original set, and then yield filler records as needed with interpolated values
 
that's too complex. I'm basically going to "fix" the data once and for all, and then never have it be a problem again
anyway, time for me to head to the old lair. Rhubarb, folks! Catch y'all t'morrow!
 
If you do that, you might mark which records are actual and which are simulated/fixed
Also, not all values should interpolate - some should latch
 
rbrb Paul
 
So instead of interpolating, retain the old value for all time events until there is a change.
This will be very dependent on the data you are massaging
and what it represents
 
11:15 PM
@inspectorG4dget good night
 
11:31 PM
Hey guys can we build beautiful desktop apps via QT and QML ?
by beautiful I mean something flat
Or maybe skinning ?
 
Trying to compile something, and I'm getting this?
checking for python-config... /usr/bin/python-config
checking Python.h usability... yes
checking Python.h presence... yes
checking for Python.h... yes
checking for PyArg_ParseTuple in -lpython... no
configure: error: Unable to find a suitable python development library
What is PyArg_ParseTuple and why does my python supposedly not have it
 
apt-get install python-dev or something?
python-dev - header files and a static library for Python (default)
> configure: error: Unable to find a suitable python development library
possibly worth a try:P
 
I'm on arch, dev headers are shipped with the regular package
 
yeah, that's what that said
well, then it's obvious what you have to do
switch to debian
 
I'm also getting a weird error during ./configure
  File "<string>", line 1
    import distutils.sysconfig;     print distutils.sysconfig.get_config_var("VERSION")
SyntaxError: invalid syntax
wait is this assuming my python is python 2
 
11:46 PM
yeah you can't have an import and a command like that, at least I've seen that on python 2
 
I didn't get the caret
 File "<string>", line 1
    import distutils.sysconfig;     print distutils.sysconfig.get_config_var("VERSION")
                                                  ^
That looks like a python 2 code being run with python 3
 
no
>>> print "asfg"
  File "<stdin>", line 1
    print "asfg"
               ^
SyntaxError: Missing parentheses in call to 'print'
 
hmm guess your right
but the weirder thing is
The module is <string>
 
it's multiply odd
maybe your python install is indeed borked
 
I think I would've noticed earlier
 
DSM
11:49 PM
The missing parenthesis warning is very recent. Before 3.5 you'd see
    import distutils.sysconfig; print distutils.sysconfig
                                              ^
SyntaxError: invalid syntax
 
It hasn't broken on anything else
 
@DSM oh
 
I just tested it on my machine though and I got the same result
 
@DSM my full output:
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print "asfg"
  File "<stdin>", line 1
    print "asfg"
               ^
SyntaxError: Missing parentheses in call to 'print'
 
Unless it is somehow using an older version of python 3
 
11:50 PM
note the 3.4.3
it must be very old then
mine is vanilla ubuntu repos, which is old
 
Again, I use arch, so I'm bleeding edge
 
maybe it was changed in 3.7:P
 
DSM
@AndrasDeak: huh. I thought it was after that. Anyway, you'll probably get what I saw if you do the import and print on the same line.
 
man, you're right
I thought I checked that too
 
DSM
So I think your guess that we have a python 2 code being executed by a 3 interpreter is correct.
 
11:52 PM
I am trying to compile Xen, I wouldn't expect there to be a compilation error in a huge open source project
 
it is, sorry guys
 
This is just super strange
 
some virtualenv problem?
 
DSM
Are you even in a venv?
 
I don't think so
 
DSM
11:55 PM
Could you try
python --version; cat `which python-config` | grep VERSION=
 
Python 3.5.1
VERSION="3.5"
LDVERSION="${VERSION}${ABIFLAGS}"
 
you're not using pip, are you?
 
DSM
@Natecat: okay, that's reassuring -- your python-config and your python are aligned.
 
instead of pip3 or something
 
11:56 PM
For what?
I'm not installing this though pip, xen isn't a python project
 
then no:P
 
It just uses python
 
ah OK
 
I'm trying to compile this from source from the git
 
DSM
Something in the build process probably assumes that python will give it python2, but your python doesn't.
 
11:59 PM
I could temporarily re-symlink python but that might be a bad idea
 

« first day (2063 days earlier)      last day (2895 days later) »